r/Python • • Feb 28 '13

What's the one code snippet/python trick/etc did you wish you knew when you learned python?

I think this is cool:

import this

259 Upvotes

307 comments sorted by

View all comments

Show parent comments

1

u/thatdontmakenosense Feb 28 '13

This example can be rewritten as l = list(range(10)), though I guess that this particular list isn't so important for your main point...

1

u/jatoo Mar 01 '13

It can also be written

l = range(10)

2

u/thatdontmakenosense Mar 01 '13

Yes, if you're using an old (2.x) Python...

1

u/jatoo Mar 01 '13

Thanks! Didn't know that.