[Python-Dev] Any updates on this subprocess/signal bug/issue (Re: subprocess and EINTR errnos)

2009-07-06 Thread Hatem Nassrat
On Wed, 17 Nov 2004, Peter Astrand wrote,
> I've made a patch (attached) to subprocess.py (and test_subprocess.py)
> that should guard against EINTR, but I haven't committed it yet. It's
> quite large.
> 
> Are Python modules supposed to handle EINTR? Why not let the C code handle
> this? Or, perhaps the signal module should provide a sigaction function,
> so that users can use SA_RESTART.

This is a snippet from a email sent in 2004, I was wondering if there
was any update on this issue. Are these issues supposed to be handled on
a per application basis, or will a fix go into Python in the near
future?

-- 
Hatem Nassrat

Refrences: 

http://mail.python.org/pipermail/python-dev/2004-November/049983.html
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Any updates on this subprocess/signal bug/issue (Re: subprocess and EINTR errnos)

2009-07-06 Thread Hatem Nassrat
On Wed, 17 Nov 2004, Peter Astrand wrote,
> I've made a patch (attached) to subprocess.py (and test_subprocess.py)
> that should guard against EINTR, but I haven't committed it yet. It's
> quite large.
> 
> Are Python modules supposed to handle EINTR? Why not let the C code handle
> this? Or, perhaps the signal module should provide a sigaction function,
> so that users can use SA_RESTART.

This is a snippet from a email sent in 2004, I was wondering if there
was any update on this issue. Are these issues supposed to be handled on
a per application basis, or will a fix go into Python in the near
future?

-- 
Hatem Nassrat

Refrences: 

http://mail.python.org/pipermail/python-dev/2004-November/049983.html
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Announcing PEP 3136

2009-09-29 Thread Hatem Nassrat
Tue Jul 3 10:14:17 CEST 2007, Guido van Rossum wrote:
> On 6/30/07, Matt Chisholm  wrote:
> > I've created and submitted a new PEP proposing support for labels in
> > Python's break and continue statements.  Georg Brandl has graciously
> > added it to the PEP list as PEP 3136:
> >
> > http://www.python.org/dev/peps/pep-3136/
> 
> I think this is a good summary of various proposals that have been
> floated in the past, plus some new ones. As a PEP, it falls short
> because it doesn't pick a solution but merely offers a large menu of
> possible options. Also, there is nothing about implementation yet.
> 
> However, I'm rejecting it on the basis that code so complicated to
> require this feature is very rare. In most cases there are existing
> work-arounds that produce clean code, for example using 'return'.

I agree that this feature will only serve as a quick hack and in many
cases it would be misused and ugly code will be the result. However,
it seems that there are some shortcuts that have sneaked into python
(I am a fairly new Python programmer, only since late 2.4, so don't
shoot me). The specific one of which I speak about is:

while_stmt ::=  "while" expression ":" suite
["else" ":" suite]

for_stmt ::=  "for" target_list "in" expression_list ":" suite
  ["else" ":" suite]

try1_stmt ::=  "try" ":" suite
   ("except" [expression ["as" target]] ":" suite)+
   ["else" ":" suite]
   ["finally" ":" suite]

All these else's seem like shortcuts to me. I did find a use for them,
once I found out they existed, but I get butterflies whenever I do.

-- 
Hatem Nassrat
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Closures / Python Scopes

2010-11-12 Thread Hatem Nassrat
A colleague of mine came across something anecdotal when working with
lambdas, it is expressed by the following code snippet.

  In [1]: def a():
 ...: for i in range(10):
 ...: def b():
 ...: return i
 ...: yield b
 ...:
 ...:

  In [2]: funcs = list(a())

  In [3]: print [f() for f in funcs]
  [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]


I understand that for loops in python do not have a scope, neither do
if statements, and python is awesome for that. Is this something
accidental? i.e. will python ever evolve into having scopes for if and
for loops (and other blocks that are not functions)? the reason I ask
is with the introduction of
http://docs.python.org/py3k/reference/simple_stmts.html#nonlocal it
seems like something that can happen.

--
Hatem Nassrat
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com