Twitter | Search | |
Raymond Hettinger
Python core developer. Freelance programmer/consultant/trainer. Husband to Rachel. Father to Matthew.
2,953
Tweets
365
Following
48,205
Followers
Tweets
Raymond Hettinger retweeted
Akash Apr 12
Python libraries that were used to generate Black hole image. astropy ephem future h5py html matplotlib networkx numpy pandas pyfits pynfft requests scipy skimage Full source code:
Reply Retweet Like
Raymond Hettinger Apr 17
The lazy evaluation of all() depends on its input being lazily evaluated. To get the effect you want, replace the list comprehension with a generator expression.
Reply Retweet Like
Raymond Hettinger Apr 17
Like many click-bait questions, this one has a premise that is presumptuous and uninformed. A more truth seeking approach would be to identify people who *you* consider to be high level programmers and ask them about the pros and cons of various languages.
Reply Retweet Like
Raymond Hettinger Apr 17
Replying to @vvcientificos
FWIW, that recipe is now in the standard library:
Reply Retweet Like
Raymond Hettinger Apr 17
Thanks for the shout out :-)
Reply Retweet Like
Raymond Hettinger Apr 17
Replying to @ramalhoorg
The decimal constructor attempts to preserve exactness. The string '1.1' exactly specifies the fraction 11 / 10. The float, 1.1, is a different binary fraction: >>> (1.1).as_integer_ratio() (2476979795053773, 2251799813685248) To understand why, see:
Reply Retweet Like
Raymond Hettinger Apr 6
How to do you usually write your tests?
Reply Retweet Like
Raymond Hettinger Apr 2
oddity: docstrings are stored in both the function object AND in the constants for the code object. When __doc__ is updated, the other is unchanged. def f(x): 'y' >>> f.__doc__ 'y' >>> f.__code__.co_consts[0] 'y' >>> f.__doc__ = 'z' >>> f.__code__.co_consts[0] 'y'
Reply Retweet Like
Raymond Hettinger Apr 1
Replying to @chhajedji
Reply Retweet Like
Raymond Hettinger Apr 1
Great news: Roman numeral literals! >>> 4 == IV True >>> XII + III == XV True
Reply Retweet Like
Raymond Hettinger Mar 30
Replying to @raymondh
s/you/your/
Reply Retweet Like
Raymond Hettinger Mar 30
statistics tip: QQ-plots give more insight than various hypothesis tests for goodness-of-fit: χ2, Student's t-test, Shapiro-Wilk, or KS. When you wonder whether you dataset is normally distributed, run QQ first :-)
Reply Retweet Like
Raymond Hettinger Mar 30
Replying to @noufalibrahim @pwang
Also, I got my first slide rule when I was about 10 and was mesmerized by it.
Reply Retweet Like
Raymond Hettinger Mar 30
Replying to @noufalibrahim @pwang
Book recommendations: * Flatland by Edwin Abbott * Symbolic Logic And The Game Of Logic by Lewis Carroll * Vehicles, experiments in synthetic psychology by Valentino Braitenberg * Laws of Form by G. Spencer-Brown
Reply Retweet Like
Raymond Hettinger Mar 30
Replying to @noufalibrahim @pwang
Games are a fertile ground for developing mathematical thinking. Write a program that computes all possible games of Connect 4. Simplify the table with symmetry. Develop heuristics for winning. When can you prove that you will win.
Reply Retweet Like
Raymond Hettinger Mar 30
Replying to @noufalibrahim @pwang
Constraint problems are useful for developing skill. Given 100 units of money, select the combination of foods that maximizes nutrition, taste, quantity, balance, or other utility function.
Reply Retweet Like
Raymond Hettinger Mar 30
Replying to @noufalibrahim @pwang
Also focus on patterns of thinking. Aristotle said the first step to understanding is to identify the essential difference between two things. How is red light different from blue light? Why does a hammer hitting metal sound harsh compared to a softer hit (i.e. square waves)?
Reply Retweet Like
Raymond Hettinger Mar 30
Replying to @noufalibrahim @pwang
Another topic: Probability. When the weather forecast indicates a 10% chance of rain, does it actually rain 10% of the time. How good are the forecasts.
Reply Retweet Like
Raymond Hettinger Mar 30
Replying to @noufalibrahim @pwang
Another topic: Isomorphisms. For example, how picking three numbers that sum to 15 is isomorphic to playing tic-tac-toe on a 3x3 magic square.
Reply Retweet Like
Raymond Hettinger Mar 30
Replying to @noufalibrahim @pwang
Another topic: Analyzing real world structures. Perhaps compare and contrast the branching patterns in Rosemary versus Dill plants.
Reply Retweet Like