Re: About __class__ of an int literal

2010-09-29 Thread Steven D'Aprano
On Wed, 29 Sep 2010 02:20:55 +0100, MRAB wrote: On 29/09/2010 01:19, Terry Reedy wrote: A person using instances of a class should seldom use special names directly. They are, in a sense, implementation details, even if documented. The idiom if __name__ == '__main__': is an exception.

Re: About __class__ of an int literal

2010-09-29 Thread Hrvoje Niksic
Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Wed, 29 Sep 2010 02:20:55 +0100, MRAB wrote: On 29/09/2010 01:19, Terry Reedy wrote: A person using instances of a class should seldom use special names directly. They are, in a sense, implementation details, even if

Re: About __class__ of an int literal

2010-09-29 Thread Terry Reedy
On 9/29/2010 8:34 AM, Hrvoje Niksic wrote: Steven D'Apranost...@remove-this-cybersource.com.au writes: On Wed, 29 Sep 2010 02:20:55 +0100, MRAB wrote: On 29/09/2010 01:19, Terry Reedy wrote: A person using instances of a class should seldom use special names directly. They are, in a

Re: About __class__ of an int literal

2010-09-29 Thread Steven D'Aprano
On Wed, 29 Sep 2010 14:46:18 -0400, Terry Reedy wrote: In that sense the user should be calling iter(foo) instead of foo.__iter__(), next(foo) instead of foo.__next__(), and foo+bar instead of foo.__add__(bar). Yes. Guido added iter() and next() to the list of built-in functions, even

Re: About __class__ of an int literal

2010-09-29 Thread Steven D'Aprano
On Wed, 29 Sep 2010 14:34:33 +0200, Hrvoje Niksic wrote: Steven D'Aprano st...@remove-this-cybersource.com.au writes: (This may change in the future. Given type(), and isinstance(), I'm not sure what value __class__ adds.) None whatsoever. __class__ used to be necessary to tell the appart

About __class__ of an int literal

2010-09-28 Thread AlexWalk
In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. I searched the python issue tracker but failed to find relevant reports. I

Re: About __class__ of an int literal

2010-09-28 Thread Tim Golden
On 28/09/2010 10:27, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. I searched the python issue tracker

Re: About __class__ of an int literal

2010-09-28 Thread Stefan Schwarzer
Hello Alex, On 2010-09-28 11:27, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. I searched the python

Re: About __class__ of an int literal

2010-09-28 Thread Hans Mulder
Tim Golden wrote: On 28/09/2010 10:27, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. I searched the

Re: About __class__ of an int literal

2010-09-28 Thread Terry Reedy
On 9/28/2010 5:27 AM, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. Third solution: type(0) is 0

Re: About __class__ of an int literal

2010-09-28 Thread MRAB
On 29/09/2010 01:19, Terry Reedy wrote: On 9/28/2010 5:27 AM, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok.