Phlip schreef:
Nobody wrote:
Writing robust software from the outset puts you at a competitive
disadvantage to those who understand how the system works.
And I, not my language, should pick and chose how to be rigorous. The
language
should not make the decision for me.
You can always
On Tue, 05 Jan 2010 12:20:58 -0800, Marco Nawijn wrote:
You could use the build-in function enumerate inside a list
comprehension.
seq = range(5)
[ (i,s) for i,s in enumerate(seq) ]
[(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)]
Just use list(), i.e. list(enumerate(seq)).
--
On Jan 5, 2:40 pm, Phlip phlip2...@gmail.com wrote:
On Jan 5, 1:10 pm, Antoine Pitrou solip...@pitrou.net wrote:
http://docs.python.org/library/functions.html
Don't forget that the Python documentation is rich and structured.
And good luck.
Does it say how to convert a string containing
On Tue, 05 Jan 2010 19:46:01 -0800, alex23 wrote:
They will tell me how to use except: (which is a good example why a
program should not use exceptions for its normal control flow if at
all possible).
Really? Magic functions that coerce and eat errors are a better coding
technique than
Nobody wrote:
On Tue, 05 Jan 2010 19:46:01 -0800, alex23 wrote:
They will tell me how to use except: (which is a good example why a
program should not use exceptions for its normal control flow if at
all possible).
Really? Magic functions that coerce and eat errors are a better coding
On Wed, 06 Jan 2010 12:12:08 -0800, Phlip wrote:
And I, not my language, should pick and chose how to be rigorous. The
language should not make the decision for me.
All languages make that decision for you by making some thing possible
and other things not. The language designer, not the
Le Wed, 06 Jan 2010 12:12:08 -0800, Phlip a écrit :
And I, not my language, should pick and chose how to be rigorous. The
language should not make the decision for me.
And that's why there is the try: ... except: ... construct.
Your rant is getting tiring.
--
Phlip phlip2...@gmail.com wrote:
And I, not my language, should pick and chose how to be rigorous. The language
should not make the decision for me.
Since you seem unwilling to put the minimal effort into producing the
support code you'd need to work with Python the way you want, perhaps
Perl
On Jan 6, 12:12 pm, Phlip phlip2...@gmail.com wrote:
Nobody wrote:
Writing robust software from the outset puts you at a competitive
disadvantage to those who understand how the system works.
And I, not my language, should pick and chose how to be rigorous. The language
should not make the
Hypo Nt:
def each_with_index(seq):
index = 0
result = []
for item in seq:
result.append([item, index])
index += 1
return result
My Pythonic sequencing skills are obviously feeble. Can anything think
of a way to write that in fewer lines?
--
Phlip
On Jan 6, 8:58 am, Phlip phlip2...@gmail.com wrote:
Hypo Nt:
def each_with_index(seq):
index = 0
result = []
for item in seq:
result.append([item, index])
index += 1
return result
My Pythonic sequencing skills are obviously feeble. Can anything think
of a
Phlip wrote:
Hypo Nt:
def each_with_index(seq):
index = 0
result = []
for item in seq:
result.append([item, index])
index += 1
return result
My Pythonic sequencing skills are obviously feeble. Can anything think
of a way to write that in fewer lines?
On Jan 5, 8:58 pm, Phlip phlip2...@gmail.com wrote:
Hypo Nt:
def each_with_index(seq):
index = 0
result = []
for item in seq:
result.append([item, index])
index += 1
return result
My Pythonic sequencing skills are obviously feeble. Can anything think
of a
My Pythonic sequencing skills are obviously feeble. Can anything think
of a way to write that in fewer lines?
Thanks, all!
Couldn't you just use the built-in enumerate() to replace the whole thing?
Because that would involve, like, reading an entire Python book just
to locate that method?
Couldn't you just use the built-in enumerate() to replace the whole
thing?
Because that would involve, like, reading an entire Python book just to
locate that method?
Actually, no. It just involves reading one of the most important pages in
the documentation, the page which describes the
On Jan 5, 1:10 pm, Antoine Pitrou solip...@pitrou.net wrote:
http://docs.python.org/library/functions.html
Don't forget that the Python documentation is rich and structured.
And good luck.
Does it say how to convert a string containing either an integer
representation, or something
On Tue, 05 Jan 2010 14:40:49 -0800, Phlip wrote:
On Jan 5, 1:10 pm, Antoine Pitrou solip...@pitrou.net wrote:
http://docs.python.org/library/functions.html
Don't forget that the Python documentation is rich and structured. And
good luck.
Does it say how to convert a string containing
Does it say how to convert a string containing either an integer
representation, or something alphabetic, into an integer, or a zero, in
like 1 method call? (No except: ?)
If you mean something like this:
int('153')
153
The point: int('') or int('something') both throw an error. In
On Jan 5, 2010, at 4:30 PM, Phlip phlip2...@gmail.com wrote:
The point: int('') or int('something') both throw an error. In
general, this is hand-holding, but in specific I don't think the rich
and structured documentation will cover how to beat a 0 out of it in
less than 3 lines. So I will
The point: int('') or int('something') both throw an error. In general,
this is hand-holding, but in specific I don't think the rich and
structured documentation will cover how to beat a 0 out of it in less
than 3 lines.
Because it's a bad idea to do so and Python doesn't encourage such
Antoine Pitrou wrote:
The point: int('') or int('something') both throw an error. In general,
this is hand-holding, but in specific I don't think the rich and
structured documentation will cover how to beat a 0 out of it in less
than 3 lines.
Because it's a bad idea to do so and Python doesn't
Phlip phlip2...@gmail.com wrote:
They will tell me how to use except: (which is a good example why a
program should not use exceptions for its normal control flow if at
all possible).
Really? Magic functions that coerce and eat errors are a better coding
technique than exceptions and explicit
On Tue, 05 Jan 2010 15:30:09 -0800, Phlip wrote:
Does it say how to convert a string containing either an integer
representation, or something alphabetic, into an integer, or a zero,
in like 1 method call? (No except: ?)
If you mean something like this:
int('153')
153
The point:
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote:
Stick around and you might learn something,
but if you bite every time somebody tries to teach you, you'll soon run
out of people willing to help you.
The ongoing crowdsourced development by this group of Victor
Subervi's project
24 matches
Mail list logo