A quick post on a fun trend we saw on Twitter this morning: people posting how long they coded for and what they still had to lookup. Some of this is tongue in cheek of course, but the point is that programming is not easy. Secondly there is no shame in looking things up, we all do it! What do fellow Pythonistas say?
It seems to have started here:
Hello, my name is Tim. I’m a lead at Google with over 30 years coding experience and I need to look up how to get length of a python string. tweet
Or maybe even here:
Hello, my name is David. I would fail to write bubble sort on a whiteboard. I look code up on the internet all the time. I don’t do riddles. tweet
StackOverflow to the rescue, as Pythonista Luciano Ramalho tweets:
Hi, my name is Luciano, I’ve been coding for almost 40 years now, and I believe StackOverflow is the best thing since array bounds checking. tweet
Pythonistas
Some fun examples here (Python bloggers, take note …).
We definitely have been here:
CSV files cannot be written without Google:
… I still google to read/write csv files.
Logging (setup) is hard!
… I still copy paste from the logging cookbook. #python
What was the difference again between json dump and load? And when to add the extra -s?!
… I’ve been using Python for more than 4 years and still forget the difference between json dump(s) and load(s)
Negative slicing, maybe not so clear to the next maintainer of your code:
… I’ve been doing Python for a few years now. I have to check the docs when I need list slicing with negative indexes.
Luckily we have the REPL, just type python + enter, and play:
… using Python since 2001. I still keep many tabs of stdlib docs open, and check often in a REPL as a normal worflow.
True, writing a book or blog you still have to look up stuff:
… I wrote a widely read book about Intermediate Python and I still have to use Stackoverflow and Google while coding.
Yep, we looked this one up too last week:
… I always confuse .sort() with sorted().
We can’t remember map parameter order either, list comprehensions do fit in our memory (and are more elegant) 🙂
… still can’t remember if its map(fn, iterable) or map(iterable, fn)
The tedioust Python code to write indeed, we always need to copy it from somewhere 😉
… I always copy if __name__ == “__main__” from another Python script because I cannot count the underscores
Regex stuff (re module) is hard to do from memory (specially group() vs groups() on a matched object!):
… I need to check docs on pretty much everything in the ‘re’ lib before using it
We share the feeling, we too have to lookup datetime docs everytime we work with dates:
… I can’t use date and timezone properly without google
One of these things you open a quick REPL session for:
… I still have to use the REPL to figure out how slices work.
Oh and don’t forget the whitespace, luckily it’s simple to set (and forget) in Vim:
… I can’t write python without something to manage my whitespace.
Whitespace, ouch:
… contributor to many scientific python projects, and I just spent 40 min debugging because I had an extra space on one line.
*nix fun
This happens all the time to us too:
… I always forget about the crontab’s entry time order and need to lookup at the man page.
And:
… I’m using bash since 15 years but still have to Google the syntax of ‘find -exec’ every time I use it.
To have a laugh you can read more generic programming examples here
PyBites favorite:
… I’ve been coding in Python for 4 years now and I still haven’t learned any better languages.
And you?
You can share your experience with us via Twitter.
Keep Calm and Code in Python!
— Bob and Julian