15,926 reputation
3276
bio website demianbrecht.github.com
location
age 37
visits member for 4 years, 1 month
seen Apr 1 at 16:05

I've been spending over the last decade of my life building games.

I have a deeply seeded love of Python and the open source community as a whole.

Me elsewhere:


Mar
19
comment Preferred way to expand a command line script to be used as a library in Python
setuptools is the canonical packaging method for Python applications. After having used it myself, I much prefer it to loose files with if __name__ == '__main__' handlers. For example: github.com/Demonware/jose/blob/master/setup.py#L63, github.com/Demonware/jose/blob/master/jose.py#L540. The first link demonstrates the entry points in a library that I wrote and the second shows the implementation. Note that argument parsing is still entirely valid within the callable.
Mar
19
comment Aggregate documentation comments from multiple scripts into README?
In my experience, Sphinx tends to be much more commonly used and can pull docs from docstrings as well using the autodoc feature (sphinx-doc.org/ext/autodoc.html).
Mar
19
comment Does sending system-profile information with HTTP GET request conform to RESTful practices?
"If the framework is useful and this is the way it provides profile information to the backend, the REST police aren't going to break down your door." +1.
Mar
19
comment Best way to analyse a large class before refactoring it into smaller classes?
Interesting, why the downvote?
Mar
18
comment Write two versions of class with two different super classes without violating DRY?
+1 for LSP, composition rather than inheritance.
Mar
18
comment Best way to analyse a large class before refactoring it into smaller classes?
@sydan: Are you able to mock the interaction with other classes? I know this is easier in some languages than others. If that's a no-go, perhaps system tests to get started?
Mar
18
comment Does sending system-profile information with HTTP GET request conform to RESTful practices?
@MikePartridge: Derp, typo. It's RFC 7231. Thanks for the catch.
Jul
24
comment Opposite term of indent
@RobvanderVeer: This conversation moved on nearly two years ago ;)
Mar
22
comment Python code style - blank lines in long list
@Izkata: Code should be self-documenting. In grouping them, it's more obvious from a code standpoint. You can also reorder trivially now (not that you'd need to in this particular context) based on reference rather than cut/pasting blocks of code. /Also/, if the accelerator list becomes long, segregating them /absolutely/ increases readability.
Mar
22
comment Python code style - blank lines in long list
@Izkata: How, exactly, is segregating various accelerators into logical groups increasing readability and increasing complexity?! Sure, using chain rather than simple concat is more complex, but I've stated reasons for doing so above (preferring + when called for).
Mar
22
comment Python code style - blank lines in long list
See my update. I wasn't thinking overly clearly when I originally answered.
Mar
22
comment Python code style - blank lines in long list
Would love to know the reason for the downvote :P
Mar
22
comment Python code style - blank lines in long list
No reason in particular as they achieve the same result. Using chain, you could do something like accelerators = [accel_file, accel_project, ...] and then feed it into chain(*accelerators). But yes, if you're not doing something like that, then simple concat using + would be the way to go (I was working with chain when I wrote the above ;))
Mar
22
comment Python code style - blank lines in long list
@ChrisKrycho: See edit. Really, it's just personal preference, but this makes the intention of each portion of your list easier to grok. It's /clear/ what is intended to go where (and therefore increases readability).
Mar
22
comment Python code style - blank lines in long list
@ChrisKrycho: Ah, in my un-caffeinated state, I didn't see fully what was going on. Rather than using a class, I'd still set a local reference to each logical block and then chain them to create the list being fed into AcceleratorTable.
Mar
19
comment Can PHP and Javascript do backend together?
node can run a pure tcp server just as easily as a web server. for all we know, the OP was interested in using a services architecture where the PHP portion simply communicated with a service backend written in node. in that case, you wouldn't need two web servers. also, unless i'm mistaken, i'm not aware of a node-based php interpreter.
Oct
11
comment Black Hat Hackers vs Programmers?
@MattRidge: Absolutely. However, my intent with sharing the link (other than it's one of my favorite nostalgic readings) was to suggest that you should accept black hat hackers as a way of life because it's never going to go away. I'm also not quite sure how standing on shoulders of giants is a bad thing.. We are all doing that.. Programmers and hackers alike.
Oct
11
comment Black Hat Hackers vs Programmers?
To point 4: mithral.com/~beberg/manifesto.html. Not much more needs to be said ;)
Oct
10
comment Multithreading synchronization interview question: Find n words given m threads
@RobertHarvey: Sometimes people ask the wrong questions. The OP has a poor mindset to tackle technical interviews and this answer was an attempt to help put him/her on the right track.
Oct
9
comment What are graphs in laymen's terms
I'd actually extend that example to note that all entities described in your example could be depicted as vertices in a graph (city, plane, magazine, map, etc), the map itself just being a single vertex.