[issue16094] Tuple extraction in a lambda isn't supported by 2to3

2020-10-23 Thread Dong-hee Na


Change by Dong-hee Na :


--
resolution:  -> wont fix
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16094] Tuple extraction in a lambda isn't supported by 2to3

2020-10-22 Thread Irit Katriel


Irit Katriel  added the comment:

Updating the versions, but from the discussion I think this can probably be 
closed as "won't fix".

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.2, Python 
3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16094] Tuple extraction in a lambda isn't supported by 2to3

2012-10-02 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Not pretty :-)

IMO, we're better off leaving 2-to-3 without an automated conversion for this 
and people will just have to stop using the feature in their 2.7 code.

We could add a -3 warning in Py2.7 to flag code that needs to be changed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16094] Tuple extraction in a lambda isn't supported by 2to3

2012-10-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

f = lambda t, c, *, _f=(lambda a, b, c: a + b + c): _f(*(unpack_tuple(2, t) + 
(c,)))

def unpack_tuple(n, t):
t = tuple(t)
if len(t) > n:
raise ValueError('too many values to unpack (expected %d)' % (n,))
if len(t) < n:
raise ValueError('need more than %d values to unpack' % (len(t),))
return t

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16094] Tuple extraction in a lambda isn't supported by 2to3

2012-10-01 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I'm not sure a semantically neutral automatic fix is possible:

   f = lambda (a, b), c: a + b + c # Py2.x

   f = lambda t, c: t[0] + t[1] + c# Py3.x


The former will unpack any iterable, not just sequences:

>>> def g():
yield 'a'
yield 'b'   
>>> f(g(), 'c')
'abc'

Also, the former will validate the number of arguments:

>>> f((1,2,3), 4)

Traceback (most recent call last):
  File "", line 1, in 
f((1,2,3), 4)
  File "", line 1, in 
f = lambda (a, b), c: a + b + c
ValueError: too many values to unpack

I don't see a way to automatically include those capabilities in an automatic 
2-to-3 transformation.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16094] Tuple extraction in a lambda isn't supported by 2to3

2012-09-30 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16094] Tuple extraction in a lambda isn't supported by 2to3

2012-09-30 Thread Brett Cannon

Changes by Brett Cannon :


--
title: Tuple extraction in lambda isn't supported with more than one argument 
-> Tuple extraction in a lambda isn't supported by 2to3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com