Learning python networking

Dan Stromberg drsalists at gmail.com
Wed Jan 8 22:49:40 EST 2014


On Wed, Jan 8, 2014 at 4:07 PM, Chris Angelico <rosuav at gmail.com> wrote:
> Maybe it's not the best way to do things, but it can be extremely
> simple in the code.

For small projects, the added complexity doesn't bite you.  At least, not much.

For large projects, with thousands or millions of callbacks, it can be
very difficult to track down bugs in who-knows-which callback, given
that they're all being called asynchronously.  It's vastly simpler to
fire up a debugger against a process, or insert print statements that
are related to each other in time in some way.

> It's
> really easy once you get your head around it.

IMO, it's not a matter of wrapping your head around it, but respecting
complexity.

Three quotes come to mind:
* Make things as simple as possible, but not simpler.
* Fools ignore complexity. Pragmatists suffer it. Some can avoid it.
Geniuses remove it.
* Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.

I'm not trying to call you or anyone else a fool, but the Alan Perlis
quote (the second) does give a flavor of what I'm trying to say.

The third quote, from Brian Kernighan, seems to underestimate the
complexity of asynchronous programming in the large - it's probably
not just twice as hard.



More information about the Python-list mailing list