Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20844

Re: namespace question

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: namespace question
Date 2012-02-25 00:39 +0000
References <4895480.4960.1330062902417.JavaMail.geo-discussion-forums@ynjd19> <02658273-fb07-4cb6-a223-27520f4a0168@p13g2000yqd.googlegroups.com> <4f480e68$0$29989$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.147.1330130406.3037.python-list@python.org> (permalink)

Show all headers | View raw


On 24/02/2012 22:25, Steven D'Aprano wrote:
> On Fri, 24 Feb 2012 10:08:43 -0800, David wrote:
>
>> Your code updated to show the difference between a variable, a class
>> variable, and an instance variable.
>
> The preferred terms in Python circles are class and instance
> *attributes*, not variables.
>
> An integer variable is a variable holding an integer.
>
> A string variable is a variable holding a string.
>
> A list variable is a variable holding a list.
>
> Therefore a class variable is a variable holding a class, and an instance
> variable is a variable holding an instance.
>
> Yes, in Python, classes and types are first-class objects (pun not
> intended), and it is quite common to store them in variables:
>
> for cls in (int, float, Decimal, Fraction, myint, myfloat):
>      do_something_with(cls)
>
>
> Other languages may choose to use illogical terminology if they choose.
>

Surely you mean names, not variables? :)

-- 
Cheers.

Mark Lawrence.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

namespace question xixiliguo <wangbo.red@gmail.com> - 2012-02-23 21:55 -0800
  Re: namespace question Chris Rebert <clp2@rebertia.com> - 2012-02-23 22:35 -0800
  Re: namespace question Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-02-24 12:56 +0100
  Re: namespace question David <dwblas@gmail.com> - 2012-02-24 10:08 -0800
    Re: namespace question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-24 22:25 +0000
      Re: namespace question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-02-25 00:39 +0000
        Re: namespace question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-25 01:38 +0000
      Re: namespace question Ben Finney <ben+python@benfinney.id.au> - 2012-02-26 19:47 +1100
        Re: namespace question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-26 13:40 +0000
          Re: namespace question Ben Finney <ben+python@benfinney.id.au> - 2012-02-28 22:36 +1100
            Re: namespace question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-28 14:06 +0000

csiph-web