Tagged Questions
5
votes
1answer
321 views
Is using '{}' within format strings considered Pythonic?
I just learned you can write
'{}{}'.format(string_a, string_b)
instead of
'{0}{1}'.format(string_a, string_b)
in Python, i.e. you can omit the numerals for the string format parameters when you ...
4
votes
1answer
352 views
Pythonic use of the isinstance function?
Whenever I find myself wanting to use the isinstance() function I usually know that I'm doing something wrong and end up changing my ways. However, in this case I think I have a valid use for it. I ...
12
votes
2answers
2k views
What's wrong with relative imports in Python?
I recently upgraded versions of pylint, a popular Python style-checker.
It has gone ballistic throughout my code, pointing out places where I import modules in the same package, without specifying ...
28
votes
8answers
3k views
How can I learn to effectively write Pythonic code?
Doing a google search for "pythonic" reveals a wide range of interpretations. The wikipedia page says:
A common neologism in the Python community is pythonic, which can have a wide range of ...