Martin,
These two cases generate different bytecode.
def foo(): # foo.func_code.co_flags == 0x43
print x# LOAD_FAST 0
x = 3
class Foo: # .co_flags == 0x40
print x# LOAD_NAME 'x'
x = 3
In functions, local variables are just numbered slots.
On Fri, Oct 07, 2005 at 12:15:04PM -0700, Martin Maly wrote:
> Hello Python-Dev,
>
> My name is Martin Maly and I am a developer at Microsoft, working on the
> IronPython project with Jim Hugunin. I am spending lot of time making
> IronPython compatible with Python to the extent possible.
>
> I
Martin Maly wrote:
> Hello Python-Dev,
>
> My name is Martin Maly and I am a developer at Microsoft, working on the
> IronPython project with Jim Hugunin. I am spending lot of time making
> IronPython compatible with Python to the extent possible.
>
> I came across a case which I am not sure if
At 12:15 PM 10/7/2005 -0700, Martin Maly wrote:
>Based on the binding rules described in the Python documentation, I
>would expect the code to throw because binding created on the line (1)
>is local to the class block and all the other __doc__ uses should
>reference that binding. Apparently, it is
Martin Maly wrote:
> I came across a case which I am not sure if by design or a bug in Python
> (Python 2.4.1 (#65, Mar 30 2005, 09:13:57)). Consider following Python
> module:
>
> # module begin
> "module doc"
>
> class c:
> print __doc__
> __doc__ = "class doc" (1)
> print __doc__
>
Hello Python-Dev,
My name is Martin Maly and I am a developer at Microsoft, working on the
IronPython project with Jim Hugunin. I am spending lot of time making
IronPython compatible with Python to the extent possible.
I came across a case which I am not sure if by design or a bug in Python
(Pyt