End of file

Robert Brewer fumanchu at amor.org
Mon Oct 11 00:57:27 EDT 2004


Alex Martelli:
> Since an immediate instance of type object has no possible 
> use except as a unique, distinguishable placeholder,

Greg Ewing:
>That's not true -- you can also assign attributes to such
>an object and use it as a record. (It's not a common use,
>but it's a *possible* use!)

Bengt Richter:
> I originally thought that too, but (is this a 2.3.2 bug?):
>  >>> obj = object()
>  >>> obj.x = 1
>  Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
>  AttributeError: 'object' object has no attribute 'x'
>8
> OTOH, making a thing to hang attributes on is a one liner 
> (though if you want more than one instance, class Record: pass;
> rec=Record() is probably better.

Or even:

class Record(object): pass
rec = Record()

Is there some reason people consistently don't use new-style classes? :(


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org



More information about the Python-list mailing list