On 11/30/2012 11:05 AM, andrea crotti wrote:
> Well I knew that this works fine, even if I feel a bit guilty to do
> this, and better is:
>
> foo = 'bar' if some_condition else 'baz'
>
> Anyway for me the suprise is that something that is defined *later* at
> the module scope is found in a function
andrea crotti
>
> I wrote a script, refactored it and then introducing a bug as below:
>
> def record_things():
> out.write("Hello world")
>
> if __name__ == '__main__':
> with open('output', 'w') as out:
> record_things()
>
>
> but the shocking thing is that it didn't actually
- Original Message -
> Well I knew that this works fine, even if I feel a bit guilty to do
> this, and better is:
>
> foo = 'bar' if some_condition else 'baz'
>
> Anyway for me the suprise is that something that is defined *later*
> at
> the module scope is found in a function which is de
On Sat, Dec 1, 2012 at 3:05 AM, andrea crotti wrote:
> Well I knew that this works fine, even if I feel a bit guilty to do
> this, and better is:
>
> foo = 'bar' if some_condition else 'baz'
>
> Anyway for me the suprise is that something that is defined *later* at
> the module scope is found in a
Am 30.11.2012 12:11, schrieb andrea crotti:
I wrote a script, refactored it and then introducing a bug as below:
def record_things():
out.write("Hello world")
This is a function. Since "out" is not a local variable, it is looked up
in the surrounding namespace at the time the function is
- Original Message -
> 2012/11/30 andrea crotti :
>
> Already changing it to:
>
> def record_things():
> out.write("Hello world")
>
> def main():
> with open('output', 'w') as out:
> record_things()
>
> if __name__ == '__main__':
> main()
>
> makes it stops workin
- Original Message -
> I wrote a script, refactored it and then introducing a bug as below:
>
> def record_things():
> out.write("Hello world")
>
> if __name__ == '__main__':
> with open('output', 'w') as out:
> record_things()
>
>
> but the shocking thing is that it did