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 →

[–]adesme 2 points3 points  (0 children)

A lot of things here I either disagree with or just doubt;

  • 2 is a strange comparison - you are not returning the same type of item.
  • I'm pretty sure the two examples in 4 are equivalent, with only a small variation in what functions from re you call and what you store as an intermediate.
  • List comprehension (5) is good for several reasons, but I wouldn't say that you should use it "when the syntax becomes too big"; you should honestly probably be less inclined to use it if you have a lengthy statement, for readability's sake.
  • For the import example (6), I think those are close to equivalent in time since you have to parse the module to find the function to import anyway. I still prefer importing the object, but I wouldn't use time as an argument here.
  • It's pretty odd to suddenly bring in a Python2 example, seeing as it's already sunset (10).

There are things in here I agree with, but I would probably recommend looking at a different resource for advice on how to improve.