[issue39301] Specification of bitshift on integers should clearly state floor division used

2020-05-23 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 3.0 -> 4.0
pull_requests: +19610
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/20347

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Strings: double versus single quotes

2020-05-23 Thread Frank Millman

On 2020-05-23 9:45 PM, DL Neil via Python-list wrote:


My habit with SQL queries is to separate them from other code, cf the 
usual illustration of having them 'buried' within the code, immediately 
before, or even part of, the query call.




I like that idea, as I find that I am embedding more and more SQL in my 
code.


How do you handle parameters? Do you leave placeholders ('?' or '%s') in 
the query, and leave it to the 'importer' of the query to figure out 
what is required?


Frank Millman


--
https://mail.python.org/mailman/listinfo/python-list


Re: Strings: double versus single quotes

2020-05-23 Thread Abdur-Rahmaan Janhangeer
Kind Regards,

Abdur-Rahmaan Janhangeer
compileralchemy  | blog

github 
Mauritius


On Sun, May 24, 2020 at 12:03 AM DL Neil via Python-list <
python-list@python.org> wrote:

>
> I'm highly amused by this interchange - for two reasons: that you'd
> noticed these details, and that I hadn't!
>

Yes Mr Chris is good for coming on with these kind of points ^^_


>
> Yes, I'd noted that the REPL responds with single-quotes, even if I used
> double-quotes in the definition (per "single of double", above) - for
> whatever that's worth (it's not as if the delimiters are stored along
> with other variable detail!)
>
> That the REPL is 'intelligent' about its choice to vary the delimiter to
> suit the content is good (design) sense - the best presentation (UX), ie
> doesn't is a better presentation than doesn\'t!
>
> Which brings me to my own, humble, and quite often non-PEP-8-respecting
> habits: that I (basically) apply the ?rules of English grammar to Python
> (which I write (mostly) in English). Thus a "quotation", eg someone's
> name, but any piece of data, will be enclosed in double-quotes:
>
> name = "Abdur-Rahman"
>
> whereas, when something will be 'calculated', I use singles, eg
>
> f'{ name } is top of the class'
>

This discussion dives a bit further into the philosophy
of Python.  Must reactivate the FaQ repo project.
Mr Barker is doing it for python-ideas.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strings: double versus single quotes

2020-05-23 Thread Abdur-Rahmaan Janhangeer
Greetings,

Nice idea

>>> '''You said "No it doesn't"'''
'You said "No it doesn\'t"'

Kind Regards,

Abdur-Rahmaan Janhangeer
compileralchemy  | blog

github 
Mauritius


On Sun, May 24, 2020 at 9:05 AM Manfred Lotz  wrote:

> On Sat, 23 May 2020 14:46:04 -0400
> Dennis Lee Bieber  wrote:
>
> > On Sat, 23 May 2020 11:03:09 -0500, Tim Chase
> >  declaimed the following:
> >
> >
> > >
> > >But when a string contains both, it biases towards single quotes:
> > >
> > >   >>> "You said \"No it doesn't\""
> > >   'You said "No it doesn\'t"'
> >
> >   This is where using triple quotes (or triple apostrophes)
> > around the entire thing simplifies it all... (except for a need to
> > separate the four ending quotes)
>
> Exactly, I also would opt for triple quotes in this case.
>
> >
> > >>> """You said "No it doesn't" """
> > 'You said "No it doesn\'t" '
> > >>> '''You said "No it doesn't"'''
> > 'You said "No it doesn\'t"'
> > >>>
> >
> >   NO \ escapes needed on the input strings.
> >
> > >>> print("""You said "No it doesn't" """)
> > You said "No it doesn't"
> > >>> print('''You said "No it doesn't"''')
> > You said "No it doesn't"
> > >>>
> >
> >
>
>
> --
> Manfred
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strings: double versus single quotes

2020-05-23 Thread Manfred Lotz
On Sat, 23 May 2020 14:46:04 -0400
Dennis Lee Bieber  wrote:

> On Sat, 23 May 2020 11:03:09 -0500, Tim Chase
>  declaimed the following:
> 
> 
> >
> >But when a string contains both, it biases towards single quotes:
> >  
> >   >>> "You said \"No it doesn't\""  
> >   'You said "No it doesn\'t"'  
> 
>   This is where using triple quotes (or triple apostrophes)
> around the entire thing simplifies it all... (except for a need to
> separate the four ending quotes)

Exactly, I also would opt for triple quotes in this case. 

> 
> >>> """You said "No it doesn't" """  
> 'You said "No it doesn\'t" '
> >>> '''You said "No it doesn't"'''  
> 'You said "No it doesn\'t"'
> >>>   
> 
>   NO \ escapes needed on the input strings.
> 
> >>> print("""You said "No it doesn't" """)  
> You said "No it doesn't" 
> >>> print('''You said "No it doesn't"''')  
> You said "No it doesn't"
> >>>   
> 
> 


-- 
Manfred

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: stderr writting before stdout

2020-05-23 Thread Souvik Dutta
Also this code maintains order i.e. writting is displayed before no errors.
Why is that?

import sys
sys.stdout.write("Writting \n")
sys.stderr.write("No errors \n")

On Sun, 24 May, 2020, 9:57 am Souvik Dutta,  wrote:

> Hi,
> Is there any precedence or priority order by which sys.stderr.write() and
> sys.stdout.write() works. Because when running the below code...
>
> import sys
> sys.stdout.write("Writting")
> sys.stderr.write("No errors \n")
>
> No errors is written (displayed) first and writting is written later. Why
> does this happen?
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38787] PEP 573: Module State Access from C Extension Methods

2020-05-23 Thread hai shi


Change by hai shi :


--
pull_requests: +19609
pull_request: https://github.com/python/cpython/pull/20344

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Enums are Singletons - but not always?

2020-05-23 Thread Terry Reedy

On 5/23/2020 2:21 PM, Ralf M. wrote:


# Code of mod1.py #
import enum, mod2
class En(enum.Enum):
     A = 1
     B = 2
def main():
     a = mod2.getA()
     print("a is En.A:", a is En.A)
     print("a:", repr(a), "    En.A:", repr(En.A))
     print("id(a), id(a.__class__)", id(a), id(a.__class__))
     print("id(En.A), id(En)  ", id(En.A), id(En))
if __name__ == "__main__":
     main()


> # Code of mod2.py #
> import mod1
> def getA():
> return mod1.En.A

As a couple of people mentioned, the issue is the circular import.  When 
you run mod1 from a command line, its name is __main__.  Its execution 
of mod1 code stops to execute enum code and then mod2 code.


Execution of mod2 stops to execute mod1 code in a new module named 
'mod1'.  When the second execution of mod1 code does the import of enum 
and mod2, sys.modules['enum'] and sys.modules['mod2'] exist, are found, 
and used to satify the import.  So enum and mod2 code are not executed 
again.  In the 'mod1' module, 'mod2' is linked to the *incomplete* mod2. 
 This 'works' in your code because the reference to mod2 within def 
main is not used because the name is 'mod1', not '__main__'.  But if in 
mod1, you had written


import enum
from mod2 import getA

the second execution of mod1 would fail because mod2.getA does not exist 
because execution of mod2 is paused to import mod1


When the mod1 import in mod2 finishes, the execution of mod2 code for 
'mod2' finishes without issue.  Then the execution of 'mod1' code in 
'__main__' finishes with the call to main.


When you instead interactively import mod1, it is executed just once and 
you have to explicitly call main.


In idlelib, pyshell currently has the IDLE Shell code, the main() 
function, and a couple of classes used elsewhere.  (An atrocious design 
that I inherited and have only partly fixed.)  As a *temporary* fix to 
an issue due to there being  duplicate '__main__' and 'pyshell' modules, 
I added the following to the top of pyshell.


import sys
if __name__ == "__main__":
sys.modules['idlelib.pyshell']=sys.modules['__main__']

But doing what others suggested, limiting the main or start module to 
one-time code, is better.



--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list


[issue40751] command 'elif' does not work

2020-05-23 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

You're indenting elif inside if clause. The elif should be of same indentation 
length like if condition.

--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40751] command 'elif' does not work

2020-05-23 Thread Jonny Li


Change by Jonny Li :


Added file: https://bugs.python.org/file49189/Screen Shot 2020-05-24 at 
10.56.10.png

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40751] command 'elif' does not work

2020-05-23 Thread Jonny Li


Change by Jonny Li :


--
assignee: terry.reedy
components: IDLE
files: Screen Shot 2020-05-24 at 10.56.55.png
nosy: Jonny Li, terry.reedy
priority: normal
severity: normal
status: open
title: command 'elif' does not work
type: compile error
versions: Python 3.8
Added file: https://bugs.python.org/file49188/Screen Shot 2020-05-24 at 
10.56.55.png

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Strings: double versus single quotes

2020-05-23 Thread Souvik Dutta
This seems to be a life long debate...

On Sun, 24 May, 2020, 5:25 am Tim Chase, 
wrote:

> On 2020-05-23 14:46, Dennis Lee Bieber wrote:
> > On Sat, 23 May 2020 11:03:09 -0500, Tim Chase
> > >But when a string contains both, it biases towards single quotes:
> > >
> > >   >>> "You said \"No it doesn't\""
> > >   'You said "No it doesn\'t"'
> >
> >   This is where using triple quotes (or triple apostrophes)
> > around the entire thing simplifies it all... (except for a need to
> > separate the four ending quotes)
>
> Unless you're pathological. ;-)
>
> >>> """I said "This contain every type of \"""Python\"""
> '''triple-quoted''' string, doesn't it?\
> 'I said "This contains every type of """Python"""
> \'\'\'triple-quoted\'\'\' string, doesn\'t it."'
>
> And-you-can-quote-me-on-that'ly yers,
>
> -tkc
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40160] documentation example of os.walk should be less destructive

2020-05-23 Thread Kyle Stanley


Kyle Stanley  added the comment:

> I made the suggested change to just print the os.remove() statements (instead 
> of executing them) and also removed the 'skip news'.

I think you may have misunderstood the suggestion. 

Specifically, the key part was "I would suggest adding succinct comments or a 
note that very briefly explains how one could see a visual demonstration...". 
This would mean the actual code in the example would be *unchanged*, but with a 
new code comment or separate note after the example that explains how one could 
replace ``os.remove(os.path.join(root, name))`` with 
``print(f"os.remove({os.path.join(root, name)})")`` for a purely visual 
demonstration that doesn't affect any local files.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40750] Support -d flag in the new parser

2020-05-23 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +gvanrossum, lys.nikolaou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40750] Support -d flag in the new parser

2020-05-23 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

A piece of the output for the string "1 + 1" with PR 20340:

   > star_expressions[0-0]: star_expression ','
   ✗ star_expressions[0-0]: star_expression ',' failed!
   > star_expressions[0-0]: star_expression
   ✓ star_expressions[0-3]: star_expression
   > augassign[3-3]: '+='
   ✗ augassign[3-3]: '+=' failed!
   > augassign[3-3]: '-='
   ✗ augassign[3-3]: '-=' failed!
   > augassign[3-3]: '*='
   ✗ augassign[3-3]: '*=' failed!
   > augassign[3-3]: '@='
   ✗ augassign[3-3]: '@=' failed!
   > augassign[3-3]: '/='
   ✗ augassign[3-3]: '/=' failed!
   > augassign[3-3]: '%='
   ✗ augassign[3-3]: '%=' failed!
   > augassign[3-3]: '&='
   ✗ augassign[3-3]: '&=' failed!
   > augassign[3-3]: '|='
   ✗ augassign[3-3]: '|=' failed!
   > augassign[3-3]: '^='
   ✗ augassign[3-3]: '^=' failed!
   > augassign[3-3]: '<<='
   ✗ augassign[3-3]: '<<=' failed!
   > augassign[3-3]: '>>='
   ✗ augassign[3-3]: '>>=' failed!
   > augassign[3-3]: '**='
   ✗ augassign[3-3]: '**=' failed!
   > augassign[3-3]: '//='
   ✗ augassign[3-3]: '//=' failed!
  ✗ invalid_assignment[0-0]: star_expressions augassign (yield_expr | 
star_expressions) failed!
 ✗ assignment[0-0]: invalid_assignment failed!
✗ small_stmt[0-0]: assignment failed!
> small_stmt[0-0]: star_expressions
 > star_expressions[0-0]: star_expression ((',' star_expression))+ ','?
  > _loop1_71[3-3]: (',' star_expression)
   > _tmp_139[3-3]: ',' star_expression
   ✗ _tmp_139[3-3]: ',' star_expression failed!
  ✗ _loop1_71[3-3]: (',' star_expression) failed!
 ✗ star_expressions[0-0]: star_expression ((',' star_expression))+ ','? 
failed!
 > star_expressions[0-0]: star_expression ','
 ✗ star_expressions[0-0]: star_expression ',' failed!
 > star_expressions[0-0]: star_expression
 ✓ star_expressions[0-3]: star_expression
✓ small_stmt[0-3]: star_expressions
   ✓ simple_stmt[0-4]: small_stmt !';' NEWLINE
  ✓ statement_newline[0-4]: simple_stmt
 ✓ interactive[0-4]: statement_newline
2
 > interactive[0-0]: statement_newline

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40750] Support -d flag in the new parser

2020-05-23 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +19608
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20340

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40750] Support -d flag in the new parser

2020-05-23 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

Python has a (mostly unknown) -d flag that can only be used in debug builds 
that emit some debug output for the old parser. The new parser does not support 
such flag. This is very useful when playing with the grammar as it helps 
enormously to inspect how the parser has behaved and what rules have 
accepted/rejected in its path.

--
components: Interpreter Core
messages: 369763
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Support -d flag in the new parser
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22533] Counter with no keys does not compare equal to Counter with keys which zero value

2020-05-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +19607
pull_request: https://github.com/python/cpython/pull/20339

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40657] Resource leaks with threading.Thread

2020-05-23 Thread Ned Deily


Change by Ned Deily :


--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40657] Resource leaks with threading.Thread

2020-05-23 Thread Martin Panter


Martin Panter  added the comment:

Perhaps this is the same as Issue 37788, introduced in 3.7.

--
nosy: +martin.panter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40747] sysconfig.get_config_var("py_version_nodot") should return 3_10

2020-05-23 Thread Ned Deily


Change by Ned Deily :


--
nosy: +lukasz.langa, pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Strings: double versus single quotes

2020-05-23 Thread Tim Chase
On 2020-05-23 14:46, Dennis Lee Bieber wrote:
> On Sat, 23 May 2020 11:03:09 -0500, Tim Chase
> >But when a string contains both, it biases towards single quotes:
> >  
> >   >>> "You said \"No it doesn't\""  
> >   'You said "No it doesn\'t"'  
> 
>   This is where using triple quotes (or triple apostrophes)
> around the entire thing simplifies it all... (except for a need to
> separate the four ending quotes)

Unless you're pathological. ;-)

>>> """I said "This contain every type of \"""Python\""" '''triple-quoted''' 
>>> string, doesn't it?\
'I said "This contains every type of """Python""" \'\'\'triple-quoted\'\'\' 
string, doesn\'t it."'

And-you-can-quote-me-on-that'ly yers,

-tkc



-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40748] Tutorial 4 More Control Flow Tools missing screen prompts in some code blocks

2020-05-23 Thread Chas Belov


Chas Belov  added the comment:

Also in For statements 
https://docs.python.org/3.10/tutorial/controlflow.html#for-statements (same 
issue)

However, a few of the code blocks having this issue don't exist in the 
documentation of earlier versions. Do I need a separate issue for each code 
block that is not common across 3.5 through 3.10? Or would this be handled 
during the back-porting process?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40405] asyncio.as_completed documentation misleading

2020-05-23 Thread Kyle Stanley


Kyle Stanley  added the comment:

Thanks for bring this to our attention and working on this Bar Harel, and 
thanks to Yury for the suggestions.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40405] asyncio.as_completed documentation misleading

2020-05-23 Thread miss-islington


miss-islington  added the comment:


New changeset 9181e2e2f3ade85f65bf2521a5deb898434dfd64 by Miss Islington (bot) 
in branch '3.9':
bpo-40405: Fix asyncio.as_completed docs (GH-19753)
https://github.com/python/cpython/commit/9181e2e2f3ade85f65bf2521a5deb898434dfd64


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40405] asyncio.as_completed documentation misleading

2020-05-23 Thread miss-islington


miss-islington  added the comment:


New changeset 2fecb48a1d84190c37214eb4b0c8d5460300a78b by Miss Islington (bot) 
in branch '3.8':
bpo-40405: Fix asyncio.as_completed docs (GH-19753)
https://github.com/python/cpython/commit/2fecb48a1d84190c37214eb4b0c8d5460300a78b


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40405] asyncio.as_completed documentation misleading

2020-05-23 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 9.0 -> 10.0
pull_requests: +19605
pull_request: https://github.com/python/cpython/pull/20337

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40405] asyncio.as_completed documentation misleading

2020-05-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19606
pull_request: https://github.com/python/cpython/pull/20338

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40405] asyncio.as_completed documentation misleading

2020-05-23 Thread Kyle Stanley


Kyle Stanley  added the comment:


New changeset 13206b52d16c2489f4c7dd2dce2a7f48a554b5ed by Bar Harel in branch 
'master':
bpo-40405: Fix asyncio.as_completed docs (GH-19753)
https://github.com/python/cpython/commit/13206b52d16c2489f4c7dd2dce2a7f48a554b5ed


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40749] Consider adding decorator for required inner class

2020-05-23 Thread Elijah Rippeth


New submission from Elijah Rippeth :

Sometimes it's desirable to couple classes together by nesting. Currently 
there's no way to signal to an interface implementer that an inner class is a 
required attribute to be implemented. 

I propose a decorator for `abstractnestedclass` to fill this gap. A simple 
example use-case is outlined below:

```
from abc import ABCMeta, abstractnestedclass

class BaseComponent(metaclass=ABCMeta):
@abstractnestedclass
class Config:
pass

class MissingNestedComponent(BaseComponent):
# This will raise when constructed because 
# BaseComponent.Config is not implemented
pass

class NonraisingComponent(BaseComponent):
# This will be constructable
class NonraisingComponentConfig(BaseComponent.Config):
pass
pass
```

--
components: Library (Lib)
messages: 369756
nosy: Elijah Rippeth
priority: normal
severity: normal
status: open
title: Consider adding decorator for required inner class
type: enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40748] Tutorial 4 More Control Flow Tools missing screen prompts in some code blocks

2020-05-23 Thread Chas Belov


Chas Belov  added the comment:

Also in For statements 
https://docs.python.org/3.10/tutorial/controlflow.html#for-statements (same 
issue)

--
title: Tutorial 4.7 More on Defining Functions missing screen prompts -> 
Tutorial 4 More Control Flow Tools missing screen prompts in some code blocks

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37129] Add os.RWF_APPEND flag for os.pwritev

2020-05-23 Thread YoSTEALTH


YoSTEALTH  added the comment:

terry.reedy ok, recreated the patch.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37129] Add os.RWF_APPEND flag for os.pwritev

2020-05-23 Thread YoSTEALTH


Change by YoSTEALTH :


--
pull_requests: +19604
pull_request: https://github.com/python/cpython/pull/20336

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40748] Tutorial 4.7 More on Defining Functions missing screen prompts

2020-05-23 Thread Chas Belov


New submission from Chas Belov :

The tutorial on More on Defining Functions at 
https://docs.python.org/3.7/tutorial/controlflow.html#more-on-defining-functions
 is missing most of the >>> and ... screen prompts that show elsewhere in the 
tutorial. This is potentially confusing to readers.

I am going to attempt a PR by May 26, 2020.

--
assignee: docs@python
components: Documentation
messages: 369753
nosy: Chas Belov, docs@python
priority: normal
severity: normal
status: open
title: Tutorial 4.7 More on Defining Functions missing screen prompts
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37129] Add os.RWF_APPEND flag for os.pwritev

2020-05-23 Thread YoSTEALTH


Change by YoSTEALTH :


--
keywords: +patch
pull_requests: +19603
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/20335

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40640] Tutorial for Continue missing ... line

2020-05-23 Thread Chas Belov


Chas Belov  added the comment:

@Florian Dahlitz, thank you for your help. I have created a PR at 
https://github.com/python/cpython/pull/20334 and it is awaiting approval of my 
CLA and of the change itself.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40640] Tutorial for Continue missing ... line

2020-05-23 Thread Chas Belov


Change by Chas Belov :


--
keywords: +patch
pull_requests: +19602
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20334

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34852] Counter-intuitive behavior of Server.close() / wait_closed()

2020-05-23 Thread Chris Jerdonek


Change by Chris Jerdonek :


--
nosy: +chris.jerdonek

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25095] test_httpservers hangs since Python 3.5

2020-05-23 Thread William Pickard


William Pickard  added the comment:

I've made the changes you've requested.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40747] sysconfig.get_config_var("py_version_nodot") should return 3_10

2020-05-23 Thread mattip


Change by mattip :


--
keywords: +patch
pull_requests: +19601
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20333

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Strings: double versus single quotes

2020-05-23 Thread DL Neil via Python-list

On 24/05/20 8:39 AM, Skip Montanaro wrote:



May I ask why not simply like this:

stmt = """
   select foo from bar
 where a = 'bag'
   and c = 'dog'
   """


Sorry, I don't recall. I wouldn't be at all surprised that it has something
to do with Emacs's Python mode behavior. Emacs wouldn't know what to do
with spaces in the string, but knows where to put string literals within
the open parens. I'm pretty sure I was doing this before triple quoted
strings existed.

Thankfully, I don't need to mess around with SQL anymore. :-)


A. don't be like that - send it all to me, and I'll fix it for you 
(at exorbitant rates, of course)...



The above is valid - the editor has a file in one format/language, and 
is therefore applying 'the wrong rules' when it attempts to make SQL 
look like Python!



The inconvenience (cf "issue") that arises, is that many SQL debuggers 
and error-handlers (etc) will repeat-back the source-code/query 
as-provided. Consequently, those messages are all messed-up with 
extraneous tabs and new-lines, making them difficult to read and debug.

(see also: earlier post mentioning separation of languages/code)
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


[issue40747] sysconfig.get_config_var("py_version_nodot") should return 3_10

2020-05-23 Thread mattip


New submission from mattip :

Over in packaging, that code expects 
`sysconfig.get_config_var("py_version_nodot")` to be consistent with 
`tags._version_nodot`, which expects 3_10 for python 3.10. See 
https://github.com/pypa/packaging/issues/308. The current value of 
`sysconfig.get_config_var("py_version_nodot")` (which comes from 
https://github.com/python/cpython/blob/master/Lib/sysconfig.py#L89) is `310` 
which is ambiguous.

--
components: Installation
messages: 369750
nosy: mattip
priority: normal
severity: normal
status: open
title: sysconfig.get_config_var("py_version_nodot") should return 3_10
type: behavior
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Fwd: installed but doesn't boot

2020-05-23 Thread DL Neil via Python-list




On 24/05/20 4:55 AM, Ben Hansen wrote:

-- Forwarded message -
From: Ben Hansen 
Date: Sat, May 23, 2020 at 11:44 AM
Subject: Fwd: installed but doesn't boot
To: 




-- Forwarded message -
From: Ben Hansen 
Date: Fri, May 22, 2020 at 3:18 PM
Subject: installed but doesn't boot
To: 


I have installed python after getting the book "Coding for Kids/Python, and
it won't boot.  HELP



Assuming MS-Windows:
Please advise if the following reference is accurate, and works for you:
https://docs.python.org/3/using/windows.html
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Strings: double versus single quotes

2020-05-23 Thread Skip Montanaro
>
>
> May I ask why not simply like this:
>
> stmt = """
>   select foo from bar
> where a = 'bag'
>   and c = 'dog'
>   """
>

Sorry, I don't recall. I wouldn't be at all surprised that it has something
to do with Emacs's Python mode behavior. Emacs wouldn't know what to do
with spaces in the string, but knows where to put string literals within
the open parens. I'm pretty sure I was doing this before triple quoted
strings existed.

Thankfully, I don't need to mess around with SQL anymore. :-)

Skip

>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Enums are Singletons - but not always?

2020-05-23 Thread Roel Schroeven

Richard Damon schreef op 23/05/2020 om 20:57:

On 5/23/20 2:21 PM, Ralf M. wrote:

Hello,

recently I wrote a small library that uses an Enum. That worked as
expected. Then I added a main() and if __name__ == "__main__" to make
it runable as script. Now Enum members that should be the same aren't
identical any more, there seem to be two instances of the same Enum.

I think I know what's going on, but cannot find a good and elegant way
to avoid the problem. I hope someone here can help me there.


I don;'t think Python anywhere defines that a enum will be a singleton,
and you should be checking for equality (==) not identity (is)


So much this. Always check for equality instead of identity, unless you 
know what you're doing and you have a very good reason to use identity.


Everywhere I see questions all the time from people new to Python, 
confused about stuff that happens when comparing using identity. I would 
like to know where that comes from ... are there tutorials that 
encourage using identity checks?


--
"Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger."
-- Franklin P. Jones

Roel Schroeven

--
https://mail.python.org/mailman/listinfo/python-list


Subject: Python Open-Source Snippets Newsletter

2020-05-23 Thread Aswin K

Hi,

I am creating a Python newsletter showcasing useful code snippets from 
popular open-source libraries. I will also be providing a runnable demo 
link to better understand the working.


Newsletter subscription link: https://www.pythonninja.xyz/subscribe

A sample snippet from the newsletter:

HTTP Request retrying with Backoffs - Technique for retrying failed HTTP 
requests.


From Google Maps Services Python 
(https://github.com/googlemaps/google-maps-services-python)


Demo link: https://repl.it/@PythonNinja/requestretries

"""
first_request_time: The time of the first request (None if no retries 
have occurred).

retry_counter: The count of retries, or zero for the first attempt.
"""

if not first_request_time:
first_request_time = datetime.now()

elapsed = datetime.now() - first_request_time
if elapsed > self.retry_timeout:
raise googlemaps.exceptions.Timeout()

if retry_counter > 0:
# 0.5 * (1.5 ^ i) is an increased sleep time of 1.5x per iteration,
# starting at 0.5s when retry_counter=0. The first retry will occur
# at 1, so subtract that first.
delay_seconds = 0.5 * 1.5 ** (retry_counter - 1)

# Jitter this value by 50% and pause.
time.sleep(delay_seconds * (random.random() + 0.5))

Subscribe here: https://www.pythonninja.xyz/subscribe

Feedbacks and criticism are welcome.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Strings: double versus single quotes

2020-05-23 Thread Roel Schroeven

Skip Montanaro schreef op 23/05/2020 om 13:03:

I also agree about SQL. I found that something like this:

stmt = (
 """select foo from bar"""
 """  where a = 'bag'"""
 """and c = 'dog'"""
)

worked pretty well, served to both satisfy my brain's desire for semantic
indentation (you should see some of the SQL I inherited - yikes!) and
maintain a visual distinction between Python and SQL quoting. (Consistently
using triple quotes minimizes the chance of needing a stray Python
backslash inside the SQL code.)


May I ask why not simply like this:

stmt = """
 select foo from bar
   where a = 'bag'
 and c = 'dog'
 """

This introduces more newlines and spaces in the query, but that
shouldn't really matter. I think it's more readable, and easier to edit
the query.


I'm now retired, so can't double check, but
I believe SQLite and MSSQL are unusual in their Pythonesque treatment of
single and double quotes being synonymous. I believe most other dialects
(Oracle, MySQL, Sybase, PostgreSQL that I checked) only recognize single
quotes as string delimiters.


Right. The SQLite developers did it that way in an effort to be
compatible with MySQL, and since have come to the realisation that that
was a mistake. In recent versions you can turn it off, in which cases
single quotes are for string literals and double quotes are for
identifiers (such as column names), as in standard SQL.
See
https://sqlite.org/quirks.html#double_quoted_string_literals_are_accepted

--
"Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger."
 -- Franklin P. Jones

Roel Schroeven



--
"Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger."
-- Franklin P. Jones

Roel Schroeven

--
https://mail.python.org/mailman/listinfo/python-list


Fwd: installed but doesn't boot

2020-05-23 Thread Ben Hansen
-- Forwarded message -
From: Ben Hansen 
Date: Sat, May 23, 2020 at 11:44 AM
Subject: Fwd: installed but doesn't boot
To: 




-- Forwarded message -
From: Ben Hansen 
Date: Fri, May 22, 2020 at 3:18 PM
Subject: installed but doesn't boot
To: 


I have installed python after getting the book "Coding for Kids/Python, and
it won't boot.  HELP
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Enums are Singletons - but not always?

2020-05-23 Thread Ethan Furman

On 05/23/2020 11:57 AM, Richard Damon wrote:


I don't think Python anywhere defines that a enum will be a singleton,
and you should be checking for equality (==) not identity (is)


If you're not sure, please do a little research first.  We have enough bad 
information on the 'nets already.

According to Kushal's link:


The most interesting thing about Enum members is that they are singletons.


The only time using `==` is necessary is for mixed-Enums, such as IntEnum, and 
you need to compare what could be an IntEnum member in code that could be using 
actual `int`s.

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Enums are Singletons - but not always?

2020-05-23 Thread Chris Angelico
On Sun, May 24, 2020 at 5:58 AM Kushal Kumaran  wrote:
>
> "Ralf M."  writes:
>
> > Below are a simplified code sample, the results when I run it and my
> > thoughts.
> >
> > # Code of mod1.py #
> > import enum, mod2
> > def main():
> > a = mod2.getA()
> > # End of mod1.py #
> >
> > # Code of mod2.py #
> > import mod1
> > def getA():
> > return mod1.En.A
> > # End of mod2.py #
> >
> I think of circular dependencies as a code smell.  You can move the enum
> definition into a separate module, and have both mod1 and mod2 import
> that, or like you say, by moving the main function into its own module.
> Maybe you can explain why you don't want this.

Correct - and especially since you're using the main module also as a
module. Currently, that is something you just plain shouldn't do. You
end up with one copy of the module called __main__ and another one
called mod1, and they're completely independent. Just don't do that.

However, there HAVE been some proposals to make this sort of thing
work. In general, they'd end up doing something like having the module
inserted into sys.modules twice, once as __main__ and once as mod1, so
you end up getting the same module in both cases. That would work,
since (with only one module) there'd only be one En class. I don't
think any such proposal has gotten fully serious yet, but if this is
something you're interested in (or feel strongly about), dig through
the python-ideas archives to see some of the arguments for and
against.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40367] ImportError: libffi.so.6

2020-05-23 Thread YoSTEALTH


YoSTEALTH  added the comment:

How did you get the Python installed in /opt/python/3.8.1?
- I custom installed python.

Maybe it was compiled against libffi 6, then you updated the system to libffi 
7, so that Python would need a rebuild.
- Yes, you are right about this.

So i did rebuild and no problems, Thanks :)

--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40057] Missing mention of some class attributes in socketserver documentation

2020-05-23 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
nosy: +martin.panter
versions: +Python 3.10 -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37973] improve docstrings of sys.float_info

2020-05-23 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

@mark.dickinson, please take a look at the PR when you get a chance.  Thanks!

--
nosy: +cheryl.sabella

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28859] os.path.ismount sometimes raises FileNotFoundError on Windows

2020-05-23 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

@steve.dower, please review the changes when you get a chance.  Thanks!

--
nosy: +cheryl.sabella

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Strings: double versus single quotes

2020-05-23 Thread DL Neil via Python-list

On 24/05/20 4:03 AM, Tim Chase wrote:

On 2020-05-24 01:40, Chris Angelico wrote:

On Sat, May 23, 2020 at 10:52 PM Abdur-Rahmaan Janhangeer
 wrote:


The interpreter prefers single-quotes
  

"single or double"

'single or double'
  

'not all that strongly, it doesn\'t'

"not all that strongly, it doesn't"


But when a string contains both, it biases towards single quotes:

>>> "You said \"No it doesn't\""
'You said "No it doesn\'t"'

;-)



I'm highly amused by this interchange - for two reasons: that you'd 
noticed these details, and that I hadn't!


Yes, I'd noted that the REPL responds with single-quotes, even if I used 
double-quotes in the definition (per "single of double", above) - for 
whatever that's worth (it's not as if the delimiters are stored along 
with other variable detail!)


That the REPL is 'intelligent' about its choice to vary the delimiter to 
suit the content is good (design) sense - the best presentation (UX), ie 
doesn't is a better presentation than doesn\'t!


Which brings me to my own, humble, and quite often non-PEP-8-respecting 
habits: that I (basically) apply the ?rules of English grammar to Python 
(which I write (mostly) in English). Thus a "quotation", eg someone's 
name, but any piece of data, will be enclosed in double-quotes:


name = "Abdur-Rahman"

whereas, when something will be 'calculated', I use singles, eg

f'{ name } is top of the class'

Never learning a language which distinguishes single character literals 
from strings, eg the C examples quoted earlier, such 
thoughts/distinctions don't 'exist'.
(which makes me wonder why code reviews have never queried the point, or 
registered that I might seem to be behaving inconsistently...)

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


[issue34938] Fix mimetype.init() to account for from import

2020-05-23 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

@steve.dower, Mariatta had a question for you on the PR.

--
nosy: +cheryl.sabella

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Enums are Singletons - but not always?

2020-05-23 Thread Kushal Kumaran
"Ralf M."  writes:

> Hello,
>
> recently I wrote a small library that uses an Enum. That worked as
> expected. Then I added a main() and if __name__ == "__main__" to make
> it runable as script. Now Enum members that should be the same aren't
> identical any more, there seem to be two instances of the same Enum.
>
> I think I know what's going on, but cannot find a good and elegant way
> to avoid the problem. I hope someone here can help me there.
>
> Below are a simplified code sample, the results when I run it and my
> thoughts.
>
> # Code of mod1.py #
> import enum, mod2
> class En(enum.Enum):
> A = 1
> B = 2
> def main():
> a = mod2.getA()
> print("a is En.A:", a is En.A)
> print("a:", repr(a), "En.A:", repr(En.A))
> print("id(a), id(a.__class__)", id(a), id(a.__class__))
> print("id(En.A), id(En)  ", id(En.A), id(En))
> if __name__ == "__main__":
> main()
> # End of mod1.py #
>
> # Code of mod2.py #
> import mod1
> def getA():
> return mod1.En.A
> # End of mod2.py #
>
> # Results when run: #
> C:\tmp>py mod1.py
> a is En.A: False
> a:  En.A: 
> id(a), id(a.__class__) 33305864 7182808
> id(En.A), id(En)   33180552 7183752
>
> C:\tmp>py
> Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC
> v.1916 64 bit
> (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
 import mod1
 mod1.main()
> a is En.A: True
> a:  En.A: 
> id(a), id(a.__class__) 49566792 44574280
> id(En.A), id(En)   49566792 44574280

>
> So: When run as script there are two instances of En (different ids),
> but when mod1 is imported and mod1.main() is run it works as expected
> (just one instance of En, same ids).
> BTW: py -m mod1 doesn't work either.
>
> What I thing is happening:
> When the script is run, mod1.py is executed and an instance of En and
> its members is created. During the same run mod1 is also imported (via
> mod2), the file mod1.py is executed again as part of the import and
> another, different instance of En and its members is created.
>
> How do I have to change mod1.py to avoid the problem?
> Currently I have moved main() into a new file script.py. That works,
> but is not what I wanted.
>

I think of circular dependencies as a code smell.  You can move the enum
definition into a separate module, and have both mod1 and mod2 import
that, or like you say, by moving the main function into its own module.
Maybe you can explain why you don't want this.

The note in the documentation about enum members being singletons only
applies to the members.  It does not apply to the enum class itself.  In
your case, __main__.En is not the same as mod1.En.  The members being
singleton means that, for the same enum class En, En.A will refer to the
same object as En(1), or, perhaps an unpickled object that has the same
value.

> I doubt it's a bug in the enum module, but should that be the case,
> I'm willing to open an issue on the bug tracker.
>
> Or can nothing be done about it?
>

It is not specific to the Enum class.  You'll see the same behaviour
with any class that gets imported under two different module names.

> Looking forward to any ideas
> Ralf M.
>
> P.S.:
> As I was about to send this post the following modification occured to
> me (see below). It works, but it doesn't feel right to import a module
> directly from inside itself.
> # Modified code of mod1.py (one line added) #
> import enum, mod2
> class En(enum.Enum):
> A = 1
> B = 2
> from mod1 import En  # NEW LINE, overwrite just defined En
> def main():
> a = mod2.getA()
> print("a is En.A:", a is En.A)
> print("a:", repr(a), "En.A:", repr(En.A))
> print("id(a), id(a.__class__)", id(a), id(a.__class__))
> print("id(En.A), id(En)  ", id(En.A), id(En))
> if __name__ == "__main__":
> main()

I agree this is unpleasant to read.

-- 
regards,
kushal
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Enums are Singletons - but not always?

2020-05-23 Thread Peter Otten
Peter Otten wrote:

>> # Code of mod2.py #
> import __main__ as mod1
>> def getA():
>>return mod1.En.A
>> # End of mod2.py #
> 
> but that would hardcode the assumption that __main__ is always mod1.py.

I should have mentioned the cyclic dependency -- if two modules import each 
other one may not be completely set up when the other tries to access it.


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40133] Provide additional matchers for unittest.mock

2020-05-23 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I disagree.  Many of these do belong in the stdlib and we don't need a 
python-ideas bike shedding 300 message thread about something so trivial.

We've been using these internally at Google for years.

Its on my plate to identify which ones to accept and get the most used useful 
ones in.  With an additional eye to which ones we'd likely use when testing the 
stdlib itself.

They fit right in with 
https://docs.python.org/3/library/unittest.mock.html#helpers

--
assignee:  -> gregory.p.smith
resolution: rejected -> 
status: closed -> open
versions: +Python 3.10 -Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Enums are Singletons - but not always?

2020-05-23 Thread Kushal Kumaran
Richard Damon  writes:

> On 5/23/20 2:21 PM, Ralf M. wrote:
>> Hello,
>>
>> recently I wrote a small library that uses an Enum. That worked as
>> expected. Then I added a main() and if __name__ == "__main__" to make
>> it runable as script. Now Enum members that should be the same aren't
>> identical any more, there seem to be two instances of the same Enum.
>>
>> I think I know what's going on, but cannot find a good and elegant way
>> to avoid the problem. I hope someone here can help me there.
>
> I don;'t think Python anywhere defines that a enum will be a singleton,
> and you should be checking for equality (==) not identity (is)
>

https://docs.python.org/3/library/enum.html#enum-members-aka-instances

-- 
regards,
kushal
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strings: double versus single quotes

2020-05-23 Thread DL Neil via Python-list

On 23/05/20 11:03 PM, Skip Montanaro wrote:

I also agree about SQL. I found that something like this:

stmt = (
 """select foo from bar"""
 """  where a = 'bag'"""
 """and c = 'dog'"""
)

worked pretty well, served to both satisfy my brain's desire for semantic
indentation (you should see some of the SQL I inherited - yikes!) and
maintain a visual distinction between Python and SQL quoting. (Consistently
using triple quotes minimizes the chance of needing a stray Python
backslash inside the SQL code.) I'm now retired, so can't double check, but
I believe SQLite and MSSQL are unusual in their Pythonesque treatment of
single and double quotes being synonymous. I believe most other dialects
(Oracle, MySQL, Sybase, PostgreSQL that I checked) only recognize single
quotes as string delimiters.



The older (and more professional?) RDBMS accept either/both as variable 
delimiters, per Python strings.


My habit with SQL queries is to separate them from other code, cf the 
usual illustration of having them 'buried' within the code, immediately 
before, or even part of, the query call.


This partly because (a) some dev.teams have a specific person handling 
DBA-tasks, and partly (b) in order to make it easy to 
find/correct/re-factor SQL code without it being mixed-in with the Python.


(a) using a separate and specific module for SQL constants (which may 
include queries as text, or prepared queries), means that the 'DBA' may 
develop independently of the Python devs; that integration of code 
happens in the VCS; that the Python code may separate (stub) or 
integrate during unit-testing, according to progress and choice.


(b) physical 'extraction' and separation make it easier to develop and 
test each component (SQL, Python, ...) separately - either work in SQL 
*or* in Python, and not have the extra 'load' of having to flip one's 
brain between the two; and by using a separate module, makes it easy to 
locate a 'class' of code dealing with particular data and/or 
carrying-out particular functions - much as you might for classes and/or 
libraries.


Oh, and a further benefit: (further to "inherited", above) it becomes 
easier to avoid the massive tangles caused by trying to mix the 
conventions for indenting multi-line SQL code, with those for Python!

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


[issue1294959] Add sys.platlibdir and configure --with-platlibdir to use /usr/lib64 on Fedora and SuSE

2020-05-23 Thread Michał Górny

Michał Górny  added the comment:

Ok, it seems that I misunderstood it at first.  Judging by the code, it also 
affects extensions installed into site-packages, so I've tried to make that 
clear and add one more example to the bullet list.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1294959] Add sys.platlibdir and configure --with-platlibdir to use /usr/lib64 on Fedora and SuSE

2020-05-23 Thread Michał Górny

Change by Michał Górny :


--
pull_requests: +19600
pull_request: https://github.com/python/cpython/pull/20332

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33388] Support PEP 566 metadata in distutils

2020-05-23 Thread Éric Araujo

Éric Araujo  added the comment:

Closing as per previous messages.

--
resolution:  -> wont fix
stage: patch review -> resolved
status: open -> closed
title: Support PEP 566 metadata in dist.py -> Support PEP 566 metadata in 
distutils

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Enums are Singletons - but not always?

2020-05-23 Thread Peter Otten
Ralf M. wrote:

> Hello,
> 
> recently I wrote a small library that uses an Enum. That worked as
> expected. Then I added a main() and if __name__ == "__main__" to make it
> runable as script. Now Enum members that should be the same aren't
> identical any more, there seem to be two instances of the same Enum.
> 
> I think I know what's going on, but cannot find a good and elegant way
> to avoid the problem. I hope someone here can help me there.
> 
> Below are a simplified code sample, the results when I run it and my
> thoughts.
> 
> # Code of mod1.py #
> import enum, mod2
> class En(enum.Enum):
>  A = 1
>  B = 2
> def main():
>  a = mod2.getA()
>  print("a is En.A:", a is En.A)
>  print("a:", repr(a), "En.A:", repr(En.A))
>  print("id(a), id(a.__class__)", id(a), id(a.__class__))
>  print("id(En.A), id(En)  ", id(En.A), id(En))
> if __name__ == "__main__":
>  main()
> # End of mod1.py #
> 
> # Code of mod2.py #
> import mod1
> def getA():
>  return mod1.En.A
> # End of mod2.py #
> 
> # Results when run: #
> C:\tmp>py mod1.py
> a is En.A: False
> a:  En.A: 
> id(a), id(a.__class__) 33305864 7182808
> id(En.A), id(En)   33180552 7183752
> 
> C:\tmp>py
> Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916
> 64 bit
> (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import mod1
>  >>> mod1.main()
> a is En.A: True
> a:  En.A: 
> id(a), id(a.__class__) 49566792 44574280
> id(En.A), id(En)   49566792 44574280
>  >>>
> 
> So: When run as script there are two instances of En (different ids),
> but when mod1 is imported and mod1.main() is run it works as expected
> (just one instance of En, same ids).
> BTW: py -m mod1 doesn't work either.
> 
> What I thing is happening:
> When the script is run, mod1.py is executed and an instance of En and
> its members is created. During the same run mod1 is also imported (via
> mod2), the file mod1.py is executed again as part of the import and
> another, different instance of En and its members is created.
> 
> How do I have to change mod1.py to avoid the problem?
> Currently I have moved main() into a new file script.py. That works, but
> is not what I wanted.

But that is exactly the right approach. Avoid importing the main script 
under its name because that will run all code that is not guarded by 

if __name__ == "__main__": ...

twice. In your case it's enum, but the same goes for every class, function 
or object and the module itself. In Python they are all created rather than 
declared.

> I doubt it's a bug in the enum module, but should that be the case, I'm
> willing to open an issue on the bug tracker.
> 
> Or can nothing be done about it?

mod2 could import the __main__ module, e. g. 

> # Code of mod2.py #
  import __main__ as mod1
> def getA():
>  return mod1.En.A
> # End of mod2.py #

but that would hardcode the assumption that __main__ is always mod1.py.

The only sane option is to not put anything in the main script that needs to 
be imported by other modules.

> Looking forward to any ideas
> Ralf M.
> 
> P.S.:
> As I was about to send this post the following modification occured to
> me (see below). It works, but it doesn't feel right to import a module
> directly from inside itself.
> # Modified code of mod1.py (one line added) #
> import enum, mod2
> class En(enum.Enum):
>  A = 1
>  B = 2
> from mod1 import En  # NEW LINE, overwrite just defined En
> def main():
>  a = mod2.getA()
>  print("a is En.A:", a is En.A)
>  print("a:", repr(a), "En.A:", repr(En.A))
>  print("id(a), id(a.__class__)", id(a), id(a.__class__))
>  print("id(En.A), id(En)  ", id(En.A), id(En))
> if __name__ == "__main__":
>  main()


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40701] tempfile mixes str and bytes in an inconsistent manner

2020-05-23 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Could you please turn that into a Github PR?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37630] Investigate replacing SHA3 code with OpenSSL

2020-05-23 Thread Christian Heimes


Christian Heimes  added the comment:

LibreSSL does neither include SHA3/SHAKE family nor Blake2. Feature requests 
have been open for 1.5 to almost four years. The first reply on each feature 
request don't come as a surprise to me...

https://github.com/libressl-portable/portable/issues/199
https://github.com/libressl-portable/portable/issues/455

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40743] [CMake] It's 2020, where is CMake?

2020-05-23 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

This was discussed a bit last December 2019 here ("Is there prior discussion 
around the build system of CPython itself?"):
https://discuss.python.org/t/is-there-prior-discussion-around-the-build-system-of-cpython-itself/2813

--
nosy: +chris.jerdonek

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38632] setup.py sdist should honor SOURCE_DATE_EPOCH

2020-05-23 Thread Matthias Bussonnier


Matthias Bussonnier  added the comment:

https://github.com/python/cpython/pull/20331 is a first step toward this. 

See comments in there, I would love some reviews. If that gets im I'll be happy 
to send further refactor to make the compression step also respect 
SOURCE_DATE_EPOCH.

For projects building with older python you should be able to unpack/repack 
with your custom scripts that should allow you have bytes identical tar in many 
cases.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38632] setup.py sdist should honor SOURCE_DATE_EPOCH

2020-05-23 Thread Matthias Bussonnier


Change by Matthias Bussonnier :


--
keywords: +patch
pull_requests: +19599
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20331

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Is there some reason that recent Windows 3.6 releases don't included executable nor msi installers?

2020-05-23 Thread Mats Wichmann
On 5/23/20 12:23 AM, Adam Preble wrote:
> I wanted to update from 3.6.8 on Windows without necessarily moving on to 
> 3.7+ (yet), so I thought I'd try 3.6.9 or 3.6.10. 
> 
> All I see for both are source archives:
> 
> https://www.python.org/downloads/release/python-369/
> https://www.python.org/downloads/release/python-3610/
> 
> So, uh, I theoretically did build a 3.6.10 .exe installer, but I don't really 
> trust I did everything right. Is there an officially sourced installation?
> 

During the early part of a release cycle, installers are built.  Once
the cycle moves into security fix-only mode, installers are not built.
That's all you are seeing.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40743] [CMake] It's 2020, where is CMake?

2020-05-23 Thread Christian Heimes


Christian Heimes  added the comment:

How about you start with a PEP that compares our current build system with 
CMake and explores if CMake is a viable option? Is CMake supported on platforms 
like Solaris, HP-UX, VxWorks? Or are there better options for a new build 
system for CPython, for example Meson? After all Meson is written in Python and 
used by large projects like X.org, Wayland, major parts of Gnome, systemd, and 
more.

PS: I find your phrasing and choice of words aggressive, condescending, 
patronizing. Please turn it down a nudge.

--
nosy: +christian.heimes

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Enums are Singletons - but not always?

2020-05-23 Thread Richard Damon
On 5/23/20 2:21 PM, Ralf M. wrote:
> Hello,
>
> recently I wrote a small library that uses an Enum. That worked as
> expected. Then I added a main() and if __name__ == "__main__" to make
> it runable as script. Now Enum members that should be the same aren't
> identical any more, there seem to be two instances of the same Enum.
>
> I think I know what's going on, but cannot find a good and elegant way
> to avoid the problem. I hope someone here can help me there.

I don;'t think Python anywhere defines that a enum will be a singleton,
and you should be checking for equality (==) not identity (is)

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue39686] add dump_json to ast module

2020-05-23 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38741] Definition of multiple ']' in header configparser

2020-05-23 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

@lukasz.langa, please take a look at the PR for a review.  Thank you!

--
nosy: +cheryl.sabella, lukasz.langa
versions: +Python 3.10, Python 3.9 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40746] test_gdb failing on Raspbian on 3.9, regression from 3.8

2020-05-23 Thread Gregory P. Smith


New submission from Gregory P. Smith :

https://buildbot.python.org/all/#/builders/727

test_tuples (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of tuples ... ok
test_bt (test.test_gdb.PyBtTests)
Verify that the "py-bt" command works ... FAIL
Stderr:
Python Exception  Cannot access memory at address 
0xfedc: 
Error occurred in Python command: Cannot access memory at address 0xfedc

and a pile of similar errors after test_bt

Marking release blocker as this isn't present in 3.8 or earlier, we've got a 
regression here.

i haven't tried to debug yet, but that pointer value smells like something did 
a negative offset from NULL...

--
components: Tests
messages: 369736
nosy: gregory.p.smith
priority: release blocker
severity: normal
status: open
title: test_gdb failing on Raspbian on 3.9, regression from 3.8
versions: Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Enums are Singletons - but not always?

2020-05-23 Thread Ralf M.

Hello,

recently I wrote a small library that uses an Enum. That worked as 
expected. Then I added a main() and if __name__ == "__main__" to make it 
runable as script. Now Enum members that should be the same aren't 
identical any more, there seem to be two instances of the same Enum.


I think I know what's going on, but cannot find a good and elegant way 
to avoid the problem. I hope someone here can help me there.


Below are a simplified code sample, the results when I run it and my 
thoughts.


# Code of mod1.py #
import enum, mod2
class En(enum.Enum):
A = 1
B = 2
def main():
a = mod2.getA()
print("a is En.A:", a is En.A)
print("a:", repr(a), "En.A:", repr(En.A))
print("id(a), id(a.__class__)", id(a), id(a.__class__))
print("id(En.A), id(En)  ", id(En.A), id(En))
if __name__ == "__main__":
main()
# End of mod1.py #

# Code of mod2.py #
import mod1
def getA():
return mod1.En.A
# End of mod2.py #

# Results when run: #
C:\tmp>py mod1.py
a is En.A: False
a:  En.A: 
id(a), id(a.__class__) 33305864 7182808
id(En.A), id(En)   33180552 7183752

C:\tmp>py
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 
64 bit

(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mod1
>>> mod1.main()
a is En.A: True
a:  En.A: 
id(a), id(a.__class__) 49566792 44574280
id(En.A), id(En)   49566792 44574280
>>>

So: When run as script there are two instances of En (different ids), 
but when mod1 is imported and mod1.main() is run it works as expected 
(just one instance of En, same ids).

BTW: py -m mod1 doesn't work either.

What I thing is happening:
When the script is run, mod1.py is executed and an instance of En and 
its members is created. During the same run mod1 is also imported (via 
mod2), the file mod1.py is executed again as part of the import and 
another, different instance of En and its members is created.


How do I have to change mod1.py to avoid the problem?
Currently I have moved main() into a new file script.py. That works, but 
is not what I wanted.


I doubt it's a bug in the enum module, but should that be the case, I'm 
willing to open an issue on the bug tracker.


Or can nothing be done about it?

Looking forward to any ideas
Ralf M.

P.S.:
As I was about to send this post the following modification occured to 
me (see below). It works, but it doesn't feel right to import a module 
directly from inside itself.

# Modified code of mod1.py (one line added) #
import enum, mod2
class En(enum.Enum):
A = 1
B = 2
from mod1 import En  # NEW LINE, overwrite just defined En
def main():
a = mod2.getA()
print("a is En.A:", a is En.A)
print("a:", repr(a), "En.A:", repr(En.A))
print("id(a), id(a.__class__)", id(a), id(a.__class__))
print("id(En.A), id(En)  ", id(En.A), id(En))
if __name__ == "__main__":
main()
--
https://mail.python.org/mailman/listinfo/python-list


[issue40745] Typo in library/typing

2020-05-23 Thread Héctor Canto

Héctor Canto  added the comment:

I'll try ASAP.
Héctor Canto

On Sat, 23 May 2020 at 19:33, Rémi Lapeyre  wrote:

>
> Rémi Lapeyre  added the comment:
>
> Hi Héctor, can you open a new PR with those changes?
>
> --
> nosy: +remi.lapeyre
> versions:  -Python 3.5, Python 3.6, Python 3.7
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40133] Provide additional matchers for unittest.mock

2020-05-23 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

@Flameeyes, thank you for the suggestion.  As per the other comments, I'm going 
to close this as it would be more suitable to have it on PyPI.  Feel free to 
have more discussion here or on python-ideas if you want to get more feedback.

--
nosy: +cheryl.sabella
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40743] [CMake] It's 2020, where is CMake?

2020-05-23 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Can you point to specific issues with the current build system?

It seems to me that for 1. it will only make it easier for projects that use 
CMake, 2. the build system is not the only part needed to support a new OS and 
for 3. I've not found Python to be particularly slow to build for such a large 
program. You may want to look at ccache if you want to speed you build process 
(I'm not using it on this computer and it's still quite fast, Make will only 
rebuild the appropriate object files already unless you explicitly clean them).

Before making large changes to the build system, you should open a thread on 
the python-ideas mailing list, there was some discussion about this a few years 
back but maybe now that Python2 is gone it would be easier to make this change?

--
nosy: +remi.lapeyre

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38632] setup.py sdist should honor SOURCE_DATE_EPOCH

2020-05-23 Thread Matthias Bussonnier


Change by Matthias Bussonnier :


--
nosy: +mbussonn

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33294] Support complex expressions for py-print command.

2020-05-23 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
assignee:  -> dmalcolm
nosy: +dmalcolm

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31956] Add start and stop parameters to the array.index()

2020-05-23 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

I found this SO about reclaiming an orphaned pull request:
https://stackoverflow.com/a/53383772

But you may still need to open a new PR for it.

--
nosy: +cheryl.sabella

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40745] Typo in library/typing

2020-05-23 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi Héctor, can you open a new PR with those changes?

--
nosy: +remi.lapeyre
versions:  -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Strings: double versus single quotes

2020-05-23 Thread Abdur-Rahmaan Janhangeer
Nice one,

Was requoting:

<>> "hello"
'hello'>>

from R Hettinger

Kind Regards,


Abdur-Rahmaan Janhangeer

https://www.github.com/Abdur-RahmaanJ

Mauritius

sent from gmail client on Android, that's why the signature is so ugly.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40733] Make IDLE doc more visible, mention in main python docs page

2020-05-23 Thread Ama Aje My Fren

Ama Aje My Fren  added the comment:

> I think I used duckduckgo to find the docs.

Ok,

I just checked and when one has scrolled down the search is not seen.
In most browsers web search is easier than searching on the docs site.

--
Added file: https://bugs.python.org/file49186/docs.python.org.png

___
Python tracker 

__
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40745] Typo in library/typing

2020-05-23 Thread Héctor Canto

New submission from Héctor Canto :

I found a small typo here:
https://docs.python.org/3.8/library/typing.html?highlight=typing#typing.NewType

I checked also in other 3.x versions and it is there too.

Original:
A helper function to indicate a distinct types to a typechecker, see NewType

Possible solution (remove the "s" in types):
A helper function to indicate a distinct type to a typechecker, see NewType

--
assignee: docs@python
components: Documentation
messages: 369730
nosy: docs@python, hectorcanto
priority: normal
severity: normal
status: open
title: Typo in library/typing
type: enhancement
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Strings: double versus single quotes

2020-05-23 Thread Tim Chase
On 2020-05-24 01:40, Chris Angelico wrote:
> On Sat, May 23, 2020 at 10:52 PM Abdur-Rahmaan Janhangeer
>  wrote:
> >
> > The interpreter prefers single-quotes
> >  
> > >>> "single or double"  
> > 'single or double'
> >  
> >>> 'not all that strongly, it doesn\'t'  
> "not all that strongly, it doesn't"

But when a string contains both, it biases towards single quotes:

   >>> "You said \"No it doesn't\""
   'You said "No it doesn\'t"'

;-)

-tkc



-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40744] Explicitly drop support for SQLite version < 3.7.3

2020-05-23 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +19598
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20330

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40744] Explicitly drop support for SQLite version < 3.7.3

2020-05-23 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

Currently, we use sqlite3_create_function_v2() without wrapping it in any 
#ifdefs, so in practise the sqlite3 module will not build against sqlite3 pre 
3.7.3. Despite this, we still wrap parts of the code in #ifdefs for versions 
3.6.x and older.

Added patch drops support for sqlite3 pre 3.7.3.

--
components: Library (Lib)
files: 0001-Drop-support-for-sqlite3-3.7.3.patch
keywords: patch
messages: 369729
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: Explicitly drop support for SQLite version < 3.7.3
versions: Python 3.10, Python 3.8, Python 3.9
Added file: 
https://bugs.python.org/file49187/0001-Drop-support-for-sqlite3-3.7.3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40670] supplying an empty string to timeit causes an IndentationError

2020-05-23 Thread Florian Dahlitz


Florian Dahlitz  added the comment:

@terry.reedy sorry if I misunderstood you, but it seems to me that you agree 
with the proposed changes?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40568] Modify -c command-line option to accept multiple inputs

2020-05-23 Thread Florian Dahlitz


Change by Florian Dahlitz :


--
nosy:  -DahlitzFlorian

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40726] ast.Call end_lineno is defined and returns None

2020-05-23 Thread Florian Dahlitz


Change by Florian Dahlitz :


--
nosy:  -DahlitzFlorian

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40701] tempfile mixes str and bytes in an inconsistent manner

2020-05-23 Thread Florian Dahlitz


Change by Florian Dahlitz :


--
nosy:  -DahlitzFlorian

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40738] backspace character \b not processed by IDLE

2020-05-23 Thread Stan Hendryx

Stan Hendryx  added the comment:

Hello Terry,

Thank you for your reply. I understand there are different interpretations of 
\b. IMHO, since IDLE is part of a python distribution, IDLE needs to be 
consistent with the native python interpreter on each platform. On Mac, IDLE 
gives
>>> print("deleted\b file")
deleted file

whereas on mac Terminal we get 
>>> print("deleted\b file")
delete file

JetBrains gives another vote for the native interpretation. I’ve been tutoring 
my grandson on python using JetBrains Academy’s python tutorials. 
They teach 
>>> print("deleted\b file")
delete file

That’s how I discovered the inconsistency.

Thank you,

Stan Hendryx

> On May 22, 2020, at 7:29 PM, Terry J. Reedy  wrote:
> 
> 
> Terry J. Reedy  added the comment:
> 
> I am considering terminal simulation as an option, but there is not exactly a 
> standard to emulate.  \b originally meant the same as the typewrite backspace 
> and modern US computer keyboard left arrow key <- (move cursor left without 
> erasing), which would result in 'delete filed' in insert mode, but sometimes 
> now is interpreted the same as modern US computer keyboard backspace (erase 
> and move left), as you expect.
> 
> --
> resolution:  -> duplicate
> stage:  -> resolved
> status: open -> closed
> superseder:  -> IDLE: Document how Shell displays user code output
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: How to design a class that will listen on stdin?

2020-05-23 Thread Dan Sommers


On Saturday, May 23, 2020, at 07:24 -0400, zljubi...@gmail.com wrote:

> I have to talk to outer system by stdin/stdout.
> Each line that comes to stdin should be processed and its result returned 
> back to stdout. Logging should go to stderr.
> 
> How to design a class that will listed to stdin and call required methods in 
> order to process the data?

I wouldn't put it into a class, but the core of it looks something like
this:

for line in sys.stdin:
result = process(line)
print(result)
if some_condition():
break

The details may be different, and there's likely more error handling in
production code, but that's the general idea.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to design a class that will listen on stdin?

2020-05-23 Thread Dieter Maurer
zljubi...@gmail.com wrote at 2020-5-23 04:24 -0700:
>I have to talk to outer system by stdin/stdout.
>Each line that comes to stdin should be processed and its result returned back 
>to stdout. Logging should go to stderr.
>
>How to design a class that will listed to stdin and call required methods in 
>order to process the data?

Start by reading the Python tutorial
("https://docs.python.org/3/tutorial/index.html#tutorial-index;),
especially section 7.
-- 
https://mail.python.org/mailman/listinfo/python-list


How to design a class that will listen on stdin?

2020-05-23 Thread zljubisic
Hi,

I have to talk to outer system by stdin/stdout.
Each line that comes to stdin should be processed and its result returned back 
to stdout. Logging should go to stderr.

How to design a class that will listed to stdin and call required methods in 
order to process the data?

Regards
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: exiting a while loop

2020-05-23 Thread Grant Edwards
On 2020-05-22, DL Neil via Python-list  wrote:
> On 23/05/20 4:31 AM, Grant Edwards wrote:
>> On 2020-05-22, Peter Otten <__pete...@web.de> wrote:
>> 
>>> If you want to terminate the script you can use exit. However exit
>>> is a function, and you have to call it
>>>
>>> exit()
>> 
>> 
>> 
>> Actually it's an instance of _sitebuiltins.Quitter not a function.
>> 
>> You still have to call it. ;)
>> 
>> 


> Which definition (may) make it 'worse' (when compared with "break"):

Oh, he definitely wanted break instead of exit(), and I assume the OP
had already taken that advice.

That's why I'm claiming extra pedant points: clarifying a pointless
detail about something the OP didn't want to be using in first place
and which had already been replaced by something else.

--
Grant






-- 
https://mail.python.org/mailman/listinfo/python-list


FlaskCon Call For Papers

2020-05-23 Thread Abdur-Rahmaan Janhangeer
Greetings list,

The call for papers for FlaskCon is open:
https://flaskcon.com/

It is a community-run event, 100% free and remote
with reviewers from the Pallets, Flask maintainers and
more

Feel free to pass the word around!

Kind Regards,

Abdur-Rahmaan Janhangeer
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >