[Python-Dev] Documenting enum types

2014-08-13 Thread Serhiy Storchaka
Should new enum types added recently to collect module constants be documented at all? For example AddressFamily is absent in socket.__all__ [1]. [1] http://bugs.python.org/issue20689 ___ Python-Dev mailing list Python-Dev@python.org https://mail.pyt

Re: [Python-Dev] sum(...) limitation

2014-08-13 Thread Chris Barker
On Tue, Aug 12, 2014 at 11:21 PM, Stephen J. Turnbull wrote: > Redirecting to python-ideas, so trimming less than I might. reasonable enough -- you are introducing some more significant ideas for changes. I've said all I have to say about this -- I don't seem to see anything encouraging form c

Re: [Python-Dev] Reviving restricted mode?

2014-08-13 Thread Victor Stinner
Hi, I heard that PyPy sandbox cannot be used out of the box. You have to write a policy to allow syscalls. The complexity is moved to this policy which is very hard to write, especially if you only use whitelists. Correct me if I'm wrong. To be honest, I never take a look at this sandbox. Victor

Re: [Python-Dev] Reviving restricted mode?

2014-08-13 Thread Terry Reedy
On 8/13/2014 12:19 PM, matsjoyce wrote: Unless you remove all the things labelled "keep away from children". I wrote this sandbox to allow python to be used as a "mods"/"add-ons" language for a game I'm writing, hence the perhaps too strict nature. About the crashers: as this is for games, its "

Re: [Python-Dev] Multiline with statement line continuation

2014-08-13 Thread Steven D'Aprano
On Wed, Aug 13, 2014 at 08:08:51PM +0300, yoav glazner wrote: [...] > Just a thought, would it bit wierd that: > with (a as b, c as d): "works" > with (a, c): "boom" > with(a as b, c): ? If this proposal is accepted, there is no need for the "boom". The syntax should allow: # Without parens, lim

Re: [Python-Dev] Reviving restricted mode?

2014-08-13 Thread Isaac Morland
On Thu, 14 Aug 2014, Steven D'Aprano wrote: On Thu, Aug 14, 2014 at 02:26:29AM +1000, Chris Angelico wrote: On Wed, Aug 13, 2014 at 11:11 PM, Isaac Morland wrote: While I would not claim a Python sandbox is utterly impossible, I'm suspicious that the whole "consenting adults" approach in Pyth

Re: [Python-Dev] Multiline with statement line continuation

2014-08-13 Thread yoav glazner
On Aug 13, 2014 7:04 PM, "Akira Li" <4kir4...@gmail.com> wrote: > > Nick Coghlan writes: > > > On 12 August 2014 22:15, Steven D'Aprano wrote: > >> Compare the natural way of writing this: > >> > >> with open("spam") as spam, open("eggs", "w") as eggs, frobulate("cheese") as cheese: > >> # do

Re: [Python-Dev] Reviving restricted mode?

2014-08-13 Thread Chris Angelico
On Thu, Aug 14, 2014 at 2:58 AM, Steven D'Aprano wrote: >> It's certainly not *fundamentally* impossible to sandbox Python. >> However, the question becomes one of how much effort you're going to >> go to and how much you're going to restrict the code. > > I believe that PyPy has an effective sand

Re: [Python-Dev] Reviving restricted mode?

2014-08-13 Thread Steven D'Aprano
On Thu, Aug 14, 2014 at 02:26:29AM +1000, Chris Angelico wrote: > On Wed, Aug 13, 2014 at 11:11 PM, Isaac Morland wrote: > > While I would not claim a Python sandbox is utterly impossible, I'm > > suspicious that the whole "consenting adults" approach in Python is > > incompatible with a sandbox.

Re: [Python-Dev] sum(...) limitation

2014-08-13 Thread Ronald Oussoren
On 12 Aug 2014, at 10:02, Armin Rigo wrote: > Hi all, > > The core of the matter is that if we repeatedly __add__ strings from a > long list, we get O(n**2) behavior. For one point of view, the > reason is that the additions proceed in left-to-right order. Indeed, > sum() could proceed in a m

Re: [Python-Dev] Reviving restricted mode?

2014-08-13 Thread matsjoyce
Unless you remove all the things labelled "keep away from children". I wrote this sandbox to allow python to be used as a "mods"/"add-ons" language for a game I'm writing, hence the perhaps too strict nature. About the crashers: as this is for games, its "fine" for the game to crash, as long as th

Re: [Python-Dev] Reviving restricted mode?

2014-08-13 Thread Chris Angelico
On Wed, Aug 13, 2014 at 11:11 PM, Isaac Morland wrote: > While I would not claim a Python sandbox is utterly impossible, I'm > suspicious that the whole "consenting adults" approach in Python is > incompatible with a sandbox. The whole idea of a sandbox is to absolutely > prevent people from doin

Re: [Python-Dev] Reviving restricted mode?

2014-08-13 Thread matsjoyce
Unless you remove all the things labelled "keep away from children". I wrote this sandbox to allow python to be used as a "mods"/"add-ons" language for a game I'm writing, hence the perhaps too strict nature. About the crashers: as this is for games, its "fine" for the game to crash, as long as

Re: [Python-Dev] Multiline with statement line continuation

2014-08-13 Thread Akira Li
Nick Coghlan writes: > On 12 August 2014 22:15, Steven D'Aprano wrote: >> Compare the natural way of writing this: >> >> with open("spam") as spam, open("eggs", "w") as eggs, frobulate("cheese") as >> cheese: >> # do stuff with spam, eggs, cheese >> >> versus the dynamic way: >> >> with Exi

Re: [Python-Dev] Reviving restricted mode?

2014-08-13 Thread Isaac Morland
On Mon, 11 Aug 2014, Skip Montanaro wrote: On Mon, Aug 11, 2014 at 12:42 PM, matsjoyce wrote: There maybe some holes in my approach, but I can't find them. There's the rub. Given time, I suspect someone will discover a hole or two. Schneier's Law: Any person can invent a security

Re: [Python-Dev] Multiline with statement line continuation

2014-08-13 Thread Nick Coghlan
On 12 August 2014 22:15, Steven D'Aprano wrote: > Compare the natural way of writing this: > > with open("spam") as spam, open("eggs", "w") as eggs, frobulate("cheese") as > cheese: > # do stuff with spam, eggs, cheese > > versus the dynamic way: > > with ExitStack() as stack: > spam, egg