t:
For the same reason that we don't have an int method that makes zero
testing more explicit:
n = 0
n.iszero() # returns True
Because sometimes you can have too much explicitness.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 06 May 2011 12:36:09 -0600, Ian Kelly wrote:
> On Fri, May 6, 2011 at 10:59 AM, Steven D'Aprano
> wrote:
>> As written, amb is just a brute-force solver using more magic than is
>> good for any code, but it's fun to play with.
>
> This isn't re
r by any other mechanism you like, so long as
the behaviour at the Python level is the same.
At the assembly language level: memory is copied from one address to
another.
At the hardware level: we usually describe bit manipulation in terms of
binary AND, XOR and OR, but even that may be a
On Sun, 08 May 2011 01:44:13 -0400, Robert Brown wrote:
> Steven D'Aprano writes:
>> If you value runtime efficiency over development time, sure. There are
>> plenty of languages which have made that decision: Pascal, C, Java,
>> Lisp, Forth, and many more.
>
>
On Sat, 07 May 2011 22:50:55 -0500, harrismh777 wrote:
> Steven D'Aprano wrote:
>>> > and implies in any case that li does not exist
>> It does nothing of the sort. If li doesn't exist, you get a NameError.
>
> That was the point. 'not
On Mon, 09 May 2011 12:52:27 +1200, Gregory Ewing wrote:
> Steven D'Aprano wrote:
>
>> Since you haven't explained what you think is happening, I can only
>> guess.
>
> Let me save you from guessing. I'm thinking of a piece of paper with a
> little bo
, if your data has no underscore at all:
>>> each_value = "aaa*bbb*ccc"
>>> clean_name, _ = each_value.split('_', 1)
Traceback (most recent call last):
File "", line 1, in
ValueError: need more than 1 value to unpack
So you need to allow for the possibility that there is no underscore.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
at more explicit.
If I were talking to a programming n00b, I would have been more careful,
but you've made numerous references to your long, long programming
experience and I thought you would be able to draw the obvious connection
without me insulting you by stating the obvious.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 09 May 2011 15:09:32 -0400, James Wright wrote:
> Thank you Steven,
>
> I will take your advice :) In this particular case though, I do not
> think a lack of underscore is the issue, at least as far as I can
> understand the issue. Please see my reply to Ethan.
In your
On Tue, 10 May 2011 13:49:04 +1200, Gregory Ewing wrote:
> Steven D'Aprano wrote:
>
>> It's just that the term "variable" is so useful and so familiar that
>> it's easy to use it even for languages that don't have variables in the
>> C/ Pasc
l site where all such is put up? What if any should
> such a bundle of things be called?
Documentation.
Check the Python wiki.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ject is to be used with care in
> order to tests if an optional parameter is given or not (when default
> value is None).
Or, to put it another way: if you want to test for an object being None,
test for the object being None.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ghlight that
the remainder equals one, rather than the remainder merely being a true
value.
[2] Of course, a custom object x might misbehave when you test it for
truth value. That would be a bug, just like it would be a bug if it
misbehaved when you call len(x) == 0. If you can't trust "if x" to work,
what makes you think you can trust "len(x) == 0" either?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
r beginners. The only
people it confuses are those who are over-educated into thinking that the
One Correct Way of doing truth testing is with a dedicated boolean type,
and anything else is heresy.
[1] At least is you asked them.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
unicode results? I guess
> yes.
Yes. In Python 3, re.compile("some string") is automatically unicode,
because "some string" is unicode.
> 3) any related documentation...
http://docs.python.org/py3k/library/email.html
http://docs.python.org/py3k/library/re.html
other people. It's
not hard, and they can learn.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
thon, I use Python rules and meanings, not some
other language.
Why should I code according to what some hypothetical Python dummy
*might* think the code will do, instead of what the code *actually* does?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 11 May 2011 15:34:28 +0100, Hans Georg Schaathun wrote:
> On 11 May 2011 13:45:52 GMT, Steven D'Aprano
>wrote:
> : Do you think that we should avoid chained comparisons, class methods,
> : closures, co-routines, decorators, default values to functions, :
> d
On Wed, 11 May 2011 19:05:03 +, Chris Torek wrote:
> In article <[email protected]> Steven
> D'Aprano wrote:
>>When you call len(x) you don't care about the details of how to
>>calculate the length of x. The object itself
do. Empty lists are nothing, ergo false, and non-empty lists are
something, ergo true.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On 05/11/2011 02:47 PM, Steven D'Aprano wrote:
On Wed, 11 May 2011 20:13:35 +0100, Hans Georg Schaathun wrote:
One principle of object oriented programming is to bestow the objects
with properties reflecting known properties from the domain being
modelled. Lists do not have truth valu
On Wed, 11 May 2011 17:38:58 -0500, harrismh777 wrote:
> Steven D'Aprano wrote:
>>> modelled. Lists do not have truth values in the application domain
>> Yes they do. Empty lists are nothing, ergo false, and non-empty lists
>> are something, ergo true.
>>
&
t; and if so what is the best way to 'guess' the encoding? ... is it coded
>> in the stream somewhere...protocol?
>>
> You need to understand the difference between characters and bytes.
http://www.joelonsoftware.com/articles/Unicode.html
is also a good resource.
--
Ste
am" hump
into the "can program" hump. There does seem to be a simple predictor for
which hump you fall into: those who intuitively develop a consistent
model of assignment (right or wrong, it doesn't matter, so long as it is
consistent) can learn to program. Those who don't, can't.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
thetical comment every
time it is needed, or to assume that the read knows enough about object-
oriented programming to assume it, is an open question.
Me personally, I think it's part of the mental landscape that can be
assumed, like C docs might state "dereference the pointer" without adding
"(unless it is a nul pointer)" *every single time*.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
es of animal. But both dogs and dolphins are
mammals, so in that sense, Lassie and Flipper are both mammals and
therefore the same type of animal. It depends on what you mean by "type".
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ption rather than
BaseException. There are, er, exceptions, but for error-handling you
normally should inherit from Exception directly, or some sub-class like
ValueError, KeyError, etc.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
pelling true/false
when they want to discuss passing a Boolean value.
Other than those conveniences, there's nothing you can do with True and
False in Python that you can't do with any other set of objects.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ard... or moving your mouse... (come back on ? )
Presumably you would need to program something to watch for activity and
turn it back on. It would be somewhat embarrassing if you neglected to so
this...
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 14 May 2011 00:45:29 -0700, rusi wrote:
> On May 14, 12:39 pm, Steven D'Aprano [email protected]> wrote:
>> On Thu, 12 May 2011 23:46:12 -0700, rusi wrote:
>> > Mathematics has existed for millenia. Hindu-arabic numerals (base-10
>> > num
ython is not first class.
I'm afraid I don't understand what you mean. Can you explain please, what
properties of "first class booleans" do you think are missing from Python?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
rn(obj):
return cache.setdefault(obj, obj)
x = make_some_object()
x = my_intern(x)
This ensures that equal objects in the graph are not just equal, but the
same cached object.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ee', 'one', 'four', 'one', 'five']
>>> s = set(x)
>>> print s
set(['four', 'five', 'three', 'one'])
>>> list(s)
['four', 'five', 'three', 'one']
Once an element is already in a set, adding it again is a null-op:
>>> s = set()
>>> s.add(42)
>>> s.add(42)
>>> s.add(42)
>>> print s
set([42])
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 15 May 2011 10:33:38 -0700, rusi wrote:
> On May 15, 10:07 am, Steven D'Aprano [email protected]> wrote:
>>
>> I'm afraid I don't understand what you mean. Can you explain please,
>> what properties of "first class booleans"
then you are delusional.
Look at Facebook and its periodic security holes and accounts being
hacked. Not only don't Facebook distribute source code, but they don't
distribute *anything* -- their application is on their servers, behind a
firewall. Does it stop hackers? Not a chance.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
not* what you show
above, but (probablY) one of the following:
def __init__(bench): # oops, forgot self
# do stuff
def __init__(selfbench): # oops, forgot the comma
# do stuff
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ind that the level of
cheating on the vanilla server is quite low. Who wants to be the low-life
loser who wins by cheating when you can challenge your hacker peers
instead?
(Note: I don't know if this approach ever works, but I know it does *not*
work when real money or glory is involved. Not even close.)
If Blizzard can't stop private servers, rogue clients and hacked
accounts, what makes you think you can?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ite them to a new log file
> (for example selecting only fields 1, 2 and 3).
fields = line.split(' ')
output.write(fields[1] + ' ')
output.write(fields[2] + ' ')
output.write(fields[3] + '\n')
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
by somebody
skilled in the art.
http://www.usenix.org/events/sec08/tech/full_papers/nohl/nohl_html/index.html
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
could even fork the
code base and implement your suggested compatibility layer, or backport
Python 3 features, be really daring and create a 2/3 hybrid.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ing, it's only O(1) if you
assume that exponentiation is O(1). Computer scientists often like to
make this simplifying assumption, and it might even be true for floats,
but for long ints and any numeric data types with unlimited precision, it
won't be.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 20 May 2011 09:37:59 +1000, Chris Angelico wrote:
> On Fri, May 20, 2011 at 8:47 AM, Steven D'Aprano
> wrote:
>> On Tue, 17 May 2011 10:02:21 -0700, geremy condra wrote:
>>
>>> or O(1):
>>>
>>> φ = (1 + sqrt(5)) / 2
>>> numer
um_bird
Trust me on this, if the audience of Carry On films could understand
recursion, anyone can!
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
tware is only being
used by yourself, you should still attempt to make it as idiot-proof as
an idiot like yourself can make it.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
at the verification software tests every possible
vulnerability, as opposed to merely every imaginable one?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
gt; x*x == 0
True
But using something with more precision:
>>> from fractions import Fraction
>>> x = Fraction(10)**-300
>>> x*x == 0
False
So you get different behaviour between floats and arbitrary precision
numbers.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
x27;t think so.
English does use "remainder" as a verb, although not in the mathematical
sense; I think that:
a%b => a is remaindered by b
is at least grammatical, although still ugly and awkward. I'm afraid that
in English, the best way to say what you are trying to say is moderately
verbose:
"the hash value, an integer, is taken modulo ..."
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ne Descartes turning down an ale...
http://www.bbc.co.uk/dna/h2g2/A3651545
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 21 May 2011 02:02:48 +0100, MRAB wrote:
> On 21/05/2011 01:47, Steven D'Aprano wrote:
>> On Fri, 20 May 2011 21:17:29 +0100, MRAB wrote:
>>
>>> On 20/05/2011 20:01, Christian Heimes wrote:
>>>> Am 20.05.2011 17:50, schrieb MRAB:
>>>>&
07/01/immutable-instances-in-python.html
Or see the Decimal and Fraction classes in the standard library.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
#x27;s intention, there
are better ways of signaling that fact.
I'm not entirely sure what your point is... is it to encourage lazy
programmers to write "len(x)==0" instead of documentation and meaningful
names, or are you just pointing out the occasional silver-lining to a
practice which is generally and usually unnecessary?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
g fraction:
> 16
>
> 64
>
> He says "all I have to do is cancel out the sixes, so the answer is
> 1/4".
One of my favourite variations on this is by Abbott and Costello, where
Costello proves that 13*7 = 28 in three different ways.
http://www.youtube.com/watch?v=rLprXHbn19I
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
sheet?
http://www.resolversystems.com/products/resolver-one/
And presumably anyone who has played around with GUI programming in
Python will have run into message oriented coding.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ublic function for getting the size of an object is in the sys
module:
sys.getsizeof(a)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 23 May 2011 20:56:03 +0200, Rikishi42 wrote:
> On 2011-05-20, Steven D'Aprano
> wrote:
>> On Thu, 19 May 2011 22:13:14 -0700, rusi wrote:
>>
>>> [I agree with you Xah that recursion is a technical word that should
>>> not be foisted onto lay us
Lee. Of course he misses your point. He refuses to stop spamming
newsgroups even after being banned by his ISP, and he refuses to listen
to any opinion that doesn't agree with his own. Everyone else is an idiot.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
go backwards
and use M.
However, using P and Q for integers is merely arbitrary convention.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ode is probably buggy (unless you manually duplicate what super
does for you). And for single inheritance, it makes no difference whether
you use super or not.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
n either code or real life.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 25 May 2011 00:06:06 +0200, Rikishi42 wrote:
> On 2011-05-24, Steven D'Aprano
> wrote:
>>>> I think that is a patronizing remark that under-estimates the
>>>> intelligence of lay people and over-estimates the difficulty of
>>>> understanding
not rarely enters into these things.
That *you personally* can't or won't let go of Perl says nothing about
the relative readability of Perl and Python code.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
the flip side, I
> would prefer to have program structure defined by keywords like "if" and
> "while" than obscure random line noise. (Fortunately, most sane
> languages do indeed use keywords there.)
True. That's one of the limitations of the xtalk family of languages
derived from Apple's (defunct) Hypertalk: it's awfully verbose, which is
good for newbies but not quite so good for experts.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
just allow such obfuscation but encourage it makes the language great for
puzzles but not so good for when you actually want to get work done and
have to deal with code written by someone else. *Especially* if they're
significantly smarter, or dumber, than you.
Worst of all is dealing
ion (probably) does it:
* drill down all the way to the bottom, start deleting like mad, and work
your way back up the stack, deleting as you go.
You're interpreting the reference to "recursive" as a nod to the
implementation. I'm not, and therefore your arguments don't convince me.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
mment which could be useful to know at run-time goes into the
docstring; what's left over, if anything, becomes a # comment. Between
self-documenting code and docstrings, I hardly write any # comments.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
y subjectively by each
> individual absolves code of the responsibility to communicate to more
> than just its author.
Bravo!
+1 Quote of the Thread
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
be sure that it won't cause any problems, e.g.:
def get(list, object):
"""Append object to a copy of list and return it."""
return list + [object]
For one or two line functions, I think that's perfectly reasonable.
Anything more than that, I'd be getting nervous.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
o that the Perl
community is *full* of people who self-identify as "Just Another Perl
Hacker".
John, I'd apologise if I thought I said something rude or nasty to you,
but I don't, so I don't believe I have anything to apologise for. But I
will say that I regret that you took it as an attack, and assure you that
it was not meant that way.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
se (start, end)
if source.startswith(x+y+z, *t):
...
but that's still pretty icky.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 27 May 2011 13:24:24 +1000, Chris Angelico wrote:
> On Fri, May 27, 2011 at 11:59 AM, Steven D'Aprano
> wrote:
>> def get(list, object):
>> """Append object to a copy of list and return it.""" return list +
>> [object]
&g
On Fri, 27 May 2011 10:10:55 +0200, Thorsten Kampe wrote:
> * Steven D'Aprano (27 May 2011 03:07:30 GMT)
[...]
>> If I got it wrong about John, oh well, I said it was a guess, and
>> trying to get inside someone else's head is always a chancy business.
>
> Why
ra of articles that take a dim, if not outright negative,
view of super, it is good to see one that takes a positive view. Thanks
Raymond!
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
self), because it does not do what you think
it does:
b = B() calls B.__init__(self)
... which calls super(type(self), self) = super(B, self)
... which calls A.__init__(self)
... which calls super(type(self), self) = super(B, self) *not* A
... which loops forever
type(self) does not return B inside B methods and A inside A methods, it
returns the class of the instance.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
:
func = math.sin
else:
func = math.cos
y = func(math.pi/n)*10
L = ['spam']*(int(y))
for item in L:
print(item)
is valid syntax in every version of Python from 1.5 to 3.2, and it does
the same thing in all of them. Would you care to revise your claims?
--
Steven
--
htt
o make, but I promise you
that you're not the first, and won't be the last, to make it.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
same language that share nearly everything
in common but have a few significant differences.
Calling them "completely incompatible" is completely inaccurate.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 27 May 2011 15:40:53 -0500, harrismh777 wrote:
> Steven D'Aprano wrote:
>> Would you care to revise your claims?
>
> No.
>
>
> You have erected a straw-man... once again.
You keep using that term, but it is clear to me that you don't have the
f
On Sat, 28 May 2011 08:38:54 +0200, Thorsten Kampe wrote:
> * Thomas Rachel (Sat, 28 May 2011 07:06:53 +0200)
>> Am 27.05.2011 17:52 schrieb Steven D'Aprano:
>> > On Fri, 27 May 2011 09:40:53 -0500, harrismh777 wrote:
>> >> 3.x is completely incompatible wi
tion while it is executing?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
write float('nan')
>
> except that sometimes it can't:
>
> >>> nan = float("nan")
> >>> {nan, nan}
> {nan}
But in this case, you try to put the same NAN in the set twice. Since
sets optimize element testing by checking for identity before equality,
the NAN only goes in once.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
l tend to have larger
vocabularies than less educated people: both for the number of words they
actually use, and those they can interpret in context.
Geeks sometimes tend to forget that they're not the only smart, educated
people who use "hard" (big, technical, complicated) word
lly so. Most (all?) Python built-ins assume that any
object X is equal to itself, so they behave strangely with NANs.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
NaN
> INF == INF unordered
Wrong. Equality is not an order comparison.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
e scoping rules a
little more complex.
If a name is a function parameter, that is equivalent to being assigned
to inside the function.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
racter, rather than *just* dots:
http://x264Znl ...blah blah blah
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ican English are "different languages" and
"completely incompatible"?
The differences between Python 2 and 3 are less than those between
American and British English. To describe them as "different languages",
as if going from Python 2 to 3 was like translating English to Italian,
is absurd.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 29 May 2011 08:41:16 -0500, Andrew Berg wrote:
> On 2011.05.29 08:09 AM, Steven D'Aprano wrote:
[...]
> Kodos is written in Python and uses Python's regex engine. In fact, it
> is specifically intended to debug Python regexes.
Fair enough.
>> Secondly, you pro
What
actual problem are you hoping to solve here?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 30 May 2011 03:53:24 +1000, Chris Angelico wrote:
> On Sun, May 29, 2011 at 10:47 PM, Steven D'Aprano
> wrote:
>> If a name is assigned to anywhere in the function, treat it as a local,
>> and look it up in the local namespace. If not found, raise
>> Unboun
confusion as it is, without adding to it...
(I would expect the copysign function to honour the sign bit, so I
suppose in that sense one might describe NANs as signed.)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
roduced because people were confused when they got a NameError after
forgetting to declare something global:
>>> def f():
... print a
... a = a + 1
...
>>> a = 42
>>> f()
Traceback (innermost last):
File "", line 1, in ?
File "", line 2,
On Sun, 29 May 2011 22:19:49 +0100, Nobody wrote:
> On Sun, 29 May 2011 10:29:28 +0000, Steven D'Aprano wrote:
>
>>> The correct answer to "nan == nan" is to raise an exception,
>>> because
>>> you have asked a question for which the a
tion for
the [email protected] mailing list, which I'd like to share here:
http://mail.python.org/pipermail/tutor/2010-December/080505.html
Constructive criticism welcome.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ents. More often, traps log diagnostic information or
substitute valid results.
Flags offer both predictable control flow and speed. Their use requires
the programmer be aware of exceptional conditions, but flag stickiness
allows programmers to delay handling exceptional conditions until
necessary.
[end quote]
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ptions or NANs. I
don't like Decimal's default settings, but at least they can be changed.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
case, there would be no NaN value.
NANs aren't for overflow, that's what INFs are for. Even if you had
infinite precision floats and could get rid of INFs, you would still need
NANs.
> The real question is: Would NaN's removal be beneficial?
No, it would be another step backwards to the bad old days before the
IEEE standard.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 30 May 2011 11:31:33 +1000, Ben Finney wrote:
> Steven D'Aprano writes:
>
>> http://mail.python.org/pipermail/tutor/2010-December/080505.html
>>
>>
>> Constructive criticism welcome.
>
> Informative, but it “buries the lead” as our friends i
On Mon, 30 May 2011 04:29:19 +, Chris Torek wrote:
> In article <[email protected]>, Steven
> D'Aprano wrote:
>>That's also completely wrong. The correct way to test for a NAN is with
>>the IEEE-mandated function isnan(
On Mon, 30 May 2011 04:15:11 +, Steven D'Aprano wrote:
> On Mon, 30 May 2011 11:14:58 +1000, Chris Angelico wrote:
>
>> So, apart from float("nan"), are there actually any places where real
>> production code has to handle NaN? I was unable to get a nan by an
; s = "hello world"
>>> s . upper ( )
'HELLO WORLD'
In the case of integer literals, you need the space, otherwise Python
will parse 5. as a float:
>>> 5.
5.0
>>> 5.__add__
File "", line 1
5.__add__
^
SyntaxError: invalid syntax
>>> 5 .__add__
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
2101 - 2200 of 15563 matches
Mail list logo