Enumerating in Python for the Rubyist

While there are similarities between Python and Ruby that make the transition from one to the other not a particularly difficult one, there are also some vexing differences — lack of enumerables in Python being one.

This is, of course, not a comprehensive list Python equivalents for all of Ruby’s enumerables, but some of my more frequently used. In Python, it typically comes down to list comprehension, which can be very elegant, though there are some built-in functions.





Senior Software Engineer | www.adriennedomingus.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store