Question about a single underscore.

Steven W. Orr steveo at syslang.net
Thu Feb 1 13:54:09 EST 2007


On Thursday, Feb 1st 2007 at 10:36 -0800, quoth Paul Rubin:

=>"Steven W. Orr" <steveo at syslang.net> writes:
=>> to cause a different instantiation a la
=>> foo	= _const()
=>> The goal would be to create different instances of consts.
=>
=>The idea of putting it in sys.modules is so it's visible in all modules.
=>
=>> >>> import const
=>> >>> iii=_const()
=>
=>You need 
=>   iii = const._const
=>-- 
=>http://mail.python.org/mailman/listinfo/python-list
=>


547 > python
Python 2.3.5 (#2, May  4 2005, 08:51:39) 
[GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import const
>>> iii = const._const
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: _const instance has no attribute '_const'
*>>> iii = const._const()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: _const instance has no attribute '_const'
>>> 


What am I missing here? (Sorry if it should be obvious)

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



More information about the Python-list mailing list