J
jimbo1qaz
Am I missing something obvious, or do I have to manually put in a counter in the for loops? That's a very basic request, but I couldn't find anything in the documentation.
Am I missing something obvious, or do I have to manually put in a counter in the for loops? That's a very basic request, but I couldn't find anything in the documentation.
Am I missing something obvious, or do I have to manually put in a counter in the for loops? That's a very basic request, but I couldn't find anything in the documentation.
Am I missing something obvious, or do I have to manually put in a counter in the for loops? That's a very basic request, but I couldn't find anything in the documentation.
Ya, they should really give a better way, but for now, enumerate works
pretty well.
Define "a better way". What did you have in mind that would work better?
You can always use a counter if you don't like our fancy for-each loops;
foolist = [1,24,24,234,23,423,4]
for i in xrange(len(foolist)):
print foolist
You can always use a counter if you don't like our fancy for-each loops;
foolist = [1,24,24,234,23,423,4]
for i in xrange(len(foolist)):
print foolist
http://www.seas.upenn.edu/~lignos/py_antipatterns.html
The first one on the list of anti-patterns is doing exactly this.
Just don't. Ewww. Inefficient, ugly, and harder to read.
Part of learning to write in Python is, well, learning to write
*Python*, not {C,C++,Java,PHP}-in-Python.
-tkc
jimbo1qaz said:Ya, they should really give a better way, but for now, enumerate works pretty well.
ROFLOL!!
I look forward to the day when you look back on that statement and think,
"Wow, I've come a long way!"
implementator) or in a more readable manner? Chose *any* one of those.
Well if you're learning then the builtin might be more like how we
answer students questions here, than those doing work.
It's a function usage. Not to be too serious, there are usually
simpler solutions, and built in functions.
It's not the simpler solution I'm referring to, it's the fact that if
you're learning, then you should be able to design the built-in, not
just use it.
You don't always know all the built-ins, so the builtin is simpler,
but knowing how to code it yourself is the priority of learning to
code in a higher level language, which should be simpler to the user
of python.
What are talking about, I suggested they roll there own in severalSTOP SAYING THIS NONSENSE.
Using a pre-defined function is _not_ the "student" approach.
Yes it is, if you don't know the builtin, and everyone has memory flaws.your own version of an existing function from scratch is _not_ the
"professional" approach.
If you're unable to realise this, then please stop dispensing advice
here like you know something.
Rolling> your own version of an existing function from scratch is _not_ the
Yes it is, if you don't know the builtin, and everyone has memory flaws.
Dude, you know jack shit, so go shovel this bullshit somewhere else,
where people aren't intelligent enough to read the rest of my posts
CEO: http://www.hitwebdevelopment.com
what's the fucking point of that question
actually produce.
I produce working code, and if it works, then I don't just think...I know.
Working code != good code. Just an observation. Also, I've noticed a vast differences between someone who can explain their answers as Alix has done on multiple threads you've replied to in the last 5 minutes, and someone who cobbles something together with "your variable isn't being shown right because there's no self.a," which actually really makes no sense at all. Just my $0.02.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.