Re: [Python-ideas] Possible PEP regarding the use of the continue keyword in try/except blocks

2019-01-05 Thread Robert Collins
On Sun., 6 Jan. 2019, 13:39 Simon > I was writing some python code earlier, and I noticed that in a code that > looks somwhat like this one : > > try: > i = int("string") > print("continued on") > j = int(9.0) > except ValueError as e: > print(e) > > >>> "in

Re: [Python-ideas] Possible PEP regarding the use of the continue keyword in try/except blocks

2019-01-05 Thread Steven D'Aprano
On Sun, Jan 06, 2019 at 01:38:33AM +0100, Simon wrote: > I propose to be able to use the continue keyword to continue the execution > of the try block even when an error is handled. The above could then be > changed to : > > > try: > i = int("string") > print("continued on")

Re: [Python-ideas] 回复:Python-ideas Digest, Vol 146, Issue 13

2019-01-05 Thread Nathaniel Smith
On Sat, Jan 5, 2019 at 9:13 PM Moon丶sun wrote: > > Thanks for your reply. > But the answer is not I except, I will show you some examples to explain what > result I except: > > @contextmanager > def cm(): > print('open file') > yield > print('close file') > with cm(): > 1/0 > > If

[Python-ideas] 回复:Python-ideas Digest, Vol 146, Issue 13

2019-01-05 Thread Moon丶sun
table means. You say "Formatting > 1.23... * n" (multiplying by n) but the results shown aren't multiplied > by n=2, n=3, n=4 as the table suggests. > > Can you show what Python code you expect will produce the expected > output? fo

Re: [Python-ideas] Fixed point format for numbers with locale based separators

2019-01-05 Thread Eric V. Smith
On 1/5/2019 3:03 PM, Łukasz Stelmach wrote: Barry Scott writes: On Friday, 4 January 2019 14:57:53 GMT Łukasz Stelmach wrote: I would like to present two pull requests[1][2] implementing fixed point presentation of numbers and ask for comments. The first is mine. I learnt about the second aft

Re: [Python-ideas] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-05 Thread Dan Sommers
On 1/5/19 12:21 PM, Mike Miller wrote:> > On 1/5/19 12:34 AM, Ivan Levkivskyi wrote: > > > There is. Mypy supports final names, final methods and whatnot > > https://mypy.readthedocs.io/en/latest/final_attrs.html > > > Believe this^^ is the best answer, unfortunately buried. The type hinting is

Re: [Python-ideas] Possible PEP regarding the use of the continue keyword in try/except blocks

2019-01-05 Thread Richard Damon
On 1/5/19 7:38 PM, Simon wrote: > > I was writing some python code earlier, and I noticed that in a code > that looks somwhat like this one : > >     try: >         i = int("string") >         print("continued on") >         j = int(9.0) >     except ValueError as e: >         print(e) > > >>> "inv

[Python-ideas] Possible PEP regarding the use of the continue keyword in try/except blocks

2019-01-05 Thread Simon
I was writing some python code earlier, and I noticed that in a code that looks somwhat like this one : try: i = int("string") print("continued on") j = int(9.0) except ValueError as e: print(e) >>> "invalid literal for int() with base 10: 'string'" this c

Re: [Python-ideas] Fixed point format for numbers with locale based separators

2019-01-05 Thread Łukasz Stelmach
Barry Scott writes: > On Friday, 4 January 2019 14:57:53 GMT Łukasz Stelmach wrote: >> >> I would like to present two pull requests[1][2] implementing fixed point >> presentation of numbers and ask for comments. The first is mine. I >> learnt about the second after publishing mine. >> >> The only

Re: [Python-ideas] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-05 Thread Mike Miller
On 1/5/19 12:34 AM, Ivan Levkivskyi wrote: > There is. Mypy supports final names, final methods and whatnot > https://mypy.readthedocs.io/en/latest/final_attrs.html Believe this^^ is the best answer, unfortunately buried. Use typing hints for constants and tools that support them, and all-ca

Re: [Python-ideas] Fixed point format for numbers with locale based separators

2019-01-05 Thread Łukasz Stelmach
Steven D'Aprano writes: > On Fri, Jan 04, 2019 at 03:57:53PM +0100, Łukasz Stelmach wrote: >> Hi, >> >> I would like to present two pull requests[1][2] implementing fixed point >> presentation of numbers and ask for comments. The first is mine. I >> learnt about the second after publishing mine.

Re: [Python-ideas] Make the @contextmanager of contextlib to be a real contextmanager

2019-01-05 Thread Serhiy Storchaka
05.01.19 14:52, Moon丶sun пише: As we know,when we import the module--'contextlib',we can use the decorator '@contextmanager' and keyword ‘yield’ to make a 'instance' of Class '_GeneratorContextManager' in 'contextlib' module,then we can use it like: with 'instance' as 'xx':     'code block'

[Python-ideas] Make the @contextmanager of contextlib to be a real contextmanager

2019-01-05 Thread Moon丶sun
As we know,when we import the module--'contextlib',we can use the decorator '@contextmanager' and keyword ‘yield’ to make a 'instance' of Class '_GeneratorContextManager' in 'contextlib' module,then we can use it like:with 'instance' as 'xx':'code block'passBut there is a little bug,when

Re: [Python-ideas] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-05 Thread Abdur-Rahmaan Janhangeer
knowing this mailing list, i think there was not enough reasons for the no caps case while waiting for the emoji era, i think it stands good Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mauritius ___ Python-

Re: [Python-ideas] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-05 Thread Paul Moore
On Sat, 5 Jan 2019 at 00:05, Michael Foord wrote: > > On Fri, 4 Jan 2019 at 19:02, Abe Dillon wrote: >> >> I keep coming back to this great video about coding style, and one point in >> particular rings true to me: ALL_CAPS_IS_OBNOXIOUS > > I really like the convention. It's nice and clear and a

Re: [Python-ideas] Fixed point format for numbers with locale based separators

2019-01-05 Thread Barry Scott
On Friday, 4 January 2019 14:57:53 GMT Łukasz Stelmach wrote: > Hi, > > I would like to present two pull requests[1][2] implementing fixed point > presentation of numbers and ask for comments. The first is mine. I > learnt about the second after publishing mine. > > The only format using decimal

Re: [Python-ideas] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-05 Thread Łukasz Stelmach
Dnia January 5, 2019 12:09:44 AM UTC, Abe Dillon napisał(a): >> The whole point of the all-caps globals is to tell you a lot about what >> they are. > > A lot? The only thing it canonically tells you is to not modify it It also tells anyone, who is browsing a code, which values come from a spec

Re: [Python-ideas] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-05 Thread Ivan Levkivskyi
On Sat, 5 Jan 2019 at 02:46, David Mertz wrote: > Like everyone other than Abe in this thread, I find judicious use of > CONSTANTS to be highly readable and useful. > > Yes, there is a little wiggle room about just how constant a constant has > to be since Python doesn't have a straightforward wa