redbaron icon indicating copy to clipboard operation
redbaron copied to clipboard

List contractions with multiple for statements and comma separation don't work

Open kayhayen opened this issue 11 years ago • 7 comments

Hello,

this crashes RedBaron:

[1 for d in e, f for g in h ]

Removing the ",f" seems to make it work as do braces around "e, f", but they are not required by the language.

Enjoy the riddle, Kay

kayhayen avatar Nov 28 '14 23:11 kayhayen

Confirmed, this one is a RedBaron specific bug, not a Baron bug.

Psycojoker avatar Nov 29 '14 13:11 Psycojoker

Hello,

installing redbaron from PyPI the released version doesn't cover previous fixes, I think I did test installations before. It seems as if redbaron is no longer actively maintained. Can you confirm this, and if it's the case, recommend a replacement.

Yours, Kay

kayhayen avatar Dec 08 '15 09:12 kayhayen

Ah, I just raised an issue, and was not aware that the tiny change would cause it. Seems released version is still good enough me. However this issue and others still exist. I am curious if development has a chance to continue.

kayhayen avatar Dec 08 '15 17:12 kayhayen

Hello,

In regard of development, it's still more or less there but it's very far away from the level I had previously for two reason:

  • life events pushed me away from it (read: quite very hard burnout) and my life didn't waited for me to restore from filling itself
  • I'm blocked on an advanced refactoring of the internal behavior of the merging algorithm of the proxy list. It's hard, ungrateful and I need to find both motivation and time to pass the last broken tests (which are especially boring and hard) and once it's done, my plan is to move in direction of a 1.0 (there is still quite a lot of work for that) which will include fixing bugs like this one.

But the project is not abandoned and I've actually found someone to help me on the theoretical research part of it.

You can follow my work here if you are curious https://github.com/Psycojoker/redbaron/tree/refactor_proxy_list_algo

Psycojoker avatar Dec 13 '15 15:12 Psycojoker

Note that that syntax is only valid in python2:

img-2016-12-23-221520

img-2016-12-23-221556

Using surround parenthesis works for all versions:

[1 for d in (e, f) for g in h]

I'll of course still provide a fix though.

ibizaman avatar Dec 24 '16 06:12 ibizaman

Wow, even weirder, the parenthesis-less syntax does not work in python2 with generators and set comprehensions:

img-2016-12-23-225814

img-2016-12-23-230144

ibizaman avatar Dec 24 '16 06:12 ibizaman

Looks like it's a baron bug in fact, see PyCQA/baron#94

ibizaman avatar Dec 24 '16 07:12 ibizaman