Entering a very large number

Peter J. Holzer hjp-python at hjp.at
Sun Mar 25 15:25:10 EDT 2018


On 2018-03-25 19:18:23 +0200, ast wrote:
> Le 25/03/2018 à 03:47, Steven D'Aprano a écrit :
> > The Original Poster (OP) is concerned about saving, what, a tenth of a
> > microsecond in total? Hardly seems worth the effort, especially if you're
> > going to end up with something even slower.
> > 
> > 
> 
> I regret that many answers are malicious, as your.

I just looked up "malicious" in Merriam-Webster, just in case it has
some meaning I wasn't previously aware of.

Nope. It says: 

    : having or showing a desire to cause harm to someone
    : given to, marked by, or arising from malice

and malice is defined as:

    : desire to cause pain, injury, or distress to another
    : intent to commit an unlawful act or cause harm without legal
    justification or excuse

Can you explain, why you think that Steven (or anybody else in this
thread) wants to cause you harm, pain, injury or distress, or how his
answer constitutes an unlawful act?

> The question was how to enter a large number without
> going through a string, no matter why.

And the answer is: Write it all on one line.

> This question is absolutely legitimate, contrary to
> some people think.

It certainly is. OTOH, the question why you would want to do this is
also legitimate. So is the question why you think that the few
microseconds it takes to parse the string are not acceptable.

And finally:

> It seems that it is not feasible unless writting it in
> a single line, which is awful.
> OK, go on with the string, and Wolfgang solution using
> triple quote is good.

If you think that your solution is not good enough, why do you think
Wolfgang's solution is better? It still converts a string to an int and
it does additional operations on the string. So it is slower and harder
to understand than what you already had. (It also cannot be properly
indented, but you may not care about that.)

        hp

-- 
   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp at hjp.at         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20180325/1611bf2b/attachment.sig>


More information about the Python-list mailing list