Instance of class "object"
Ben Finney
bignose+hates-spam at benfinney.id.au
Fri May 16 04:57:43 EDT 2008
"甜瓜" <littlesweetmelon at gmail.com> writes:
> Howdy,
> I wonder why below does not work.
>
> a = object()
> a.b = 1 # dynamic bind attribute failed...
>
> To make it correct, we have to create a new class:
> class MyClass(object): pass
> a = MyClass()
> a.b = 1 # OK
It's annoyingly difficult to search for information on this; "python
class object type inherit bind attribute" aren't sufficiently
distinguishing to know that we're talking about the built-in 'object'
type, and inheriting from it.
I'm interested to know the answer to your question; thanks for asking it.
--
\ "Don't be afraid of missing opportunities. Behind every failure |
`\ is an opportunity somebody wishes they had missed." -- Jane |
_o__) Wagner, via Lily Tomlin |
Ben Finney
More information about the Python-list
mailing list