Hello!
I have trouble understanding something in this code snippet:
class TextReader:
"""Print and number lines in a text file."""
def __init__(self, file):
self.file = file
.
.
.
When would you do a thing like self.file = file ? I really don't
find an
Why is the \ backslash character frowned upon? Can I still use it in
Python 3.0 to achieve the same thing it was designed to do?
--
http://mail.python.org/mailman/listinfo/python-list
We have to avoid the use of the 'is' identity operator with basic,
immutable values such as numbers and strings. The result is
unpredictable because of the way Python handles these objects
internally.
How is with this issue in Python 3.0? Is it fixed? Does Python handle
this things properly now?
-
Is that true that this comparison operators are gone in Python 3.0:
<(is less than)
>(is greater than)
<= (is less than or equals)
>= (is greater than or equals)
Is it true?
--
http://mail.python.org/mailman/listinfo/python-list
To create a tuple with one element, you need to do this:
>>> my_tuple = (1,)# Note the trailing comma after the value 1
>>> type(my_tuple)
But if you do this
>>> my_tuple = (1)
>>> type(my_tuple)
you don't get a tuple. I thought that just putting a value inside ( )
would make a tuple. Ap
This really looks ugly for an error message:
[1]+ Stopped python
Please explain to me the role of the '+' sign. And why is there such a
gap between 'Stopped' and 'python'?
--
http://mail.python.org/mailman/listinfo/python-list
We should have that statement, so that problems, expressed in
http://groups.google.com/group/comp.lang.python/browse_thread/thread/3bda1fc4895ec886/bc5fe40cfbd10124?lnk=raot#bc5fe40cfbd10124,
would not occur.
--
http://mail.python.org/mailman/listinfo/python-list
If you are in the interactive prompt of the Python interpreter and you
do this
print """Testing\""" or print '''Testing\'''
you get three dots [...] as if Python expects a code block. If you
press Enter, you get three dots again, and again, and again... You
can't get out of the code block wit
There's a thing that bugs me in Python. Look at this...
>>> print "Testing\"
SyntaxError: EOL while scanning single-quoted string
Please focus on the part of the error message that states "while
scanning single-quoted string". How can Python claim it scanned a
single-quoted string when I fed it
I am stunned that this simple misunderstanding of mine ended in a
mathematical clash of a sort. :) You guys really blew me away wih
your mathematical knowledge. And also the 0**0 is a thing I've never
thought about trying, until now that is. If the mathematical rule is
that EVERYTHING raised to th
Have a look at this:
>>> -123**0
-1
The result is not correct, because every number (positive or negative)
raised to the power of 0 is ALWAYS 1 (a positive number 1 that is).
The problem is that Python parses -123**0 as -(123**0), not as
(-123)**0.
I suggest making the Python parser omit the n
11 matches
Mail list logo