This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author stuarteberg
Recipients benjamin.peterson, cvk, stuarteberg
Date 2017-01-19.15:08:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484838488.69.0.267796428457.issue28837@psf.upfronthosting.co.za>
In-reply-to
Content
In addition to zip(), this problem also affects map() and filter().

The problem is that the match patterns in FixZip, FixMap, and FixFilter do not allow for more than one "trailer" node.  (And even if they did, their transform() methods aren't expecting it.)

For example, in the following expression, 'zip' is followed by two 'trailers', which are '(a,b)', and [0]:

zip(a,b)[0]

... but FixZip.PATTERN only expects a single trailer (the argument list), so the presence of a second trailer prevents the match: https://git.io/vMDP9


(Here's the relevant line of the grammar: https://git.io/vMDPJ)

I've written a patch that fixes this problem for zip, map, and filter, with tests.  See attached.

BTW, this problem was previously reported in 21628, but that issue was incorrectly closed as a duplicate, so I'm submitting my patch here.
History
Date User Action Args
2017-01-19 15:08:08stuartebergsetrecipients: + stuarteberg, benjamin.peterson, cvk
2017-01-19 15:08:08stuartebergsetmessageid: <1484838488.69.0.267796428457.issue28837@psf.upfronthosting.co.za>
2017-01-19 15:08:08stuarteberglinkissue28837 messages
2017-01-19 15:08:08stuartebergcreate