Re: object().__dict__

2014-04-23 Thread CHIN Dihedral
On Wednesday, April 23, 2014 10:21:26 PM UTC+8, Amirouche Boubekki wrote: > 2014-04-23 15:59 GMT+02:00 Phil Connell : > > > > On Wed, Apr 23, 2014 at 03:48:32PM +0200, Amirouche Boubekki wrote: > > > 2014-04-23 8:11 GMT+02:00 Cameron Simpson : > > > > > Look up the "__slots__" dunder var in t

Re: object().__dict__

2014-04-23 Thread Phil Connell
On Wed, Apr 23, 2014 at 04:21:26PM +0200, Amirouche Boubekki wrote: > 2014-04-23 15:59 GMT+02:00 Phil Connell : > > > On Wed, Apr 23, 2014 at 03:48:32PM +0200, Amirouche Boubekki wrote: > > > 2014-04-23 8:11 GMT+02:00 Cameron Simpson : > > > > Look up the "__slots__" dunder var in the Python doco

Re: object().__dict__

2014-04-23 Thread Amirouche Boubekki
2014-04-23 15:59 GMT+02:00 Phil Connell : > On Wed, Apr 23, 2014 at 03:48:32PM +0200, Amirouche Boubekki wrote: > > 2014-04-23 8:11 GMT+02:00 Cameron Simpson : > > > Look up the "__slots__" dunder var in the Python doco index: > > > > > > https://docs.python.org/3/glossary.html#term-slots > > >

Re: object().__dict__

2014-04-23 Thread Phil Connell
On Wed, Apr 23, 2014 at 03:48:32PM +0200, Amirouche Boubekki wrote: > 2014-04-23 8:11 GMT+02:00 Cameron Simpson : > > Look up the "__slots__" dunder var in the Python doco index: > > > > https://docs.python.org/3/glossary.html#term-slots > > > > You'll see it as a (rarely used, mostly discouraged

Re: object().__dict__

2014-04-23 Thread Amirouche Boubekki
2014-04-23 8:11 GMT+02:00 Cameron Simpson : > On 23Apr2014 09:39, Pavel Volkov wrote: > >> There are some basics about Python objects I don't understand. >> Consider this snippet: >> >> class X: pass > ... >> >>> x = X() > dir(x) > ['__class__', '__delattr__', '__dict__',

Re: object().__dict__

2014-04-22 Thread Cameron Simpson
On 23Apr2014 09:39, Pavel Volkov wrote: There are some basics about Python objects I don't understand. Consider this snippet: class X: pass ... x = X() dir(x) ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__h

Re: object().__dict__

2014-04-22 Thread Ben Finney
Pavel Volkov writes: > The attribute list is different now and there's no __dict__ and the > object does not accept new attributes. > Please explain what's going on. It's a leaky abstraction, unfortunately. By default, all user-defined types will provide their instances with a ‘__dict__’ attrib

object().__dict__

2014-04-22 Thread Pavel Volkov
There are some basics about Python objects I don't understand. Consider this snippet: class X: pass ... x = X() dir(x) ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '_