![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.python archiveRe: Can we create an_object = object() and add attribute like for a class?
From: Alex Martelli <aleaxit@yahoo.com>
Date: Sun Apr 30 2006 - 00:23:45 CEST
Pierre Rouleau <prouleau@impathnetworks.com> wrote:
> Hi all,
Yep: instances of type object do not have a __dict__ and therefore there
> Being able to do it would seem a natural way of declaring namespaces.
I find that ns = type('somename', (), dict(anattribute=23)) isn't too
At any rate, any natural way of declaring a namespace SHOULD allow
class Namespace(object):
and I generally go further anyway, by defining at least a repr that
Alex
|