> On Feb 2, 2017, at 2:17 AM, Anders Munch wrote:
>
> Give Python 2 a little more credit.
We are, it told you what your issue was: yield outside a function. Consider:
>>> def f():
... l = [(yield 1) for x in range(10)]
... print(l)
>>> gen = f()
>>> for i in
Craig Rodrigues :
> Make this return a list on Python 3, like in Python 2: [(yield 1) for x in
> range(10)]
Give Python 2 a little more credit.
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or
On 30 January 2017 at 19:05, Brett Cannon wrote:
> On Sun, 29 Jan 2017 at 16:39 Craig Rodrigues wrote:
>> I'm OK with either approach. Leaving things the way they are in Python 3
>> is no good, IMHO.
>
> My vote is it be a SyntaxError since you're not
On Sun, 29 Jan 2017 at 16:39 Craig Rodrigues wrote:
> On Thu, Jan 26, 2017 at 4:09 AM, Ivan Levkivskyi
> wrote:
>
>
>
> Concerning list/set/dict comprehensions, I am much more in favor of making
> comprehensions simply equivalent to for-loops (more or
On Thu, Jan 26, 2017 at 4:09 AM, Ivan Levkivskyi
wrote:
>
>
> Concerning list/set/dict comprehensions, I am much more in favor of making
> comprehensions simply equivalent to for-loops (more or less like you
> proposed using yield from). The only reason to introduce
On 26 January 2017 at 00:53, Nathaniel Smith wrote:
>
> I'm not sure this is actually a good idea, given the potential for
> ambiguity and backwards compatibility considerations -- I'm kind of leaning
> towards the deprecate/error option on balance :-). But it's an option that
>
On Jan 25, 2017 8:16 AM, "Joe Jevnik" wrote:
List, set, and dict comprehensions compile like:
# input
result = [expression for lhs in iterator_expression]
# output
def comprehension(iterator):
out = []
for lhs in iterator:
out.append(expression)
On Wed, Jan 25, 2017 at 6:28 AM, Joe Jevnik wrote:
> That was a long way to explain what the problem was. I think that that
> solution is to stop using `yield` in comprehensions because it is
> confusing, or to make `yield` in a comprehension a syntax error.
>
> Thanks
On 25.01.2017 07:28, Joe Jevnik wrote:
That was a long way to explain what the problem was. I think that that
solution is to stop using `yield` in comprehensions because it is
confusing, or to make `yield` in a comprehension a syntax error.
Same here; mixing comprehensions and yield
List, set, and dict comprehensions compile like:
# input
result = [expression for lhs in iterator_expression]
# output
def comprehension(iterator):
out = []
for lhs in iterator:
out.append(expression)
return out
result = comprehension(iter(iterator_expression))
When you
On 25 January 2017 at 07:01, Chris Angelico wrote:
> >>> [(yield 1) for x in range(10)]
> > at 0x10cd210f8>
>
This is an old bug, see e.g. http://bugs.python.org/issue10544
The ``yield`` inside comprehensions is bound to the auxiliary function.
Instead it should be bound to
On Wed, Jan 25, 2017 at 4:38 PM, Craig Rodrigues wrote:
>
> Glyph pointed this out to me here:
> http://twistedmatrix.com/pipermail/twisted-python/2017-January/031106.html
>
> If I do this on Python 3.6:
>
>>> [(yield 1) for x in range(10)]
> at 0x10cd210f8>
>
> If I
Hi,
Glyph pointed this out to me here:
http://twistedmatrix.com/pipermail/twisted-python/2017-January/031106.html
If I do this on Python 3.6:
>> [(yield 1) for x in range(10)]
at 0x10cd210f8>
If I understand this:
https://docs.python.org/3/reference/expressions.html#list-displays
then this
13 matches
Mail list logo