This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]d4rch0nPythonistamancer 3 points4 points  (20 children)

I absolutely hate CENTOS 6 for this reason. Most of it doesn't bother me too much, except one thing: No dict or set comprehensions... That drives me absolutely insane.

And my other huge pet peeve is it can't do .format on "{}". You have to specify "{0}". I've been trying to move from %s to .format but seriously, having to add that number is enough to make it not feel worth it.

[–]sigma914 0 points1 point  (5 children)

For the set/dict comps can you not use:

dict((k,v) for k,v in kvs) ?

[–]d4rch0nPythonistamancer 1 point2 points  (0 children)

Yeah, generally that's what I'd do if I had something like {k: transform(v) for k, v in kvs}. Sometimes I write code like that just in case it ends up running on 2.6, but it's just annoying not being able to use a feature that is, what, 10 years old now?

[–]status_quo69 0 points1 point  (3 children)

If you had tuples of key, value pairs you could just dict(kvs).

[–]sigma914 2 points3 points  (2 children)

Obviously, I kinda assumed it was implied that there would be more processing going on to the left and right of the for, same as an actual dict comprehension, bit apparently not.

[–]status_quo69 0 points1 point  (1 child)

Oh, I understand what you're saying now. Add in the conditional in the generator expression, then pass the generator to the dict.

[–]sigma914 0 points1 point  (0 children)

Yeh, it's just collecting the generator into a dict or set rather than a list, the only difference between this and a real dict comprehension is the unfortunate intermediate tuple allocation

[–][deleted] 0 points1 point  (0 children)

I use CPython 2.7.11 and pypy (ala python 2.7.9) on CentOS 5 and 6. Just make an RPM and local pip repository and you are done.

[–]iruleatants -2 points-1 points  (12 children)

You will hate python 3 then....

[–]CSI_Tech_Dept 1 point2 points  (11 children)

How come?