Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73255

Re: Asymmetry in globals __getitem__/__setitem__

From Marko Rauhamaa <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Re: Asymmetry in globals __getitem__/__setitem__
Date 2014-06-13 09:07 +0300
Organization A noiseless patient Spider
Message-ID <878up1wde6.fsf@elektro.pacujo.net> (permalink)
References <mailman.11039.1402597117.18130.python-list@python.org> <bvuvg0FpihtU2@mid.individual.net>

Show all headers | View raw


Gregory Ewing <greg.ewing@canterbury.ac.nz>:

> I didn't think that using a custom mapping object for globals was
> officially supported. Has that changed?

The documentation is a bit vague about it:

   If only globals is provided, it must be a dictionary, which will be
   used for both the global and the local variables. If globals and
   locals are given, they are used for the global and local variables,
   respectively. If provided, locals can be any mapping object.

Now, if you define:

   class Namespace(dict):
       ...

A Namespace *is* a dict[ionary] in the classic OOP sense.


Marko

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Asymmetry in globals __getitem__/__setitem__ Robert Lehmann <mail@robertlehmann.de> - 2014-06-12 20:18 +0200
  Re: Asymmetry in globals __getitem__/__setitem__ Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-13 12:38 +1200
    Re: Asymmetry in globals __getitem__/__setitem__ Marko Rauhamaa <marko@pacujo.net> - 2014-06-13 09:07 +0300
      Re: Asymmetry in globals __getitem__/__setitem__ robert@robertlehmann.de - 2014-06-13 03:13 -0700
        Re: Asymmetry in globals __getitem__/__setitem__ Peter Otten <__peter__@web.de> - 2014-06-13 12:53 +0200
        Re: Asymmetry in globals __getitem__/__setitem__ Paul Sokolovsky <pmiscml@gmail.com> - 2014-06-13 14:28 +0300
          Re: Asymmetry in globals __getitem__/__setitem__ Marko Rauhamaa <marko@pacujo.net> - 2014-06-13 15:32 +0300

csiph-web