A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/324456.html below:

Accessing class variable at class creation time

Accessing class variable at class creation time Accessing class variable at class creation timeCarlos carlosjosepita at gmail.com
Fri Sep 23 17:01:21 EDT 2005
Hi!

class A:
  X = 2
  def F():
    print A.X
  F()

The above fails because the name A is not
yet at global scope when the reference A.X
is reached. Is there any way to refer to A.X
without making explicit use of the name 'A'?
Admittedly the code looks pretty unusual,
but I'm defining configuration "minilanguages"
to configure different parts of an application,
each inside a configuration class (like A),
and I find this very convenient except for
the above problem.

Thank you in advance
Regards,
Carlos


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4