Hacker News new | ask | show | jobs
by NateDad 4498 days ago
This is almost always a bad idea. I've extracted many a python line into 2-4 lines to make it a hell of a lot more clear. Packing logic into a line is not a good thing. It may be fun and a challenge, but it makes for fragile code that is easy to get wrong and/or misunderstand.
1 comments

I often use list comprehensions where I would have previously used a for loop. It means you have less variables and are less likely to have side effects. I wouldn't say it is always a bad idea.