S
Steven W. Orr
On Friday, Feb 23rd 2007 at 11:12 -0500, quoth Steven W. Orr:
=>I understand that two leading underscores in a class attribute make the
=>attribute private. But I often see things that are coded up with one
=>underscore. Unless I'm missing something, there's a idiom going on here.
=>
=>Why do people sometimes use one leading underscore?
I found the answer. It turns out that if you say:
import foo
then you get access to all of the attributes that are not mangled. A
single leading underscore does not cause mangling.
If you say
from foo import _fooa, _foob,
then the import will fail because the _ is used only by the import to
decide that you shouldn't see _fooa or _foob.
--
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
=>I understand that two leading underscores in a class attribute make the
=>attribute private. But I often see things that are coded up with one
=>underscore. Unless I'm missing something, there's a idiom going on here.
=>
=>Why do people sometimes use one leading underscore?
I found the answer. It turns out that if you say:
import foo
then you get access to all of the attributes that are not mangled. A
single leading underscore does not cause mangling.
If you say
from foo import _fooa, _foob,
then the import will fail because the _ is used only by the import to
decide that you shouldn't see _fooa or _foob.
--
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