Re: How to `eval` code with `def`?

2017-05-28 Thread Gregory Ewing
Peng Yu wrote: Does anybody know what is the correct way to evaluation python code that contains `def`? Thanks. Here's one way to do it: env = {} exec(s, env, env) Now env['f'] contains the defined function, which you can then call, disassemble or whatever you want. -- Greg -- https://

Re: pip list --outdated gives all packages

2017-05-28 Thread Cecil Westerhof
On Monday 29 May 2017 06:16 CEST, Cecil Westerhof wrote: >> I'm completely flummoxed then; on my machines I get the 'old' >> behavior. Can you try a completely clean Debian install somewhere >> (maybe on a virtual box) and see what happens? I'm wondering if >> there is something going on with your

Re: pip list --outdated gives all packages

2017-05-28 Thread Cecil Westerhof
On Monday 29 May 2017 02:45 CEST, Cem Karan wrote: > > On May 27, 2017, at 11:10 AM, Cecil Westerhof wrote: > >> On Saturday 27 May 2017 16:34 CEST, Cem Karan wrote: >> >>> >>> On May 27, 2017, at 7:15 AM, Cecil Westerhof wrote: >>> On Saturday 27 May 2017 12:33 CEST, Cecil Westerhof wrote:

Re: How to `eval` code with `def`?

2017-05-28 Thread Ben Finney
Steve D'Aprano writes: > #!/usr/bin/env python > # fileencoding=utf-8: > # vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 Even better, the source code encoding declaration for Python is compatible with a Vim text encoding declaration. So you can just do one: = #! /usr/bin/env py

Re: How to `eval` code with `def`?

2017-05-28 Thread Steve D'Aprano
On Mon, 29 May 2017 11:03 am, Peng Yu wrote: > Hi, > > I got the following error when I try to eval the following code with > def. Does anybody know what is the correct way to evaluation python > code that contains `def`? Thanks. > > $ cat ./main.py > #!/usr/bin/env python > # vim: set noexpandt

Re: How to `eval` code with `def`?

2017-05-28 Thread MRAB
On 2017-05-29 02:03, Peng Yu wrote: Hi, I got the following error when I try to eval the following code with def. Does anybody know what is the correct way to evaluation python code that contains `def`? Thanks. $ cat ./main.py #!/usr/bin/env python # vim: set noexpandtab tabstop=2 shiftwidth=2

Re: How to `eval` code with `def`?

2017-05-28 Thread Jon Ribbens
On 2017-05-29, Peng Yu wrote: > I got the following error when I try to eval the following code with > def. Does anybody know what is the correct way to evaluation python > code that contains `def`? Thanks. exec -- https://mail.python.org/mailman/listinfo/python-list

How to `eval` code with `def`?

2017-05-28 Thread Peng Yu
Hi, I got the following error when I try to eval the following code with def. Does anybody know what is the correct way to evaluation python code that contains `def`? Thanks. $ cat ./main.py #!/usr/bin/env python # vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8: im

Re: pip list --outdated gives all packages

2017-05-28 Thread Cem Karan
On May 27, 2017, at 11:10 AM, Cecil Westerhof wrote: > On Saturday 27 May 2017 16:34 CEST, Cem Karan wrote: > >> >> On May 27, 2017, at 7:15 AM, Cecil Westerhof wrote: >> >>> On Saturday 27 May 2017 12:33 CEST, Cecil Westerhof wrote: >>> I wrote a script to run as a cron job to check i

نتيجة الشهادة الابتدائية الترم الثاني 2017 جميع المحافظات - نتيجة الصف السادس الإبتدائي آخر العام

2017-05-28 Thread habybaahmed828
‘انا عاوز اعرف نتيجتي انا واخويه رفم جلوسي ورقم جلوس اخويه 41779.41752 -- https://mail.python.org/mailman/listinfo/python-list

Re: Dictionary order (Is it consistent up to py3.3 unless using -R or PYTHONHASHSEED is set)

2017-05-28 Thread Steve D'Aprano
On Mon, 29 May 2017 12:15 am, Jon Ribbens wrote: > On 2017-05-28, Steve D'Aprano wrote: >> What exactly did you think I got wrong? > > 3.6 does preserve the dict order. It isn't a guarantee so may change > in future versions, but it is what 3.6 actually does. Did I say it didn't? I said you ca

Re: Dictionary order (Is it consistent up to py3.3 unless using -R or PYTHONHASHSEED is set)

2017-05-28 Thread Ian Kelly
On May 28, 2017 8:23 AM, "Jon Ribbens" wrote: > On 2017-05-28, Steve D'Aprano wrote: >> What exactly did you think I got wrong? > > 3.6 does preserve the dict order. It isn't a guarantee so may change > in future versions, but it is what 3.6 actually does. No, it's what CPython 3.6 actually does

Re: Dictionary order (Is it consistent up to py3.3 unless using -R or PYTHONHASHSEED is set)

2017-05-28 Thread Jon Ribbens
On 2017-05-28, Steve D'Aprano wrote: > What exactly did you think I got wrong? 3.6 does preserve the dict order. It isn't a guarantee so may change in future versions, but it is what 3.6 actually does. >> If you're asking "given a fixed Python version, and where appropriate >> PYTHONHASHSEED=0,

Re: Dictionary order (Is it consistent up to py3.3 unless using -R or PYTHONHASHSEED is set)

2017-05-28 Thread Steve D'Aprano
On Sun, 28 May 2017 11:12 pm, Jon Ribbens wrote: > On 2017-05-28, Bill Deegan wrote: >> As a follow up to a discussion on IRC #python channel today. >> >> Assuming the same order of insertions of the same items to a dictionary >> would the iteration of a dictionary be the same (not as the order o

Re: Dictionary order (Is it consistent up to py3.3 unless using -R or PYTHONHASHSEED is set)

2017-05-28 Thread Jon Ribbens
On 2017-05-28, Bill Deegan wrote: > As a follow up to a discussion on IRC #python channel today. > > Assuming the same order of insertions of the same items to a dictionary > would the iteration of a dictionary be the same (not as the order of > insertion, just from run to run) for Python 2.7 up t