On Wed, 25 Jul 2007 00:55:17 +, Alex Popescu wrote:
> Neil Cerutti <[EMAIL PROTECTED]> wrote in news:eRwpi.36813$G23.28496
> @newsreading01.news.tds.net:
>
>> On 2007-07-25, Alex Popescu <[EMAIL PROTECTED]> wrote:
>>> As a matter of style, how do you figure out that class_list is
>>> a class
On Wed, 25 Jul 2007 00:22:18 +, Alex Popescu wrote:
> "Steven D'Aprano" <[EMAIL PROTECTED]> wrote in
> news:[EMAIL PROTECTED]:
>
>> On Tue, 24 Jul 2007 21:35:58 +, Alex Popescu wrote:
>>
>>> Neil Cerutti <[EMAIL PROTECTED]> wrote in
>>> news:[EMAIL PROTECTED]:
>>>
On 2007-07-24,
On 2007-07-25, Alex Popescu <[EMAIL PROTECTED]> wrote:
> Neil Cerutti <[EMAIL PROTECTED]> wrote in news:eRwpi.36813$G23.28496
> @newsreading01.news.tds.net:
>
>> On 2007-07-25, Alex Popescu <[EMAIL PROTECTED]> wrote:
>>> As a matter of style, how do you figure out that class_list is
>>> a class att
Alex Popescu a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> wrote
> in news:[EMAIL PROTECTED]:
>
>
>
>>[snip...]
>>
>>
>>Not necessarily - you can access class attributes from within an
>>instance method (but obviously a classmethod cannot access instance
>>attributes).
>>
>
> What I a
En Tue, 24 Jul 2007 21:55:17 -0300, Alex Popescu
<[EMAIL PROTECTED]> escribió:
> Neil Cerutti <[EMAIL PROTECTED]> wrote in news:eRwpi.36813$G23.28496
> @newsreading01.news.tds.net:
>> On 2007-07-25, Alex Popescu <[EMAIL PROTECTED]> wrote:
>>> As a matter of style, how do you figure out that clas
Neil Cerutti <[EMAIL PROTECTED]> wrote in news:eRwpi.36813$G23.28496
@newsreading01.news.tds.net:
> On 2007-07-25, Alex Popescu <[EMAIL PROTECTED]> wrote:
>> As a matter of style, how do you figure out that class_list is
>> a class attribute and not an instance attribute? (I don't
>> remember seei
On 2007-07-25, Alex Popescu <[EMAIL PROTECTED]> wrote:
> As a matter of style, how do you figure out that class_list is
> a class attribute and not an instance attribute? (I don't
> remember seeing anything in the PEP describing the coding
> style).
Check out dir(MyClass) and dir(MyClass()) for so
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> On Tue, 24 Jul 2007 21:35:58 +, Alex Popescu wrote:
>
>> Neil Cerutti <[EMAIL PROTECTED]> wrote in
>> news:[EMAIL PROTECTED]:
>>
>>> On 2007-07-24, Alex Popescu <[EMAIL PROTECTED]> wrote:
Bruno Desthuilliers
On Tue, 24 Jul 2007 21:35:58 +, Alex Popescu wrote:
> Neil Cerutti <[EMAIL PROTECTED]> wrote in
> news:[EMAIL PROTECTED]:
>
>> On 2007-07-24, Alex Popescu <[EMAIL PROTECTED]> wrote:
>>> Bruno Desthuilliers <[EMAIL PROTECTED]>
>>> wrote in news:[EMAIL PROTECTED]:
>>>
>>
>> [snip...]
>>
>>>
>>
Neil Cerutti <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> On 2007-07-24, Alex Popescu <[EMAIL PROTECTED]> wrote:
>> Bruno Desthuilliers <[EMAIL PROTECTED]>
>> wrote in news:[EMAIL PROTECTED]:
>>
>
> [snip...]
>
>>
>> class MyClass(object):
>> class_list = ['a', 'b']
>>
>> def instan
On 2007-07-24, Alex Popescu <[EMAIL PROTECTED]> wrote:
> Bruno Desthuilliers <[EMAIL PROTECTED]> wrote
> in news:[EMAIL PROTECTED]:
>
>
>>
>> [snip...]
>>
>>
>> Not necessarily - you can access class attributes from within an
>> instance method (but obviously a classmethod cannot access instance
james_027 a écrit :
> hi,
>
>> The 'real' use is (are) the one(s) you'll find. FWIW, I use
>> staticmethods for helper functions that don't need access to the class
>> or instance but are too specific to a class to be of any use as plain
>> functions. Which is not a very frequent case. Classmethod
hi,
> The 'real' use is (are) the one(s) you'll find. FWIW, I use
> staticmethods for helper functions that don't need access to the class
> or instance but are too specific to a class to be of any use as plain
> functions. Which is not a very frequent case. Classmethods are more
> usefull - mostl
james_027 a écrit :
> hi,
>
> python's staticmethod is the equivalent of java staticmethod right?
IIRC, yes. A 'staticmethod' is in fact nothing more than a function
attached to a class, and which can be called on the class or an instance
of. Note that since Python supports modules and function
On Tue, 24 Jul 2007 03:19:05 +, james_027 wrote:
> python's staticmethod is the equivalent of java staticmethod right?
Correct. `staticmethod` is essentially just a function moved into a class
and accessible at the class object and instances of that class.
As Python opposed to Java has func
15 matches
Mail list logo