Files
2012-02-21 01:15:00 -05:00

1 line
2.7 KiB
JSON

[{"user_id": 18539, "stars": [], "topic_id": 14937, "date_created": 1300966944.3533001, "message": "I notice myself doing this a lot. Practical example from today, when I'm hacking on #python's new IRC bot: from twisted.words.protocols import irc as twirc (or maybe twpirc). This is to differentiate it from other modules called IRC, while still being short. I guess it may be an antipattern because, well, acronymic names usually are :)", "group_id": 292, "id": 425719}, {"user_id": 7129, "stars": [], "topic_id": 14937, "date_created": 1300967771.9991241, "message": "Antipattern. I generally don't like it as you are namespacing stuff manually when Python can already do that for you, and it makes it more difficult to remember what stuff is at a glance. (\"Hey what's twirc.. oh yeah it's Twisted's version\")", "group_id": 292, "id": 425774}, {"user_id": 7129, "stars": [], "topic_id": 14937, "date_created": 1300967804.3743169, "message": "(Of course, \"as\" imports can be pretty handy in edge cases.)", "group_id": 292, "id": 425777}, {"user_id": 7129, "stars": [], "topic_id": 14937, "date_created": 1300967774.8627989, "message": "In Twisted it's very very common to do (eg.) \"from twisted.words import protocols\" and then just use protocols.irc.", "group_id": 292, "id": 425775}, {"user_id": 927, "stars": [{"date_created": 1300988783.0695331, "user_id": 141}], "topic_id": 14937, "date_created": 1300973201.403686, "message": "Minor anti-pattern but reasonable when things should be interchangeable (e.g. import simplejson as json)", "group_id": 292, "id": 426547}, {"user_id": 24439, "stars": [{"date_created": 1300988794.9645181, "user_id": 141}, {"date_created": 1301833229.681514, "user_id": 2313}], "topic_id": 14937, "date_created": 1300974171.4522231, "message": "I don't like importing modules at all, when I can avoid it. In other words, I write \"from package.subpackage.module import Stuff, That, IWant\".", "group_id": 292, "id": 426671}, {"user_id": 14874, "stars": [], "topic_id": 14937, "date_created": 1301171665.642287, "message": "I'll use 'as' for things like: from foo.bar import config as bar_config", "group_id": 292, "id": 447511}, {"user_id": 14874, "stars": [], "topic_id": 14937, "date_created": 1301171609.437289, "message": "I'm opposite of @mithrandi. When reading new code, seeing pkg.sub.foo() makes it immediately clear where the function came from and probably what it's related to. I suppose this opens the door for an IDE war. Let's not.", "group_id": 292, "id": 447505}, {"user_id": 10411, "stars": [], "topic_id": 14937, "date_created": 1301181248.534951, "message": "Pattern: allows you flatten the namespace hierarchy but still retain the information about where the name came from. (Also useful in the shell.)", "group_id": 292, "id": 448380}]