Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

python, how?!

Name: Anonymous 2008-11-30 10:45

hi.
i want to learn programming, but in my area there ain't anybody that can help me, so i want to ask for something only, kind of beginners book, or anything, and in a language that is powerfull. i heard of python, but i dont know anything about this. help?

Name: Anonymous 2008-12-01 3:35

26 here, more on that

So anyway I have a bunch of doodads and I only want to work on SOME of them, the others I just skip over. How the fuck should I work this?

First attempt

for doodad in AllThemDooDads:
   if not DoIReallyWantToWorkOnThis(doodad):
      continue # I don't, skip
   WorkOnThis(doodad)

That shit can eat my balls! Let's try again

for doodad in filter(DoIReallyWantToWorkOnThis, AllThemDooDads):
   WorkOnThis(doodad)

filter returns a list where the function calling DoIReallyWantToWorkOnThis on each element (doodad) in the list called AllThemDooDads is True

But that looks like ass! I thought Python was supposed to be elegant!! there exists a easy-to-read elegant way to do this but my mom's calling me for dinner so I leave it as is for now which works but is ugly as shit

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List