Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^5: solve cubic equations (Python)

by LanX (Saint)
on May 05, 2017 at 18:47 UTC ( [id://1189598]=note: print w/replies, xml ) Need Help??


in reply to Re^4: solve cubic equations (Python)
in thread solve cubic equations

Well I prefer the Py3 behaviour.

YMMV :)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^6: solve cubic equations (Python)
by no_slogan (Deacon) on May 05, 2017 at 18:54 UTC
    I guess most people do, but I don't care for it. If I have an integer, I need to use // to divide, or it gets converted to a float. If I have a Fraction, I need to use /, or it gets converted to an integer. You say, "but // always produces an integer, that's so much easier." But I don't see why there has to be a special operator devoted to integers.
    >>> from fractions import Fraction >>> x = Fraction(22,7) >>> y = 3 >>> print(x,x/2,x//2) 22/7 11/7 1 >>> print(y,y/2,y//2) 3 1.5 1
      > But I don't see why there has to be a special operator devoted to integers.

      To be spotted easily?

      Look your explanation was better than mine, you're far more experienced than me with python, nevertheless you didn't see the error in the code.

      Wasn't explicit is better than implicit a python slogan?

      Anyway I like the many operators in Perl, what's lacking is optional explicit typing, to tune inner loops.

      Strangely the parser already allows typing, for many years yet.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

        ...you didn't see the error in the code.

        Touché. But this kind of thing is a stopped clock. It's only right twice a day, and the rest of the time you have to catch the error yourself.

        I just discovered use integer... it's been in core since the beginning of time, but for some reason I never noticed it before.

        "nevertheless you didn't see the error in the code."

        Nobody cares. The Python version will always look sexier.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1189598]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-03-30 07:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found