J
joe.hrbek
Hello everyone, I'm experimenting with python and i'm following this
tutorial:
http://docs.python.org/tut/node6.html#SECTION006400000000000000000 I'm
in section 4.7.5 Lambda Forms. In this section I was working along and
I noticed something strange. It happened because of a typo. Below is
a copy/paste from my idle session:
return lambda x: x+n
50
The first f(01) was a mistake. I accidentally forgot to delete the
zero, but to my suprise, it yielded the result I expected. So, I tried
it again, and viola, the right answer. So, I decided to really try and
throw it for a loop, f(010), and it produced 50. I expected 52
(42+10). Why doesn't python ignore the first zero and produce a result
of 52? It ignored the first zero for f(01) and f(02). Hmm. I know, I
know, why am I sending it a 01,02, or a 010 to begin with? Like I
said, it was an accident, but now i'm curious. I'm not a computer
science major so please be kind with any explanations.
tutorial:
http://docs.python.org/tut/node6.html#SECTION006400000000000000000 I'm
in section 4.7.5 Lambda Forms. In this section I was working along and
I noticed something strange. It happened because of a typo. Below is
a copy/paste from my idle session:
return lambda x: x+n
50
The first f(01) was a mistake. I accidentally forgot to delete the
zero, but to my suprise, it yielded the result I expected. So, I tried
it again, and viola, the right answer. So, I decided to really try and
throw it for a loop, f(010), and it produced 50. I expected 52
(42+10). Why doesn't python ignore the first zero and produce a result
of 52? It ignored the first zero for f(01) and f(02). Hmm. I know, I
know, why am I sending it a 01,02, or a 010 to begin with? Like I
said, it was an accident, but now i'm curious. I'm not a computer
science major so please be kind with any explanations.