Re: Old Man Yells At Cloud

2017-09-23 Thread Rick Johnson
Steve D'Aprano wrote: > Paul Rubin wrote: > > Steve D'Aprano writes: > > > Having to spend a few hours being paid to migrate code > > > using "print x" to "print(x)", or even a few months, is > > > not a life-changing experience. > > > > Didn't someone further up the thread mention some company >

Re: Old Man Yells At Cloud

2017-09-23 Thread Paul Moore
On 23 September 2017 at 12:37, Steve D'Aprano wrote: > 95% of Python is unchanged from Python 2 to 3. 95% of the remaining is a > trivial > renaming or other change which can be mechanically translated using a tool > like > 2to3. Only the remaining 5% of 5% is actually tricky to migrate. If your

Re: Old Man Yells At Cloud

2017-09-23 Thread Steve D'Aprano
On Fri, 22 Sep 2017 04:05 pm, Paul Rubin wrote: > Steve D'Aprano writes: >> Having to spend a few hours being paid to migrate code using "print x" >> to "print(x)", or even a few months, is not a life-changing experience. > > Didn't someone further up the thread mention some company that had spe

Re: Old Man Yells At Cloud

2017-09-21 Thread Paul Rubin
Steve D'Aprano writes: > Having to spend a few hours being paid to migrate code using "print x" > to "print(x)", or even a few months, is not a life-changing experience. Didn't someone further up the thread mention some company that had spent 1.5 years porting a py2 codebase to py3? The issue of

Re: Old Man Yells At Cloud

2017-09-21 Thread Steve D'Aprano
On Fri, 22 Sep 2017 02:00 pm, Rick Johnson wrote: > I think it's grossly unfair to label those who's lives > have been up-ended by the backwards incompatible changes of > Python3 as "haters". Nobody, not one person, has ever had their life upended by Python 3. People have their lives upended by

Re: Old Man Yells At Cloud

2017-09-21 Thread Rick Johnson
On Thursday, September 21, 2017 at 10:12:25 AM UTC-5, Steve D'Aprano wrote: > [...] > And remember that the Python core developers feel your pain > too. They had to migrate a large code base (the Python std > library) from 2 to 3. They had to write the 2to3 > translator. And they have to maintain t

Re: Old Man Yells At Cloud

2017-09-21 Thread Chris Angelico
On Fri, Sep 22, 2017 at 3:07 AM, Rhodri James wrote: > On 21/09/17 17:31, Chris Angelico wrote: >> >> For a good while, I was in the same position. But instead of massively >> rewriting everything, all I did was to adjust the material to use >> Py2/Py3 compatible syntax. Adding parens around your

Re: Old Man Yells At Cloud

2017-09-21 Thread Rhodri James
On 21/09/17 17:31, Chris Angelico wrote: For a good while, I was in the same position. But instead of massively rewriting everything, all I did was to adjust the material to use Py2/Py3 compatible syntax. Adding parens around your print calls won't stop it from being Py2-compatible, and it means

Re: Old Man Yells At Cloud

2017-09-21 Thread Chris Angelico
On Fri, Sep 22, 2017 at 1:59 AM, Rhodri James wrote: > On 21/09/17 16:12, Steve D'Aprano wrote: >> >> On Thu, 21 Sep 2017 08:19 pm, Rhodri James wrote: >> >>> (That's basically my gripe against print becoming a function in Python3. >>>It makes a lot of sense as has already been pointed out, bu

Re: Old Man Yells At Cloud

2017-09-21 Thread Rhodri James
On 21/09/17 16:12, Steve D'Aprano wrote: On Thu, 21 Sep 2017 08:19 pm, Rhodri James wrote: (That's basically my gripe against print becoming a function in Python3. It makes a lot of sense as has already been pointed out, but it breaks every beginners tutorial.) Nobody made that decision lig

Re: Old Man Yells At Cloud

2017-09-21 Thread Steve D'Aprano
On Thu, 21 Sep 2017 08:19 pm, Rhodri James wrote: > (That's basically my gripe against print becoming a function in Python3. > It makes a lot of sense as has already been pointed out, but it breaks > every beginners tutorial.) Nobody made that decision lightly. It wasn't a spur of the moment de

Re: Old Man Yells At Cloud

2017-09-21 Thread Rhodri James
On 19/09/17 19:31, bartc wrote: Can't you get around all those with things like sys.stdout.write? If so, what was the point of having a discrete print statement/function at all? Simplicity. It is much easier to explain to a beginner that print("Wombats are go!") will write something to

Re: Old Man Yells At Cloud

2017-09-21 Thread Pavol Lisy
On 9/20/17, Steve D'Aprano wrote: > On Wed, 20 Sep 2017 02:55 pm, Pavol Lisy wrote: Thanks Steve, I agree with most of your mail and really appreciate interesting reading! :) > (a) "you save one character (two keystrokes)"; and First I have to admit that I forgot space! But if we like to be ped

Re: Old Man Yells At Cloud

2017-09-20 Thread Grant Edwards
On 2017-09-19, Stefan Ram wrote: > Chris Angelico writes: >>On Wed, Sep 20, 2017 at 4:59 AM, Stefan Ram wrote: >>>I don't get this. For example, the contractual payment (cost) is >>>47.21 >>>, the other party hands over >>>50.25 >>>. Now I am supposed to add /what/ to the cost? >>Start at the sm

Re: Old Man Yells At Cloud

2017-09-20 Thread Ben Bacarisse
bartc writes: > Value-Added-Tax in the UK increased from 17.5% to 20%, ... When it was 17.5% you could shock people not in the know by working it out in your head since it's much simpler than it sounds: take a tenth, halve it, halve it again, and add all three. -- Ben. -- https://mail.python.

Re: Old Man Yells At Cloud

2017-09-20 Thread Steve D'Aprano
On Thu, 21 Sep 2017 01:06 am, Dennis Lee Bieber wrote: > On Wed, 20 Sep 2017 10:08:18 +1000, Steve D'Aprano > declaimed the following: > >>For what its worth: from Python 3.5 (I think) onwards the error you get is >>customized: >> >>py> print 1 >> File "", line 1 >>print 1 >> ^ >>S

Re: Old Man Yells At Cloud

2017-09-20 Thread Thomas Jollans
On 2017-09-19 16:30, D'Arcy Cain wrote: > On 09/19/2017 06:46 AM, Larry Martell wrote: >> True story - the other day I was in a store and my total was $10.12. I > > One time I was at a cash with three or four items which were taxable. > The cashier rung each one up and hit the total button.  She t

Re: Old Man Yells At Cloud

2017-09-20 Thread Thomas Jollans
On 2017-09-20 17:06, Dennis Lee Bieber wrote: > On Wed, 20 Sep 2017 10:08:18 +1000, Steve D'Aprano > declaimed the following: > >> For what its worth: from Python 3.5 (I think) onwards the error you get is >> customized: >> >> py> print 1 >> File "", line 1 >>print 1 >> ^ >> SyntaxE

Re: Old Man Yells At Cloud

2017-09-20 Thread Chris Angelico
On Thu, Sep 21, 2017 at 1:06 AM, Dennis Lee Bieber wrote: > On Wed, 20 Sep 2017 10:08:18 +1000, Steve D'Aprano > declaimed the following: > >>For what its worth: from Python 3.5 (I think) onwards the error you get is >>customized: >> >>py> print 1 >> File "", line 1 >>print 1 >> ^ >

Re: Old Man Yells At Cloud

2017-09-20 Thread Steve D'Aprano
On Wed, 20 Sep 2017 02:55 pm, Pavol Lisy wrote: > On 9/19/17, Steve D'Aprano wrote: > > [...] > >> The point is, we all make the occasional silly error. Doesn't mean we should >> cripple our functions and fill the language with special cases like the >> print >> statement to avoid such rare err

Re: Old Man Yells At Cloud

2017-09-20 Thread Chris Angelico
On Wed, Sep 20, 2017 at 4:01 PM, Steven D'Aprano wrote: > The other reserved words are either: > > - values, like None, which can be included in expressions; > > - operators, like `is`, `or`, and `not`; > > - block statements, like `for x in seq` or `while flag` which > require a block; > > - st

Re: Old Man Yells At Cloud

2017-09-19 Thread Steven D'Aprano
On Tue, 19 Sep 2017 18:43:43 -0700, Rick Johnson wrote: > On Tuesday, September 19, 2017 at 12:55:14 PM UTC-5, Chris Angelico > wrote: >> On Wed, Sep 20, 2017 at 3:44 AM, Stefan Ram >> wrote: >> > Steve D'Aprano did *not* write [it was >> > edited/abbreviated by me - S. R.]: >> > |disadvantages:

Re: Old Man Yells At Cloud

2017-09-19 Thread Chris Angelico
On Wed, Sep 20, 2017 at 2:55 PM, Pavol Lisy wrote: > BTW if python would only bring "from __cleverness__ import > print_function" how many people would accept your reasons and use it? > And how many would rewrite old code? > > How many people would say something like: "Oh it is cool! Now I could >

Re: Old Man Yells At Cloud

2017-09-19 Thread Pavol Lisy
On 9/19/17, Steve D'Aprano wrote: [...] > The point is, we all make the occasional silly error. Doesn't mean we should > cripple our functions and fill the language with special cases like the > print > statement to avoid such rare errors. If print had always been a function, > and > someone sug

Re: Old Man Yells At Cloud

2017-09-19 Thread MRAB
On 2017-09-20 01:41, Stefan Ram wrote: Steve D'Aprano writes: A simple "autocorrect" in *what*? The interpreter? The editor? Both? I imagine something like this: When the editor gets the command to run the contents of the buffer as Python, it would then do the autocorrect in the buff

Re: Old Man Yells At Cloud

2017-09-19 Thread Ethan Furman
On 09/19/2017 09:37 AM, justin walters wrote: On Tue, Sep 19, 2017 at 9:17 AM, Grant Edwards wrote: On 2017-09-19, Jan Erik =?utf-8?q?Mostr=C3=B6m?= wrote: And I'm amazed how often I see people trying to calculate change = sum handed over - cost and then trying to figure out what bi

Re: Old Man Yells At Cloud

2017-09-19 Thread Rick Johnson
On Tuesday, September 19, 2017 at 1:31:52 PM UTC-5, bartc wrote: [...] > Can't you get around all those with things like > sys.stdout.write? Yes. > If so, what was the point of having a discrete print > statement/function at all? I believe the original intent was to create a universal symbo

Re: Old Man Yells At Cloud

2017-09-19 Thread Rick Johnson
On Tuesday, September 19, 2017 at 12:55:14 PM UTC-5, Chris Angelico wrote: > On Wed, Sep 20, 2017 at 3:44 AM, Stefan Ram wrote: > > Steve D'Aprano did *not* write > > [it was edited/abbreviated by me - S. R.]: > > |disadvantages: > > |0 - it makes print a special thing No more "special" than any

Re: Old Man Yells At Cloud

2017-09-19 Thread Rick Johnson
On Tuesday, September 19, 2017 at 2:08:05 AM UTC-5, Steven D'Aprano wrote: > [...] > 5.6775 is a much more useful answer than Fraction(2271, 400). ("What's > that in real money?") Steven, you're not using floats for currency are you? Tsk tsk! Besides, if Python division returned a useless frac

Re: Old Man Yells At Cloud

2017-09-19 Thread Steve D'Aprano
On Wed, 20 Sep 2017 04:31 am, bartc wrote: > On 19/09/2017 17:30, Steve D'Aprano wrote: [snip list of problems with print] > Can't you get around all those with things like sys.stdout.write? If you had kept reading, you would have seen that I wrote: Of course an experienced Python coder ca

Re: Old Man Yells At Cloud

2017-09-19 Thread Steve D'Aprano
On Wed, 20 Sep 2017 03:44 am, Stefan Ram wrote: > Steve D'Aprano did *not* write > [it was edited/abbreviated by me - S. R.]: > |disadvantages: > |0 - it makes print a special thing > |1 - beginners have to unlearn > |2 - `print(x, y)` is *not* the same as `print x, y`; > |3 - it has bizarre synt

Re: Old Man Yells At Cloud

2017-09-19 Thread Chris Angelico
On Wed, Sep 20, 2017 at 5:45 AM, Stefan Ram wrote: > Chris Angelico writes: >>On Wed, Sep 20, 2017 at 4:59 AM, Stefan Ram wrote: >>>I don't get this. For example, the contractual payment (cost) is >>>47.21 >>>, the other party hands over >>>50.25 >>>. Now I am supposed to add /what/ to the cost?

Re: Old Man Yells At Cloud

2017-09-19 Thread Chris Angelico
On Wed, Sep 20, 2017 at 4:59 AM, Stefan Ram wrote: > "Jan Erik =?utf-8?q?Mostr=C3=B6m?=" writes: >>And I'm amazed how often I see people trying to calculate >>change = sum handed over - cost >>and then trying to figure out what bills/coins should be returned >>instead of doing the simple thing of

Re: Old Man Yells At Cloud

2017-09-19 Thread bartc
On 19/09/2017 17:26, Larry Martell wrote: On Tue, Sep 19, 2017 at 10:30 AM, D'Arcy Cain wrote: On 09/19/2017 06:46 AM, Larry Martell wrote: True story - the other day I was in a store and my total was $10.12. I One time I was at a cash with three or four items which were taxable. The cashi

Re: Old Man Yells At Cloud

2017-09-19 Thread justin walters
On Tue, Sep 19, 2017 at 9:26 AM, Larry Martell wrote: > On Tue, Sep 19, 2017 at 10:30 AM, D'Arcy Cain > wrote: > > On 09/19/2017 06:46 AM, Larry Martell wrote: > >> > >> True story - the other day I was in a store and my total was $10.12. I > > > > > > One time I was at a cash with three or four

Re: Old Man Yells At Cloud

2017-09-19 Thread Grant Edwards
On 2017-09-19, Larry Martell wrote: > I was just in a clothing store this weekend and there was a rack of > clothes that was 50%. The sales clerk said everything on that rack was > an additional 25% off, so it's 75% off the original price. I asked is > it 75% off the original price or 25% off the

Re: Old Man Yells At Cloud

2017-09-19 Thread bartc
On 19/09/2017 17:30, Steve D'Aprano wrote: On Tue, 19 Sep 2017 05:56 am, Roel Schroeven wrote: I do prefer Python 3's print-as-a-function because "special cases aren't special enough to break the rules", but I feel there's a case to be made for Python 2's print-as-a-statement because "(altho

Re: Old Man Yells At Cloud

2017-09-19 Thread Chris Angelico
On Wed, Sep 20, 2017 at 3:44 AM, Stefan Ram wrote: > Steve D'Aprano did *not* write > [it was edited/abbreviated by me - S. R.]: > |disadvantages: > |0 - it makes print a special thing > |1 - beginners have to unlearn > |2 - `print(x, y)` is *not* the same as `print x, y`; > |3 - it has bizarre s

Re: Old Man Yells At Cloud

2017-09-19 Thread Steve D'Aprano
On Tue, 19 Sep 2017 05:56 am, Roel Schroeven wrote: > I do prefer Python 3's print-as-a-function because "special cases aren't > special enough to break the rules", but I feel there's a case to be made > for Python 2's print-as-a-statement because "(although) practicality > beats purity" sometim

Re: Old Man Yells At Cloud

2017-09-19 Thread justin walters
On Tue, Sep 19, 2017 at 9:17 AM, Grant Edwards wrote: > On 2017-09-19, Jan Erik =?utf-8?q?Mostr=C3=B6m?= > wrote: > > > And I'm amazed how often I see people trying to calculate > > > > change = sum handed over - cost > > > > and then trying to figure out what bills/coins should be returned

Re: Old Man Yells At Cloud

2017-09-19 Thread Larry Martell
On Tue, Sep 19, 2017 at 10:30 AM, D'Arcy Cain wrote: > On 09/19/2017 06:46 AM, Larry Martell wrote: >> >> True story - the other day I was in a store and my total was $10.12. I > > > One time I was at a cash with three or four items which were taxable. The > cashier rung each one up and hit the to

Re: Old Man Yells At Cloud

2017-09-19 Thread Grant Edwards
On 2017-09-19, Jan Erik =?utf-8?q?Mostr=C3=B6m?= wrote: > And I'm amazed how often I see people trying to calculate > > change = sum handed over - cost > > and then trying to figure out what bills/coins should be returned > instead of doing the simple thing of just adding to the cost. When

Re: Old Man Yells At Cloud

2017-09-19 Thread D'Arcy Cain
On 09/19/2017 06:46 AM, Larry Martell wrote: True story - the other day I was in a store and my total was $10.12. I One time I was at a cash with three or four items which were taxable. The cashier rung each one up and hit the total button. She turned to me and said something like "$23.42 pl

Re: Old Man Yells At Cloud

2017-09-19 Thread Rhodri James
On 18/09/17 16:29, Ben Bacarisse wrote: Steve D'Aprano writes: To answer your question, what do I mean by int/int being undefined, I'd have to dig into areas of maths that either weren't taught in the undergrad courses I did, or that I've long since forgotten about. Something about... fields?

Re: Old Man Yells At Cloud

2017-09-19 Thread Jan Erik Moström
On 19 Sep 2017, at 13:01, bartc wrote: My bill in a store came to £3.20 (GBP3.20), so I handed over £10.20. I was given back £16.90 in change! It turned out the cashier had entered £20.10 as the amount tendered. It was sorted out in the end. Sometimes its easier not to be bother making the

Re: Old Man Yells At Cloud

2017-09-19 Thread Frank Millman
"bartc" wrote in message news:EN6wB.770830$uh.63078@fx28.am4... On 19/09/2017 11:46, Larry Martell wrote: > > True story - the other day I was in a store and my total was $10.12. I > pulled out a $20, and the cashier (probably age 23 or so) immediately > entered $20 as the amount tendered. Then

Re: Old Man Yells At Cloud

2017-09-19 Thread bartc
On 19/09/2017 11:46, Larry Martell wrote: On Mon, Sep 18, 2017 at 11:23 PM, Dan Sommers wrote: How relevant is the "people use calculators to do arithmetic" argument today? Okay, so I'm old and cynical, but I know [young] people who don't (can't?) calculate a gratuity without an app or a web p

Re: Old Man Yells At Cloud

2017-09-19 Thread Larry Martell
On Mon, Sep 18, 2017 at 11:23 PM, Dan Sommers wrote: > How relevant is the "people use calculators to do arithmetic" argument > today? Okay, so I'm old and cynical, but I know [young] people who > don't (can't?) calculate a gratuity without an app or a web page. I use a calculator all the time -

Re: Old Man Yells At Cloud

2017-09-19 Thread Chris Angelico
On Tue, Sep 19, 2017 at 7:31 PM, Steven D'Aprano wrote: > On Tue, 19 Sep 2017 17:59:10 +1000, Chris Angelico wrote: > >> Aside from the backward compatibility concerns (which mean that this >> can't be done in a language that calls itself "Python"), I'm not seeing >> any reason that a human-friend

Re: Old Man Yells At Cloud

2017-09-19 Thread Steven D'Aprano
On Tue, 19 Sep 2017 17:59:10 +1000, Chris Angelico wrote: > Aside from the backward compatibility concerns (which mean that this > can't be done in a language that calls itself "Python"), I'm not seeing > any reason that a human-friendly language can't spend most of its time > working with arbitra

Re: Old Man Yells At Cloud

2017-09-19 Thread Chris Angelico
On Tue, Sep 19, 2017 at 5:07 PM, Steven D'Aprano wrote: > On Tue, 19 Sep 2017 03:23:15 +, Dan Sommers wrote: > >> On Tue, 19 Sep 2017 01:56:29 +, Stefan Ram wrote: >> >>> Steve D'Aprano writes: >> It is true that binary floats have some unexpected properties. They aren't the real

Re: Old Man Yells At Cloud

2017-09-19 Thread Steven D'Aprano
On Tue, 19 Sep 2017 03:23:15 +, Dan Sommers wrote: > On Tue, 19 Sep 2017 01:56:29 +, Stefan Ram wrote: > >> Steve D'Aprano writes: > >>>It is true that binary floats have some unexpected properties. They >>>aren't the real numbers that we learn in maths. But most people who >>>have been

Re: Old Man Yells At Cloud

2017-09-18 Thread Dan Sommers
On Tue, 19 Sep 2017 01:56:29 +, Stefan Ram wrote: > Steve D'Aprano writes: >>It is true that binary floats have some unexpected properties. They >>aren't the real numbers that we learn in maths. But most people who >>have been to school have years of experience with calculators training >>th

Re: Old Man Yells At Cloud

2017-09-18 Thread Steve D'Aprano
On Tue, 19 Sep 2017 12:31 am, Ben Bacarisse wrote: > Was the result of 1/2 determined > by a poll to find out what most people expected? No. It was determined by the fact that a decade or more of experience with the language demonstrated that the Python 2 behaviour was a terrible mistake and a co

Re: Old Man Yells At Cloud

2017-09-18 Thread Ben Bacarisse
bartc writes: > On 18/09/2017 15:04, Gregory Ewing wrote: >> Dennis Lee Bieber wrote: >>> Pascal >>> provides print()/println() [okay, not /statements/ but /procedures/] >> >> Actually write/writeln, and although they used parens like >> procedures, they had special syntax for output formatting >

Re: Old Man Yells At Cloud

2017-09-18 Thread Roel Schroeven
Steve D'Aprano schreef op 17/09/2017 20:49: On Mon, 18 Sep 2017 04:09 am, Tim Chase wrote: So, you don't like the extra parentheses with print. But you don't mind the parentheses in sys.stderr.write (16 chars, versus five for print) or having to manually concatenate the strings and manually add a

Re: Old Man Yells At Cloud

2017-09-18 Thread Roel Schroeven
Steve D'Aprano schreef op 17/09/2017 3:09: On Sun, 17 Sep 2017 04:00 am, Stefan Ram wrote: Steve D'Aprano writes: "Hi, I've been programming in Python for what seems like days now, and here's all the things that you guys are doing wrong. I never ever have written a line of Python 2. I star

Re: Old Man Yells At Cloud

2017-09-18 Thread Ben Bacarisse
Steve D'Aprano writes: > To answer your question, what do I mean by int/int being undefined, I'd have > to > dig into areas of maths that either weren't taught in the undergrad courses I > did, or that I've long since forgotten about. Something > about... fields? > This is a pretty specialised

Re: Old Man Yells At Cloud

2017-09-18 Thread bartc
On 18/09/2017 15:04, Gregory Ewing wrote: Dennis Lee Bieber wrote: Pascal provides print()/println() [okay, not /statements/ but /procedures/] Actually write/writeln, and although they used parens like procedures, they had special syntax for output formatting that wasn't available to user-defi

Re: Old Man Yells At Cloud

2017-09-18 Thread Ben Bacarisse
Steve D'Aprano writes: > [...] try something more common: > > 1/2 > > Most people aren't expecting integer division, but true division, and silently > returning the wrong result (0 instead of 0.5) is a silent source of > bugs. I'm the sure that expectation depends on their background and previou

Re: Old Man Yells At Cloud

2017-09-18 Thread Gregory Ewing
Dennis Lee Bieber wrote: Pascal provides print()/println() [okay, not /statements/ but /procedures/] Actually write/writeln, and although they used parens like procedures, they had special syntax for output formatting that wasn't available to user-defined procedures, so they were at least as sp

Re: Old Man Yells At Cloud

2017-09-18 Thread Thomas Jollans
On 2017-09-18 03:11, Rick Johnson wrote: > MRAB wrote: >> Rick Johnson wrote: >>> Steve D'Aprano wrote: Tim Golden wrote: [Snip: Reasons why print function is better than print statement] I've wanted to do all those things, and more. I love the new print function. For

Re: Old Man Yells At Cloud

2017-09-18 Thread bartc
On 18/09/2017 04:23, Steve D'Aprano wrote: On Mon, 18 Sep 2017 11:11 am, Rick Johnson wrote: Speaking in _keystrokes_, and that's what really matters here, a print function is always three more keystrokes than a print statement. Keystrokes only matter if you are hunt'n'peck typing and need to

Re: Old Man Yells At Cloud

2017-09-17 Thread Chris Angelico
On Mon, Sep 18, 2017 at 1:23 PM, Steve D'Aprano wrote: > On Mon, 18 Sep 2017 11:11 am, Rick Johnson wrote: > >> Speaking in _keystrokes_, and that's what really matters >> here, a print function is always three more keystrokes than >> a print statement. > > Keystrokes only matter if you are hunt'n

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
On Mon, 18 Sep 2017 11:11 am, Rick Johnson wrote: > Speaking in _keystrokes_, and that's what really matters > here, a print function is always three more keystrokes than > a print statement. Keystrokes only matter if you are hunt'n'peck typing and need to pause between holding down the shift key

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Chase
On 2017-09-18 01:41, INADA Naoki wrote: > > > That said, I'm neither here nor there when it comes to > > > using print-as-a-statement vs print-as-a-function. I like > > > the consistency it brings to the language, but miss the > > > simplicity that Py2 had for new users. I'd almost want to > > >

Re: Old Man Yells At Cloud

2017-09-17 Thread INADA Naoki
> > > > That said, I'm neither here nor there when it comes to > > using print-as-a-statement vs print-as-a-function. I like > > the consistency it brings to the language, but miss the > > simplicity that Py2 had for new users. I'd almost want to > > get it back as a feature of the REPL, even if

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
On Mon, 18 Sep 2017 09:15 am, Rick Johnson wrote: > On Sunday, September 17, 2017 at 9:42:34 AM UTC-5, Steve D'Aprano wrote: >> On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote: >> >> [Snip: Reasons why print function is better than print statement] >> >> I've wanted to do all those things, and mo

Re: Old Man Yells At Cloud

2017-09-17 Thread Rick Johnson
MRAB wrote: > Rick Johnson wrote: > > Steve D'Aprano wrote: > >> Tim Golden wrote: > > > > > > [Snip: Reasons why print function is better than print statement] > > > > > > I've wanted to do all those things, and more. I love the > > > new print function. For the cost of one extra character, > >

Re: Old Man Yells At Cloud

2017-09-17 Thread Christopher Reimer
> On Sep 17, 2017, at 2:19 PM, Ned Batchelder wrote: > >> On 9/16/17 1:38 AM, Steve D'Aprano wrote: >> /rant on >> >> So apparently everyone who disagrees that Python should be more like >> Javascript >> is an old greybeard fuddy-duddy yelling "Get off my lawn!" to the cool kids >> -- >> and i

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Chase
On 2017-09-17 16:15, Rick Johnson wrote: > > I've wanted to do all those things, and more. I love the > > new print function. For the cost of one extra character, > > the closing bracket, > > Oops, _two_ characters! What about the opening "bracket"? >>> print(len('print "hello"')) 13 >>>

Re: Old Man Yells At Cloud

2017-09-17 Thread MRAB
On 2017-09-18 00:15, Rick Johnson wrote: On Sunday, September 17, 2017 at 9:42:34 AM UTC-5, Steve D'Aprano wrote: On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote: [Snip: Reasons why print function is better than print statement] I've wanted to do all those things, and more. I love the new print

Re: Old Man Yells At Cloud

2017-09-17 Thread Rick Johnson
Steve D'Aprano wrote: > Tim Chase wrote: > > > On 2017-09-18 00:42, Steve D'Aprano wrote: > > > On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote: > > > Presumably you've never wanted to print to something > > > other than std.out. The syntax in Python 2 is horrid: > > > > > > print >>sys.stderr, ar

Re: Old Man Yells At Cloud

2017-09-17 Thread Rick Johnson
Tim Chase wrote: > Steve D'Aprano wrote: > > Tim Golden wrote: > > Presumably you've never wanted to print to something other > > than std.out. The syntax in Python 2 is horrid: > > > > print >>sys.stderr, args > > For those cases, the old syntax was sufficiently horrid > that indeed I didn't us

Re: Old Man Yells At Cloud

2017-09-17 Thread Rick Johnson
On Sunday, September 17, 2017 at 9:42:34 AM UTC-5, Steve D'Aprano wrote: > On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote: > > [Snip: Reasons why print function is better than print statement] > > I've wanted to do all those things, and more. I love the > new print function. For the cost of one e

Re: Old Man Yells At Cloud

2017-09-17 Thread Ned Batchelder
On 9/16/17 1:38 AM, Steve D'Aprano wrote: /rant on So apparently everyone who disagrees that Python should be more like Javascript is an old greybeard fuddy-duddy yelling "Get off my lawn!" to the cool kids -- and is also too stupid to know how dumb they are. "Hi, I've been programming in Pytho

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Chase
On 2017-09-17 14:16, bartc wrote: > print() is used for its side-effects; what relevant value does it > return? depending on the sink, errors can be returned (at least for the printf(3) C function). The biggest one I've encountered is writing to a full disk. The return value is how many characte

Re: Old Man Yells At Cloud

2017-09-17 Thread MRAB
On 2017-09-17 19:59, Chris Angelico wrote: On Mon, Sep 18, 2017 at 4:35 AM, Steve D'Aprano wrote: So why doesn't it return a fractions.Fraction instead? That way, you still get "one half" instead of zero, but it's guaranteed to be accurate. And having 1/3 be a literal meaning "one third" would

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Daneliuk
On 09/16/2017 09:59 AM, Tim Daneliuk wrote: > On 09/16/2017 12:38 AM, Steve D'Aprano wrote: >> /rant on >> >> So apparently everyone who disagrees that Python should be more like >> Javascript >> is an old greybeard fuddy-duddy yelling "Get off my lawn!" to the cool kids >> -- >> and is also too

Re: Old Man Yells At Cloud

2017-09-17 Thread Chris Angelico
On Mon, Sep 18, 2017 at 4:35 AM, Steve D'Aprano wrote: >> So why doesn't it return a fractions.Fraction instead? That way, you >> still get "one half" instead of zero, but it's guaranteed to be >> accurate. And having 1/3 be a literal meaning "one third" would avoid >> all the problems of "1/3 + 1

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
On Mon, 18 Sep 2017 04:09 am, Tim Chase wrote: > On 2017-09-18 00:42, Steve D'Aprano wrote: >> On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote: >> Presumably you've never wanted to print to something other than >> std.out. The syntax in Python 2 is horrid: >> >> print >>sys.stderr, args > > For t

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
On Mon, 18 Sep 2017 03:00 am, Chris Angelico wrote: >> The distinction between Python floats and real numbers ℝ is a red-herring. It >> isn't relevant. > > You said: > (I have a degree in maths, and if we ever covered areas where int/int was undefined, it was only briefly, and I've >>>

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Chase
On 2017-09-18 00:42, Steve D'Aprano wrote: > On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote: > Presumably you've never wanted to print to something other than > std.out. The syntax in Python 2 is horrid: > > print >>sys.stderr, args For those cases, the old syntax was sufficiently horrid that ind

Re: Old Man Yells At Cloud

2017-09-17 Thread Chris Angelico
On Sun, Sep 17, 2017 at 11:03 PM, Steve D'Aprano wrote: > On Sun, 17 Sep 2017 08:43 pm, Chris Angelico wrote: > >> On Sun, Sep 17, 2017 at 5:54 PM, Steve D'Aprano >> wrote: >>> To even *know* that there are branches of maths where int/int isn't defined, >>> you need to have learned aspects of mat

Re: Old Man Yells At Cloud

2017-09-17 Thread Larry Martell
On Sun, Sep 17, 2017 at 11:44 AM, Dennis Lee Bieber wrote: > The only pocket calculators I know of that have "integers" are those > with a "programmer's mode" -- ie; binary (displayed in > binary/octal/decimal/hex) but needing to be converted back to "normal" if > one wants to use them wit

Re: Old Man Yells At Cloud

2017-09-17 Thread bartc
On 17/09/2017 15:42, Steve D'Aprano wrote: On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote: Print-as-a-function removed one small simplicity Presumably you've never wanted to print to something other than std.out. Actually, no. (stderror is either a Unix-ism or C-ism, or some combination).

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote: > Print-as-a-function removed one small simplicity Presumably you've never wanted to print to something other than std.out. The syntax in Python 2 is horrid: print >>sys.stderr, args Presumably you've never wanted to print using a separator other

Re: Old Man Yells At Cloud

2017-09-17 Thread INADA Naoki
print >>sys.stderr, 'learn special syntax only for print?' print('you can use keword argument not only print', file=sys.stderr) p = functools.partial(print, file=sys.stderr) p('you can use other mechanizms for function') I never want to teach >> syntax for new people. On 2017年9月17日(日) 22:55 Abdu

Re: Old Man Yells At Cloud

2017-09-17 Thread Abdur-Rahmaan Janhangeer
ah the only thing i miss in py2 very sad and it was a well heralded arg in favour of py print "i miss you simple print" Abdur-Rahmaan Janhangeer, Mauritius abdurrahmaanjanhangeer.wordpress.com On 17 Sep 2017 17:50, "Tim Golden" wrote: > > > On 17/09/2017 14:34, breamore...@gmail.com wrote: > >

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Golden
On 17/09/2017 14:34, breamore...@gmail.com wrote: On Sunday, September 17, 2017 at 2:16:48 PM UTC+1, bartc wrote: print can also be used for debugging, when it might be written, deleted and added again hundreds of times. So writing all those brackets becomes irksome. 'print' needs to be easy

Re: Python built-ins versus Javascript [was Re: Old Man Yells At Cloud]

2017-09-17 Thread Abdur-Rahmaan Janhangeer
i use langages that uses py with so you have to wrap things in a function so that it will be called i'm tired telling beginners : hey don't forget to declare your globals don't forget don't forget and most of the time there are many ... well they just can't declare it in the func as they ha

Re: Old Man Yells At Cloud

2017-09-17 Thread Larry Martell
On Sun, Sep 17, 2017 at 9:34 AM, wrote: > Experienced Python programmers use the logging module for debugging, write > once, delete (maybe) never. I use pdb for debugging (but I also log a lot which helps with prod system when users report a problem). -- https://mail.python.org/mailman/listinf

Re: Old Man Yells At Cloud

2017-09-17 Thread breamoreboy
On Sunday, September 17, 2017 at 2:16:48 PM UTC+1, bartc wrote: > > print can also be used for debugging, when it might be written, deleted > and added again hundreds of times. So writing all those brackets becomes > irksome. 'print' needs to be easy to write. > > -- > bartc Experienced Pytho

Re: Old Man Yells At Cloud

2017-09-17 Thread bartc
On 17/09/2017 02:09, Steve D'Aprano wrote: On Sun, 17 Sep 2017 04:00 am, Stefan Ram wrote: Steve D'Aprano writes: "Hi, I've been programming in Python for what seems like days now, and here's all the things that you guys are doing wrong. I never ever have written a line of Python 2. I st

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
On Sun, 17 Sep 2017 08:43 pm, Chris Angelico wrote: > On Sun, Sep 17, 2017 at 5:54 PM, Steve D'Aprano > wrote: >> To even *know* that there are branches of maths where int/int isn't defined, >> you need to have learned aspects of mathematics that aren't even taught in >> most undergrad maths degr

Re: Unicode (was: Old Man Yells At Cloud)

2017-09-17 Thread Chris Angelico
On Sun, Sep 17, 2017 at 9:38 PM, Leam Hall wrote: > Still trying to keep this Py2 and Py3 compatible. > > The Py2 error is: > UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' > in position 8: ordinal not in range(128) > > even when the string is manually converted:

Re: Unicode (was: Old Man Yells At Cloud)

2017-09-17 Thread Paul Moore
On 17 September 2017 at 12:38, Leam Hall wrote: > On 09/17/2017 07:25 AM, Steve D'Aprano wrote: >> >> On Sun, 17 Sep 2017 08:03 pm, Leam Hall wrote: >> >>> I'm still trying to figure out how to convert a string to unicode in >>> Python 2. >> >> >> >> A Python 2 string is a string of bytes, so you

Unicode (was: Old Man Yells At Cloud)

2017-09-17 Thread Leam Hall
On 09/17/2017 07:25 AM, Steve D'Aprano wrote: On Sun, 17 Sep 2017 08:03 pm, Leam Hall wrote: I'm still trying to figure out how to convert a string to unicode in Python 2. A Python 2 string is a string of bytes, so you need to know what encoding they are in. Let's assume you got them from a

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
On Sun, 17 Sep 2017 08:03 pm, Leam Hall wrote: > I'm still trying to figure out how to convert a string to unicode in > Python 2. A Python 2 string is a string of bytes, so you need to know what encoding they are in. Let's assume you got them from a source using UTF-8. Then you would do: mystri

Python built-ins versus Javascript [was Re: Old Man Yells At Cloud]

2017-09-17 Thread Steve D'Aprano
On Sun, 17 Sep 2017 08:02 pm, Abdur-Rahmaan Janhangeer wrote: > as someone who really dislike js, i have to admit : python's globals are > really really bad ! > > js is a charm at that a real charm ! Can you explain what you think is so bad about them, and why Javascript's are better? -- Ste

  1   2   >