Re: Python Question

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Fri, 24 Sep 2010 09:15:34 -0400

Can you be more specific about what is a point of confusion? Python does not really have global variables. It has module, class, and method scopes. A module-scope variable can work like a global variable for code in the same module. For code in another module, the module name plus dot must prefix the variable. This true for functions as well, except for built-in functions of the language. A function inside a class definition is also called a method. A function may be defined at either the module or class level.


Jamal


On 9/24/2010 8:46 AM, Homme, James wrote:


Hi,

I'm starting to get confused because you use dot notation to call
functions and use variables within modules and classes both. I'll keep
going and it will probably clear itself up.

Jim

Jim Homme,

Usability Services,

Phone: 412-544-1810. Skype: jim.homme

Internal recipients, Read my accessibility blog
<http://mysites.highmark.com/personal/lidikki/Blog/default.aspx>.
Discuss accessibility here
<http://collaborate.highmark.com/COP/technical/accessibility/default.aspx>.
Accessibility Wiki: Breaking news and accessibility advice
<http://collaborate.highmark.com/COP/technical/accessibility/Accessibility%20Wiki/Forms/AllPages.aspx>


*From:* programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] *On Behalf Of *R Dinger
*Sent:* Thursday, September 23, 2010 9:54 PM
*To:* programmingblind@xxxxxxxxxxxxx
*Subject:* Re: Python Question

Hi Jim,

As I understand things, a module in Python is first of all a file. A
module can contain many different Python object definitions like:

* simple variables

* function definitions

* class definitions

The module also provides a namespace for these definitions for
referencing them in other modules. The module is one of the basic
structuring elements in the Python language.

The class in Python is, like most other object oriented languages, the
mechanism for defining the state and behavior of class objects. Python
class objects, again like most object oriented languages, encapsulate
state (or data) and behavior (functions) into a single software entity.

Richard

----- Original Message -----

    *From:* Homme, James <mailto:james.homme@xxxxxxxxxxxx>

    *To:* programmingblind@xxxxxxxxxxxxx
    <mailto:programmingblind@xxxxxxxxxxxxx>

    *Sent:* Thursday, September 23, 2010 11:20 AM

    *Subject:* Python Question

    Hi,

    In Python, what are the differences between a module and a class?

    Thanks.

    Jim

    Jim Homme,

    Usability Services,

    Phone: 412-544-1810. Skype: jim.homme

    Internal recipients, Read my accessibility blog
    <http://mysites.highmark.com/personal/lidikki/Blog/default.aspx>.
    Discuss accessibility here
    <http://collaborate.highmark.com/COP/technical/accessibility/default.aspx>.
    Accessibility Wiki: Breaking news and accessibility advice
    
<http://collaborate.highmark.com/COP/technical/accessibility/Accessibility%20Wiki/Forms/AllPages.aspx>


    This e-mail and any attachments to it are confidential and are
    intended solely for use of the individual or entity to whom they are
    addressed. If you have received this e-mail in error, please notify
    the sender immediately and then delete it. If you are not the
    intended recipient, you must not keep, use, disclose, copy or
    distribute this e-mail without the author's prior permission. The
    views expressed in this e-mail message do not necessarily represent
    the views of Highmark Inc., its subsidiaries, or affiliates.

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: