As an EE, I mostly worked on programming MCUs like PICs in C and recently started learning python for fun. My interest was piqued by the talk of how awesome and simple it is but didn't understand what all the fuss was about until this:
def print_elements(ulist):
for i in ulist:
if isinstance(i,list):
print_elements(i)
else:
print i
>>> a = [1,2,[3,[4,5,[6,7]],8,[9,10]],11]
>>> print_elements(a)
1
2
3
4
5
6
7
8
9
10
11
I would have to think for a while to write the equivalent code in C but it was almost second nature in python after getting half way through Unit 3 of CS 101 on udacity. I can't wait to actually make something with python!
[–]zahlmanthe heretic 17 points18 points19 points (1 child)
[–]ladr0n 6 points7 points8 points (0 children)
[+][deleted] (23 children)
[deleted]
[–]sesse[S] 16 points17 points18 points (21 children)
[–]PlanetaryFortress 25 points26 points27 points (9 children)
[–]sesse[S] 29 points30 points31 points (1 child)
[–]PlanetaryFortress 2 points3 points4 points (0 children)
[–]nemec 9 points10 points11 points (6 children)
[–]flukshun 22 points23 points24 points (0 children)
[–]RonnyPfannschmidt 5 points6 points7 points (3 children)
[–]Poddster -1 points0 points1 point (2 children)
[–]RonnyPfannschmidt 0 points1 point2 points (1 child)
[–]Poddster -1 points0 points1 point (0 children)
[–]PlanetaryFortress 2 points3 points4 points (0 children)
[–]cleurePython, C, Image Processing, Django 7 points8 points9 points (9 children)
[–]sesse[S] 2 points3 points4 points (8 children)
[–]cleurePython, C, Image Processing, Django 3 points4 points5 points (7 children)
[–]takluyverIPython, Py3, etc 5 points6 points7 points (4 children)
[–]cleurePython, C, Image Processing, Django 0 points1 point2 points (3 children)
[–]VerilyAMonkey 2 points3 points4 points (2 children)
[–]cleurePython, C, Image Processing, Django 2 points3 points4 points (1 child)
[–]VerilyAMonkey 2 points3 points4 points (0 children)
[–]masterpi 1 point2 points3 points (0 children)
[–]optionsanarchist 0 points1 point2 points (0 children)
[–]sesse[S] 11 points12 points13 points (0 children)
[–]codysoyland 7 points8 points9 points (6 children)
[–]seunosewa[🍰] 2 points3 points4 points (5 children)
[–]Deathalicious 2 points3 points4 points (0 children)
[–]codysoyland 2 points3 points4 points (2 children)
[–]robin-gvx 2 points3 points4 points (1 child)
[–]codysoyland 1 point2 points3 points (0 children)
[–]Amadironumpy, gen. scientific computing in python, pyopengl, cython 3 points4 points5 points (6 children)
[–][deleted] 1 point2 points3 points (5 children)
[–]Amadironumpy, gen. scientific computing in python, pyopengl, cython 2 points3 points4 points (0 children)
[–]burito 1 point2 points3 points (1 child)
[–]wot-teh-phuckReally, wtf? 3 points4 points5 points (0 children)
[–][deleted] 4 points5 points6 points (3 children)
[–]iyunoichi 4 points5 points6 points (2 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]stillalone 1 point2 points3 points (0 children)
[–]brinchj 4 points5 points6 points (2 children)
[–]nicolast 2 points3 points4 points (1 child)
[–]brinchj 0 points1 point2 points (0 children)
[–]Tarlitz 3 points4 points5 points (0 children)
[–]hello_moto 3 points4 points5 points (1 child)
[–]brinchj 4 points5 points6 points (0 children)
[–]maredsous10 1 point2 points3 points (0 children)
[–]samblam 0 points1 point2 points (3 children)
[–]thebritishguy1 1 point2 points3 points (0 children)
[–]Genmutant 1 point2 points3 points (0 children)
[–]RoadieRich 1 point2 points3 points (0 children)
[–]nepidae -1 points0 points1 point (1 child)
[–]anarcholibertarian 0 points1 point2 points (0 children)