Re: requests.{get,post} timeout

2017-08-24 Thread dieter
Jon Ribbens writes: > On 2017-08-24, Chris Angelico wrote: >> On Thu, Aug 24, 2017 at 9:43 PM, Jon Ribbens >> wrote: >>> Where did you explain how it can be done without help? As far as I'm >>> aware, you can't close the socket without help since you can't get >>> access to it, and as you ment

Re: Reading the documentation

2017-08-24 Thread Paul Rubin
Chris Angelico writes: >> And there are numbers which repeat in decimal but not binary, > Which ones repeat in decimal but not binary? An example, please. That should really have said binary but not decimal, since 2 divides 10. -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading the documentation

2017-08-24 Thread Chris Angelico
On Fri, Aug 25, 2017 at 4:03 PM, Steve D'Aprano wrote: > On Fri, 25 Aug 2017 03:22 pm, Chris Angelico wrote: > >>> py> from decimal import Decimal >>> py> sum([1/13]*13) >>> 0.9998 >>> py> sum([Decimal(1)/Decimal(13)]*13) >>> Decimal('0.9997') >> >> Now do the s

Re: Reading the documentation

2017-08-24 Thread Steve D'Aprano
On Fri, 25 Aug 2017 03:22 pm, Chris Angelico wrote: >> py> from decimal import Decimal >> py> sum([1/13]*13) >> 0.9998 >> py> sum([Decimal(1)/Decimal(13)]*13) >> Decimal('0.9997') > > Now do the same exercise with pencil and paper. What's 1/13? Easy: 0.(076923

Re: Reading the documentation

2017-08-24 Thread Chris Angelico
On Fri, Aug 25, 2017 at 3:08 PM, Steve D'Aprano wrote: > On Fri, 25 Aug 2017 02:21 pm, Chris Angelico wrote: > >> In fact, the ONLY way to create this confusion is to use (some >> derivative of) one fifth, which is a factor of base 10 but not of base >> 2. Any other fraction will either terminate

Re: Reading the documentation

2017-08-24 Thread Gene Heskett
On Thursday 24 August 2017 23:21:22 Larry Martell wrote: > On Thu, Aug 24, 2017 at 11:08 PM, Rustom Mody wrote: > > On Friday, August 25, 2017 at 8:28:55 AM UTC+5:30, Ian wrote: > >> On Aug 24, 2017 8:51 PM, "Larry Martell" wrote: > >> > >> On Thu, Aug 24, 2017 at 9:21 PM Rustom Mody wrote: > >

Re: Reading the documentation

2017-08-24 Thread Steve D'Aprano
On Fri, 25 Aug 2017 02:21 pm, Chris Angelico wrote: > In fact, the ONLY way to create this confusion is to use (some > derivative of) one fifth, which is a factor of base 10 but not of base > 2. Any other fraction will either terminate in both bases (eg "0.125" > in decimal or "0.001" in binary),

Re: Reading the documentation

2017-08-24 Thread Rustom Mody
On Friday, August 25, 2017 at 10:18:07 AM UTC+5:30, Rustom Mody wrote: > On Friday, August 25, 2017 at 9:09:16 AM UTC+5:30, larry@gmail.com wrote: > > On Thu, Aug 24, 2017 at 11:27 PM, Rustom Mody wrote: > > > Chomsky is in the Turing bracket, I wonder where Larry falls wrt CS > > > > I have

Re: Reading the documentation

2017-08-24 Thread Chris Angelico
On Fri, Aug 25, 2017 at 2:37 PM, Rustom Mody wrote: > On Friday, August 25, 2017 at 9:58:15 AM UTC+5:30, Chris Angelico wrote: >> On Fri, Aug 25, 2017 at 1:23 PM, Rustom Mody wrote: >> > Early in my python classes I show this: >> > >> > $ python >> > Python 2.7.13 (default, Jan 19 2017, 14:48:08)

Re: Reading the documentation

2017-08-24 Thread Rustom Mody
On Friday, August 25, 2017 at 9:09:16 AM UTC+5:30, larry@gmail.com wrote: > On Thu, Aug 24, 2017 at 11:27 PM, Rustom Mody wrote: > > Chomsky is in the Turing bracket, I wonder where Larry falls wrt CS > > I have a degree in Software Engineering from Rochester Institute of > Technology. I star

Re: Reading the documentation

2017-08-24 Thread Rustom Mody
On Friday, August 25, 2017 at 9:58:15 AM UTC+5:30, Chris Angelico wrote: > On Fri, Aug 25, 2017 at 1:23 PM, Rustom Mody wrote: > > Early in my python classes I show this: > > > > $ python > > Python 2.7.13 (default, Jan 19 2017, 14:48:08) > > [GCC 6.3.0 20170118] on linux2 > > Type "help", "copyrig

Re: Reading the documentation

2017-08-24 Thread Chris Angelico
On Fri, Aug 25, 2017 at 1:23 PM, Rustom Mody wrote: > Early in my python classes I show this: > > $ python > Python 2.7.13 (default, Jan 19 2017, 14:48:08) > [GCC 6.3.0 20170118] on linux2 > Type "help", "copyright", "credits" or "license" for more information. .1 + .1 == .2 > True .1 +

Re: Proposed new syntax

2017-08-24 Thread Chris Angelico
On Fri, Aug 25, 2017 at 2:10 PM, Paul Rubin wrote: > Steve D'Aprano writes: >> Did __next__ cache the most recently generated value? > > No but if they're going to change stuff, they might as well actually > improve it instead of just renaming it to break code gratutiously. Any code that called

Re: Proposed new syntax

2017-08-24 Thread Paul Rubin
Steve D'Aprano writes: > Did __next__ cache the most recently generated value? No but if they're going to change stuff, they might as well actually improve it instead of just renaming it to break code gratutiously. -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading the documentation

2017-08-24 Thread Rustom Mody
On Friday, August 25, 2017 at 9:06:53 AM UTC+5:30, Steve D'Aprano wrote: > On Fri, 25 Aug 2017 01:27 pm, Rustom Mody wrote: > > > People should be free to dislike who they like to dislike > > However… > > Calling Newton an idiot is ok… if you are not a physicist (flat-earther??) > > Calling Turing

Re: Reading the documentation

2017-08-24 Thread Larry Martell
On Thu, Aug 24, 2017 at 11:27 PM, Rustom Mody wrote: > Chomsky is in the Turing bracket, I wonder where Larry falls wrt CS I have a degree in Software Engineering from Rochester Institute of Technology. I stared programming when I was 16, and I have worked professionally since I was 19. I am 57 n

Re: Reading the documentation

2017-08-24 Thread Steve D'Aprano
On Fri, 25 Aug 2017 01:27 pm, Rustom Mody wrote: > People should be free to dislike who they like to dislike > However… > Calling Newton an idiot is ok… if you are not a physicist (flat-earther??) > Calling Turing an idiot is ok if you dont like computers (Luddite??) > Given that for most people w

Re: Proposed new syntax

2017-08-24 Thread Steve D'Aprano
On Fri, 25 Aug 2017 01:19 pm, Paul Rubin wrote: > Steve D'Aprano writes: >> the public API is to call the next() built-in function, and the >> implementation is the __next__ dunder. > > In that case it would have been nice to make next() cache the most > recently generated value from the iterato

Re: Reading the documentation

2017-08-24 Thread Steve D'Aprano
On Fri, 25 Aug 2017 11:25 am, Ben Bacarisse wrote: >> Integral \In"te*gral\, a. [Cf. F. int['e]gral. See Integer.] > > For me (and I suspect for BG too) the surprise is in its use as a noun. > The capital letter is, presumably, significant because it refers to the > Python class Integral -- a sub

Re: Reading the documentation

2017-08-24 Thread Rustom Mody
On Friday, August 25, 2017 at 8:52:11 AM UTC+5:30, Steve D'Aprano wrote: > On Fri, 25 Aug 2017 12:47 pm, Larry Martell wrote: > > > On Thu, Aug 24, 2017 at 9:21 PM Rustom Mody wrote: > > > >> Statement 1: Aeroplanes fly > >> Statement 2: Submarines swim > >> > >> > >> Are these two statements equ

Re: Reading the documentation

2017-08-24 Thread Steve D'Aprano
On Fri, 25 Aug 2017 01:08 pm, Rustom Mody wrote: > On Friday, August 25, 2017 at 8:28:55 AM UTC+5:30, Ian wrote: >> On Aug 24, 2017 8:51 PM, "Larry Martell" wrote: >> >> On Thu, Aug 24, 2017 at 9:21 PM Rustom Mody wrote: >> >> > Statement 1: Aeroplanes fly >> > Statement 2: Submarines swim >> >

Re: Reading the documentation

2017-08-24 Thread Rustom Mody
On Friday, August 25, 2017 at 8:39:25 AM UTC+5:30, Rustom Mody wrote: > On Friday, August 25, 2017 at 8:28:55 AM UTC+5:30, Ian wrote: > > On Aug 24, 2017 8:51 PM, "Larry Martell" wrote: > > > > On Thu, Aug 24, 2017 at 9:21 PM Rustom Mody wrote: > > > > > Statement 1: Aeroplanes fly > > > Stateme

Re: Reading the documentation

2017-08-24 Thread Steve D'Aprano
On Fri, 25 Aug 2017 12:47 pm, Larry Martell wrote: > On Thu, Aug 24, 2017 at 9:21 PM Rustom Mody wrote: > >> Statement 1: Aeroplanes fly >> Statement 2: Submarines swim >> >> >> Are these two statements equally acceptable? >> >> [Inspired by a talk by Noam Chomsky] > > There should be a corolla

Re: Reading the documentation

2017-08-24 Thread Larry Martell
On Thu, Aug 24, 2017 at 11:08 PM, Rustom Mody wrote: > On Friday, August 25, 2017 at 8:28:55 AM UTC+5:30, Ian wrote: >> On Aug 24, 2017 8:51 PM, "Larry Martell" wrote: >> >> On Thu, Aug 24, 2017 at 9:21 PM Rustom Mody wrote: >> >> > Statement 1: Aeroplanes fly >> > Statement 2: Submarines swim >>

Re: Proposed new syntax

2017-08-24 Thread Paul Rubin
Steve D'Aprano writes: > the public API is to call the next() built-in function, and the > implementation is the __next__ dunder. In that case it would have been nice to make next() cache the most recently generated value from the iterator. That would make lots of code simpler. -- https://mail.

Re: Reading the documentation

2017-08-24 Thread Rustom Mody
On Friday, August 25, 2017 at 8:28:55 AM UTC+5:30, Ian wrote: > On Aug 24, 2017 8:51 PM, "Larry Martell" wrote: > > On Thu, Aug 24, 2017 at 9:21 PM Rustom Mody wrote: > > > Statement 1: Aeroplanes fly > > Statement 2: Submarines swim > > > > > > Are these two statements equally acceptable? > > >

Re: Reading the documentation

2017-08-24 Thread Ian Kelly
On Aug 24, 2017 8:51 PM, "Larry Martell" wrote: On Thu, Aug 24, 2017 at 9:21 PM Rustom Mody wrote: > Statement 1: Aeroplanes fly > Statement 2: Submarines swim > > > Are these two statements equally acceptable? > > [Inspired by a talk by Noam Chomsky] There should be a corollary of Godwin's la

Re: Reading the documentation

2017-08-24 Thread MRAB
On 2017-08-25 02:58, Ben Bacarisse wrote: Chris Angelico writes: On Fri, Aug 25, 2017 at 11:25 AM, Ben Bacarisse wrote: The use as a noun is not covered here, though it is only a small step from other places where membership of a mathematical set has turned the adjective into a noun. "Ratio

Re: Reading the documentation

2017-08-24 Thread Larry Martell
On Thu, Aug 24, 2017 at 9:21 PM Rustom Mody wrote: > Statement 1: Aeroplanes fly > Statement 2: Submarines swim > > > Are these two statements equally acceptable? > > [Inspired by a talk by Noam Chomsky] There should be a corollary of Godwin's law for that idiot. -- https://mail.python.org/mail

Re: Reading the documentation

2017-08-24 Thread Rustom Mody
On Friday, August 25, 2017 at 6:55:46 AM UTC+5:30, Ben Bacarisse wrote: > Steve D'Aprano writes: > > > On Fri, 25 Aug 2017 09:41 am, bob gailer wrote: > > > >>> Help on built-in function floor in module math: > >>> > >>> floor(...) > >>> floor(x) > >>> > >>> Return the floor of x as an I

Re: Reading the documentation

2017-08-24 Thread Chris Angelico
On Fri, Aug 25, 2017 at 11:58 AM, Ben Bacarisse wrote: > Chris Angelico writes: > >> On Fri, Aug 25, 2017 at 11:25 AM, Ben Bacarisse wrote: >>> The use as a noun is not covered here, though it is only a small step >>> from other places where membership of a mathematical set has turned the >>> ad

Re: Reading the documentation

2017-08-24 Thread Ben Bacarisse
Chris Angelico writes: > On Fri, Aug 25, 2017 at 11:25 AM, Ben Bacarisse wrote: >> The use as a noun is not covered here, though it is only a small step >> from other places where membership of a mathematical set has turned the >> adjective into a noun. "Rational" and "real" started out as adje

Re: Reading the documentation

2017-08-24 Thread Chris Angelico
On Fri, Aug 25, 2017 at 11:25 AM, Ben Bacarisse wrote: > The use as a noun is not covered here, though it is only a small step > from other places where membership of a mathematical set has turned the > adjective into a noun. "Rational" and "real" started out as adjectives, > but their use as nou

Re: Reading the documentation

2017-08-24 Thread Ben Bacarisse
Steve D'Aprano writes: > On Fri, 25 Aug 2017 09:41 am, bob gailer wrote: > >>> Help on built-in function floor in module math: >>> >>> floor(...) >>> floor(x) >>> >>> Return the floor of x as an Integral. >>> This is the largest integer <= x. > [...] > >> I was surprised by the use

Re: requests.{get,post} timeout

2017-08-24 Thread Chris Angelico
On Fri, Aug 25, 2017 at 10:42 AM, Jon Ribbens wrote: > On 2017-08-24, Chris Angelico wrote: >> Only in the sense that "kill" is the Unix term for "send signal". >> Python catches the signal, the system call terminates with EINTR, and >> the exception is raised. Give it a try. > > Give what a try?

Re: requests.{get,post} timeout

2017-08-24 Thread Jon Ribbens
On 2017-08-24, Chris Angelico wrote: > On Fri, Aug 25, 2017 at 12:17 AM, Jon Ribbens > wrote: >> On 2017-08-24, Chris Angelico wrote: >>> On Thu, Aug 24, 2017 at 9:43 PM, Jon Ribbens >>> wrote: Where did you explain how it can be done without help? As far as I'm aware, you can't clo

Re: Reading the documentation

2017-08-24 Thread Steve D'Aprano
On Fri, 25 Aug 2017 05:24 am, Stefan Ram wrote: > Is the output of »help(floor)« supposed to be a kind of > normative documentation, i.e., /the/ authoritative > documentation of »floor«? No. The output of help() is intended as a short description of the function, not the authoritative and c

Re: id

2017-08-24 Thread Steve D'Aprano
On Fri, 25 Aug 2017 12:42 am, Stefan Ram wrote: > i = 0 > while True: print( f"{ i }:{ id( i )}" ); i = i + 1 > > This loop prints increasing ids while i is less than > 257, and then it starts to print alternating ids. Try running it under Jython or IronPython. Try running it starting with

Re: Reading the documentation

2017-08-24 Thread Steve D'Aprano
On Fri, 25 Aug 2017 09:41 am, bob gailer wrote: >> Help on built-in function floor in module math: >> >> floor(...) >> floor(x) >> >> Return the floor of x as an Integral. >> This is the largest integer <= x. [...] > I was surprised by the use of "integral". A dictionary search doe

Re: Reading the documentation

2017-08-24 Thread bob gailer
On 8/24/2017 3:24 PM, Stefan Ram wrote: This is a transcript: from math import floor floor( "2.3" ) Traceback (most recent call last): File "", line 1, in TypeError: must be real number, not str help(floor) Help on built-in function floor in module math: floor(...) floor(x)

Re: pypinfo: CLI to easily view PyPI download statistics via Google's BigQuery.

2017-08-24 Thread ofekmeister
If you ever want to quickly check your package's downloads counts or wish to know more about your users, I'd really recommend this! -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading the documentation

2017-08-24 Thread bob gailer
On 8/24/2017 3:54 PM, Nathan Ernst wrote: You passed a string to "math.floor", not anything resembling a numeric type. Try using an actual float, int or Decimal: It would seem you did not understand the OP's question. It was not "why did I get this traceback." He showed the traceback as leading

Re: A question on modification of a list via a function invocation

2017-08-24 Thread Ben Bacarisse
Steve D'Aprano writes: It took a while to reply, and when I got round it I could not find anything new that seemed to be worth saying. I think we've both stated our positions quite well. I don't think we will end up in agreement, and whilst I can grumble and nit-pick as well as anyone, with th

Re: requests.{get,post} timeout

2017-08-24 Thread breamoreboy
On Thursday, August 24, 2017 at 5:02:12 PM UTC+1, Chris Angelico wrote: > > (Caveat: I have no idea how this works on Windows. I do expect, > though, that it will abort the connection without terminating the > process, just like it does on Unix.) > > ChrisA There was a big thread "cross platform

Re: Reading the documentation

2017-08-24 Thread Peter Otten
Stefan Ram wrote: > This is a transcript: > from math import floor floor( "2.3" ) > Traceback (most recent call last): > File "", line 1, in > TypeError: must be real number, not str help(floor) > Help on built-in function floor in module math: > > floor(...) > floor(x) >

Re: Reading the documentation

2017-08-24 Thread MRAB
On 2017-08-24 20:24, Stefan Ram wrote: This is a transcript: from math import floor floor( "2.3" ) Traceback (most recent call last): File "", line 1, in TypeError: must be real number, not str help(floor) Help on built-in function floor in module math: floor(...) floor(x)

Re: Reading the documentation

2017-08-24 Thread Nathan Ernst
You passed a string to "math.floor", not anything resembling a numeric type. Try using an actual float, int or Decimal: Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from math import floor >>>

Re: requests.{get,post} timeout

2017-08-24 Thread Chris Angelico
On Fri, Aug 25, 2017 at 5:07 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Fri, Aug 25, 2017 at 3:40 AM, Marko Rauhamaa wrote: >>> Signals are an arcane Unix communication method. I strongly recommend >>> against using signals for anything but terminating a process, and even >>> then you h

Re: requests.{get,post} timeout

2017-08-24 Thread Marko Rauhamaa
Chris Angelico : > On Fri, Aug 25, 2017 at 3:40 AM, Marko Rauhamaa wrote: >> Signals are an arcane Unix communication method. I strongly recommend >> against using signals for anything but terminating a process, and even >> then you have to be extra careful. >> >> I have seen code that uses signa

Re: id

2017-08-24 Thread alister via Python-list
On Thu, 24 Aug 2017 11:21:27 -0400, Ned Batchelder wrote: > On 8/24/17 10:42 AM, Stefan Ram wrote: >> i = 0 while True: print( f"{ i }:{ id( i )}" ); i = i + 1 >> >> This loop prints increasing ids while i is less than 257, and then it >> starts to print alternating ids. >> >> So this seems

Re: requests.{get,post} timeout

2017-08-24 Thread Chris Angelico
On Fri, Aug 25, 2017 at 3:40 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Fri, Aug 25, 2017 at 12:17 AM, Jon Ribbens >> wrote: >>> By that, do you mean "kill the process"? That's obviously not a >>> sensible answer in general, especially given we were including >>> processes which have no

Re: requests.{get,post} timeout

2017-08-24 Thread Marko Rauhamaa
Chris Angelico : > On Fri, Aug 25, 2017 at 12:17 AM, Jon Ribbens > wrote: >> By that, do you mean "kill the process"? That's obviously not a >> sensible answer in general, especially given we were including >> processes which have no terminal or user sitting there watching them. > > Only in the s

Re: requests.{get,post} timeout

2017-08-24 Thread Chris Angelico
On Fri, Aug 25, 2017 at 12:17 AM, Jon Ribbens wrote: > On 2017-08-24, Chris Angelico wrote: >> On Thu, Aug 24, 2017 at 9:43 PM, Jon Ribbens >> wrote: >>> Where did you explain how it can be done without help? As far as I'm >>> aware, you can't close the socket without help since you can't get >

Re: Proposed new syntax

2017-08-24 Thread Antoon Pardon
Op 24-08-17 om 04:02 schreef Steve D'Aprano: > > Unfortunately the interwebs are full of people, even mathematicians, that > have a > lot of misapprehensions and misunderstandings of Gödel's Incompleteness > Theorems. For example, there's a comment here: > > "It's easy to prove that ZFC is consist

Re: id

2017-08-24 Thread Ned Batchelder
On 8/24/17 10:42 AM, Stefan Ram wrote: > i = 0 > while True: print( f"{ i }:{ id( i )}" ); i = i + 1 > > This loop prints increasing ids while i is less than > 257, and then it starts to print alternating ids. > > So this seems to indicate that temporary objects are > created for large inte

Re: requests.{get,post} timeout

2017-08-24 Thread Jon Ribbens
On 2017-08-24, Chris Angelico wrote: > On Thu, Aug 24, 2017 at 9:43 PM, Jon Ribbens > wrote: >> Where did you explain how it can be done without help? As far as I'm >> aware, you can't close the socket without help since you can't get >> access to it, and as you mentioned even if you were to do

Re: requests.{get,post} timeout

2017-08-24 Thread Chris Angelico
On Thu, Aug 24, 2017 at 9:43 PM, Jon Ribbens wrote: > On 2017-08-23, Chris Angelico wrote: >> On Thu, Aug 24, 2017 at 8:54 AM, Jon Ribbens >> wrote: >>> On 2017-08-23, Chris Angelico wrote: Yes and no. If requests provided a 'cancel query' feature, it would play nicely with everythin

Re: Cross-language comparison: function map and similar

2017-08-24 Thread Steve D'Aprano
On Thu, 17 Aug 2017 12:53 am, Steve D'Aprano wrote: [...] > Are there language implementations which evaluate the result of map() (or its > equivalent) in some order other than the obvious left-to-right first-to-last > sequential order? Is that order guaranteed by the language, or is it an > imple

Re: Proposed new syntax

2017-08-24 Thread Steve D'Aprano
On Thu, 24 Aug 2017 06:21 pm, Paul Rubin wrote: > Peter Otten <__pete...@web.de> writes: >> Python 3 where the next() method has been renamed to __next__(). > > Oh cripes, you're right, it never occurred to me that py3 had broken > .next(). I thought it was called .next() instead of .__next() >

Re: requests.{get,post} timeout

2017-08-24 Thread Jon Ribbens
On 2017-08-23, Chris Angelico wrote: > On Thu, Aug 24, 2017 at 8:54 AM, Jon Ribbens > wrote: >> On 2017-08-23, Chris Angelico wrote: >>> Yes and no. If requests provided a 'cancel query' feature, it would >>> play nicely with everything else, but (a) the entire concept here is >>> that the requ

Re: Proposed new syntax

2017-08-24 Thread Ben Finney
Chris Angelico writes: > On Thu, Aug 24, 2017 at 8:40 PM, Ben Finney > wrote: > > Paul Rubin writes: > >> Is something wrong with: > >> > >> >>> g = itertools.count().next > > It's on all iterators; it's the Py2 equivalent for __next__. Yeah, when people are talking today about “Python”,

Re: Proposed new syntax

2017-08-24 Thread Chris Angelico
On Thu, Aug 24, 2017 at 8:40 PM, Ben Finney wrote: > Paul Rubin writes: > >> Ben Finney writes: >> > generate_id = functools.partial(next, itertools.count()) >> >> Is something wrong with: >> >> >>> g = itertools.count().next > > I wasn't looking for a ‘next’ method on the iterator. Is t

Re: Proposed new syntax

2017-08-24 Thread Ben Finney
Paul Rubin writes: > Ben Finney writes: > > generate_id = functools.partial(next, itertools.count()) > > Is something wrong with: > > >>> g = itertools.count().next I wasn't looking for a ‘next’ method on the iterator. Is that special to the ‘itertools.count’ type? If so, I was attempt

Re: Proposed new syntax

2017-08-24 Thread Marko Rauhamaa
Paul Rubin : > Ben Finney writes: >> generate_id = functools.partial(next, itertools.count()) > > Is something wrong with: > > >>> g = itertools.count().next I don't like lambda in Python. However, I like it better than functools.partial. Best of all, define an inner function. Marko -

Re: Proposed new syntax

2017-08-24 Thread Paul Rubin
Peter Otten <__pete...@web.de> writes: > Python 3 where the next() method has been renamed to __next__(). Oh cripes, you're right, it never occurred to me that py3 had broken .next(). I thought it was called .next() instead of .__next() so that it wouldn't be a dunder method. -- https://mail.pyt

Re: Proposed new syntax

2017-08-24 Thread Peter Otten
Paul Rubin wrote: > Ben Finney writes: >> generate_id = functools.partial(next, itertools.count()) > > Is something wrong with: > > >>> g = itertools.count().next That question seems to be the topic of this subthread. Other than the principle "never call a dunder method" (that I do no

Re: Proposed new syntax

2017-08-24 Thread Paul Rubin
Steve D'Aprano writes: > I've read a few people claim that disallowing multiplication from > standard arithmetic renders it weak enough that you can prove it > complete and correct, but since they give no proof or even evidence I > have my doubts. That system is called Presburger arithmetic (see

Re: Proposed new syntax

2017-08-24 Thread Chris Angelico
On Thu, Aug 24, 2017 at 5:47 PM, Paul Rubin wrote: > Ben Finney writes: >> generate_id = functools.partial(next, itertools.count()) > > Is something wrong with: > > >>> g = itertools.count().next > >>> g() > 0 > >>> g() > 1 > >>> g() > 2 > >>> ... That's the P

Re: Proposed new syntax

2017-08-24 Thread Paul Rubin
Ben Finney writes: > generate_id = functools.partial(next, itertools.count()) Is something wrong with: >>> g = itertools.count().next >>> g() 0 >>> g() 1 >>> g() 2 >>> ... -- https://mail.python.org/mailman/listinfo/python-list