On Aug 2, 6:46 am, Chris Rebert wrote:
> > Is there any way to install a custom type as a namespace?
>
> For classes/objects, yes, using metaclasses.
> See the __prepare__() method in PEP
> 3115:http://www.python.org/dev/peps/pep-3115/
Here is an example of usage:
http://www.artima.com/weblogs/
On Sun, Aug 2, 2009 at 12:18 AM, Steven
D'Aprano wrote:
> On Sat, 01 Aug 2009 21:46:35 -0700, Chris Rebert wrote:
>
>>> Is there any way to install a custom type as a namespace?
>>
>> For classes/objects, yes, using metaclasses. See the __prepare__()
>> method in PEP 3115: http://www.python.org/dev
On Sat, 01 Aug 2009 21:46:35 -0700, Chris Rebert wrote:
>> Is there any way to install a custom type as a namespace?
>
> For classes/objects, yes, using metaclasses. See the __prepare__()
> method in PEP 3115: http://www.python.org/dev/peps/pep-3115/
Looks good, but that's Python 3 only, yes?
A
On Sat, Aug 1, 2009 at 6:06 PM, Steven
D'Aprano wrote:
> I was playing around with a custom mapping type, and I wanted to use it
> as a namespace, so I tried to use it as my module __dict__:
>
import __main__
__main__.__dict__ = MyNamespace()
> Traceback (most recent call last):
> File "
On Sun, Aug 2, 2009 at 9:06 AM, Steven D'Aprano <
st...@remove-this-cybersource.com.au> wrote:
> I was playing around with a custom mapping type, and I wanted to use it
> as a namespace, so I tried to use it as my module __dict__:
>
> >>> import __main__
> >>> __main__.__dict__ = MyNamespace()
> T