5,109 karma · joined Jun 27, 2012 (14y ago) · 1,639 submissions
comment 12y ago · link · parent
if name != '' and len(pets) > 0 and owners != {}
would tell you that name is a non-empty string, pets has values, and owners is a non-empty dict (except it doesn't work, as pdonis noticed).But Python allows immoral implicit conversions, so that's not what that line means! If name is a function, pets is the value '7' and owners is a list, the test passes.
if name and pets and owners
Would pass as well, but it has the advantage of not implying it does more than it does: all you can infer from the test passing is that none of name,pets,owners are special falsy values.If you actually wanted to test what the longer line is implying, you'd write something like
if isinstance(name, str) and isinstance(pets, list) and isinstance(owners, set) and name and pets and owners
(don't do this, it violates duck-typing and LBYL)comment 12y ago · link · parent
By 1981 I'm sure there were people still grousing about the good old days but it would have been the equivalent of complaining about e-mail and the death of the handwritten letter in the 2010s (and I'm sure NPR has done more than one story about that in this decade because that's their shtick).
The Walkman was revolutionary because it was a portable cassette deck, the first true plays-anywhere format that allowed someone to completely divorce themselves from radio music without any compromises.
comment 12y ago · link · parent
The series of decisions that results in me calling someone is so radically different than the one that results in IMing them that I'd never find it useful to start with a person and then decide to IM or call.
I'm about as often in the task-oriented position of thinking "I should call someone" or "I wonder who's awake on jabber" as the person-oriented position anyway.
tl;dr: The medium is the message
comment 12y ago · link · parent
I can get driven to work by a nice guy in a clean car for $11 instead of a surly driver in a grotty $25 taxi (who probably has a great work ethic), because the UberX driver is trying to support his unjob lifestyle instead of being good at being an employee.
comment 12y ago · link · parent
I'll admit that my post was more a general reaction to Prof. Murphy's chronic abuse of statistical modelling, visible in the post you linked to "The Real Population Problem" where he applies a rather incoherent statistical model ("Population growth is exponential, but the exponential rate keeps changing", which is another way of saying "Population growth is not exponential"), while ignoring the real story on population, flat or slightly declining total births per year.... and his even more baffling and famous post, http://physics.ucsd.edu/do-the-math/2012/04/economist-meets-... where he plops down a tight exponential fit that clearly applies to the 'Industrial Manufacturing' era and visibly and extremely fails to model after that (it's a log plot, that post-1970-ish curve indicates a massive, model-falsifying difference between model and observation).
Economic modelling is hard enough for the world we live in, a world where we're mining 0.02% Uranium from the ground instead of 10+% is so unlike anything we know that making predictions about it is hubris.
I generally don't find peakery interesting because I don't accept the fundamental premise (that you can model future resource availability at all using historical consumption volumes), so I'm not even at the point where more production (=consumption) data, however well sourced, is compelling.
comment 12y ago · link · parent
The comparison with Nestle would only be reasonable if a Windows 95 BSOD killed one of your children.
comment 12y ago · link · parent
Both point to an obvious counter-theory: That industrialization was a centuries-long process, involving exploding populations and energy consumption, that in much of the world has come to an end. The nice little exponential lines are overfit to a particular span of human history and stopped being predictive somewhere in the 20th century.
Also, most of those peaked resources are not even vaguely scarce. I'm not even sure what it would mean to run out of iron ore or bauxite -- a large fraction of the Earth's crust is iron- and aluminum-bearing rock, and the definition of "ore" is "the particular chunks of rock and dirt that are economically viable to extract metal from". Production peaked because of limited demand and lowered shipping costs that made foreign supplies cheaper.
comment 12y ago · link · parent
Hopefully, we feed the people now so that starving to death isn't their top worry, and societies with food security are more stable societies that can make improvements in other ways (on their own, or with help) which eventually lead to prosperity and independence.
Manhattan has more population than the land can support--the Manhattanites are entirely dependent on delivered food to survive, and have been for many generations. It's hopefully a permanent situation. Nobody worries about it because they've reached a place of development where they can just buy the food shipments instead of getting charity.
comment 12y ago · link · parent
The issue is, outside of languages with very baroque type systems or monstrosities like Java's sandbox, static typing often winds up decaying into weak typing, which offer much weaker behavior guarantees than real-world dynamic languages.
comment 12y ago · link · parent
The racial distribution of the US is neither an accident or the result of voluntary actions by individuals.
comment 12y ago · link · parent
Writing clear code is the only hope for the poor maintenance programmer, your carefully written comments probably aren't worth the effort.