EvilPythonTips's profile picture. Parody account run by @mgedmin

Evil Python Tips

@EvilPythonTips

Parody account run by @mgedmin

Evil Python Tips 已轉發

# Sometimes braces work in Python 3 # (don't actually do this) if (True):{ print("do a thing") } else:{ print("do another thing") }


assert (condition, message) lets you wrap the assertion over two lines without using those ugly backslashes!


Have your custom __repr__ return an empty string sometimes. AssertionError: [] != [] will keep developers on their toes!


+ is the most positive unary operator in #positivepython


self.globs = self.__dict__ lets you re-use a doctest setUp() function in a unittest.TestCase.


Use metaclasses as much as you can.


Always use 'from foo import *'. Saves typing.


此帳戶目前尚未追蹤任何人
Loading...

Something went wrong.


Something went wrong.