[issue41314] PEP 563 and annotations __future__ mandatory version

2020-07-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The PEP was accepted apparently by Guido sometime after the second posting 
21-Nov-2017.  Guido added the annotations entry to __future__ on 1/26/2018 with 
the 'mandatory' version changed to 4.0, which means 'some indefinite undecided 
future version'.  I consider '4.0' to the intentional and definitive until 
Guido or Lucasz say otherwise.

When PEP implementations differ from the PEP, we do not usually go back and 
revise the PEP.  The implementation rules unless clearly buggy.

--
nosy: +gvanrossum, lukasz.langa, terry.reedy
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
title: __future__ doc and PEP 563 conflict -> PEP 563 and annotations 
__future__ mandatory version
versions: +Python 3.8, 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



Re: Fake news Detect

2020-07-17 Thread Mike Dewhirst
On 18/07/2020 6:16 am, Grant Edwards wrote:
> On 2020-07-17, Dennis Lee Bieber  wrote:
>> On Fri, 17 Jul 2020 16:02:15 - (UTC), Gazu  declaimed
>> the following:
>>
>>> Hey Guys I am new to python and i am building a fake news detection
>>> system ...
>>  I suspect that, if anyone had done this already, it would likely be
>> found on some source code archive (github?) -- and you'd just be
>> duplicating the effort.
>>
>>  Essentially, since the core of this functionality depends upon the
>> algorithm, YOU will have to develop the algorithm.
> Or he could do something easier like eliminating hunger, war and
> Covid-19.

Or like changing culture to give more weight to education, integrity
etc. We need systems to automatically identify fake news and educate
believers. News consumers have to do it.

News consumers need a system where they can go to check news items to
see if they are credible. Without the cooperation of news conduits - to
label news items with the source - that will be difficult.

However, that doesn't mean the crowd can't check credibility. So,
culture change is needed. No-one wants to be outed as a fake news source.

Here's a project. Build an automatic news aggregation site which
collects all news in two pages per news item. Page 1 for the item and
page 2 for the crowd credibility assessment and naming of the apparent
source. Should work somewhat like Wikipedia. Except editors for page 2
would need a threshold score for being correct. Everyone can criticise
but you lose points for being on the wrong side of history.

That'll be 2 cents

Mike

>
> --
> Grant
>



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41282] Deprecate and remove distutils

2020-07-17 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions:  -Python 3.9

___
Python tracker 

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



[issue41330] Inefficient error-handle for CJK encodings

2020-07-17 Thread Ma Lin


New submission from Ma Lin :

CJK encode/decode functions only have three error-handler fast-paths:
replace
ignore
strict  
See the code: [1][2]

If use other built-in error-handlers, need to get the error-handler object, and 
call it with an Unicode Exception argument. See the code: [3]

But the error-handler object is not cached, it needs to be looked up from a 
dict every time, which is very inefficient.


Another possible optimization is to write fast-path for common error-handlers, 
Python has these built-in error-handlers:

strict
replace
ignore
backslashreplace
xmlcharrefreplace
namereplace
surrogateescape
surrogatepass (only for utf-8/utf-16/utf-32 family)

For example, maybe `xmlcharrefreplace` is heavily used in Web application, it 
can be implemented as a fast-path, so that no need to call the error-handler 
object every time.
Just like the `xmlcharrefreplace` fast-path in `PyUnicode_EncodeCharmap` [4].

[1] encode function:
https://github.com/python/cpython/blob/v3.9.0b4/Modules/cjkcodecs/multibytecodec.c#L192

[2] decode function:
https://github.com/python/cpython/blob/v3.9.0b4/Modules/cjkcodecs/multibytecodec.c#L347

[3] `call_error_callback` function:
https://github.com/python/cpython/blob/v3.9.0b4/Modules/cjkcodecs/multibytecodec.c#L82

[4] `xmlcharrefreplace` fast-path in `PyUnicode_EncodeCharmap`:
https://github.com/python/cpython/blob/v3.9.0b4/Objects/unicodeobject.c#L8662

--
components: Unicode
messages: 373871
nosy: ezio.melotti, malin, vstinner
priority: normal
severity: normal
status: open
title: Inefficient error-handle for CJK encodings
type: performance
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: A Python installation help doc much more friendly to newcomers? [Was Re: help]

2020-07-17 Thread dn via Python-list

On 18/07/20 3:29 PM, boB Stepp wrote:

On Fri, Jul 17, 2020 at 9:48 PM dn via Python-list
 wrote:


On 18/07/20 1:53 PM, Castillo, Herbert S wrote:

I downloaded python not to long ago, and today when I opened Python on Windows 
it gave me a modify setup prompt. I have tried to click on modify , repair and 
even uninstalled and installed it back, but when I try to open Python up again, 
I keep on getting the same modify setup prompt. I am not sure of what to do? 
Thank you in advance.



Regret that this mailing list does not support graphics attachments.

Which part of https://docs.python.org/dev/using/windows.html failed?


Just for grins I just now glanced at the link dn provided.  Yes, this
is a very thorough, very accurate, very *technical* help resource.
But if I were a person who had never seen a shell, cmd.exe or
Powershell window, never programmed before, had no clue about how to
truly use my OS, etc., I don't think I would understand a bit of this
"help" document, and, at best, would find it very intimidating.  If
this community does wish to cater to those who are totally new to the
world of programming and learning how to really use their PC at any
depth, then I think a different approach or set of documents is
needed.  And an easier way for those playing with the idea of learning
programming and Python to connect with such documentation.

I think that we take a lot for granted that is second nature to most
of us.  Also, most of us have the mindset that even when all of this
programming stuff was new to us (If we can even truly remember that
anymore.), we would have the problem-solving chops to get over these
hurdles.  Many don't have these native inclinations.  Searching online
for technical solutions is completely foreign to many.  Even searching
for anything may be more challenging than we suspect for some.

I am just a Python hobbyist/dabbler, not a pro like most of you, but I
have taught kids through adults various subjects in the past, helped
seniors, etc., and a lot of what we take for granted is *not* easy for
many.  But I believe that almost everyone that can get to the point of
believing that they can perhaps learn programming, can do so, but may
need some encouragement to get to that point of "self-belief".

Sure, some people are just too lazy and want to be spoon-fed, but I
truly believe that is a minority.  Can we make this easier for those
who really would like to try?

Just some thoughts that I hope will be constructively received.



There is also THE Python Tutorial - the opening action is two?three 
pages 'in'. Is that suitably less-technical and more usable to a 'beginner'?

https://docs.python.org/3/tutorial/index.html
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Seeking to convert a py timer app for my Moto E6

2020-07-17 Thread Steve
I am looking for an app for my Moto e6 android phone that will accept a number 
of hours and then count down.  Once the hours have been executed, it will 
quietly beep every minute until I cancel the app.  This is to remind me  (and 
keep on reminding me) when to take my insulin.

It has been written in python but I do not know how to convert it to an app. I 
wonder how much of the python code will still apply. When I was into this in 
the past, I installed Kivy and was able to finally generate a "Hello World" app 
and managed to get it to my phone. Then life called me back to reality and I 
lost track of what I was doing for a few years. )-:  I doubt I can go through 
that installation and learning curve again.

It works on my computer but I have projects that interfere with the alarm.  
This is why I would prefer to have it on my phone.
I appreciate any assistance you can provide.

Steve

I attached the py code but wonder if it will carry with the message.  It is 
about 100 lines of code but that includes a few ops and whistles that are 
probably not needed in the app.

There's 99 bugs in the code, in the code.
99 bugs in the code.
Take one down and patch it all around.
Now there's 117 bugs in the code.
## Copyright Ambrosini 2017

import re
import random
import time
import datetime
from datetime import datetime

global AX
global ax
AX = 0
AX += 1
ax = str(AX)
#print(" ax = " + ax)


import winsound #as ws


from time import gmtime, strftime ##define strftime as time/date right now
nowTimeDate2=strftime("%Y %a %b %d %H:%M") ##Capture right now Time/date.

print()
print()
print(" " + nowTimeDate2)
print()

global delayTime
global DelayTime

print()
print()
print(" Enter 0 to test the alarm section.")
delayTime = input(" How many hours to next insulin check? (3) ")
if delayTime == "":
delayTime = 3
DelayTime = int(delayTime)
winsound.MessageBeep(-1)
print()
# =

def Alarm(D):
AX = 0
while D >= 1:
   
d = str(D)
AX += 1
ax = str(AX)
print(' ' + ax, end='...' + "\n")
   
time.sleep(60)
D -= 1

import winsound #as wsBeep
winsound.MessageBeep(1)

def countdown(DelayTime):
import time
t = str(DelayTime)
if t == "1":
   print(" An alarm will start sounding in " + t + " hour...")
else:
   print(" An alarm will start sounding in " + t + " hours...")
   
while DelayTime >= 1:
t = str(DelayTime)
import datetime
from datetime import datetime
from time import gmtime, strftime ##define strftime as time/date right 
now
nowTimeDate2=strftime("%Y %a %b %d %H:%M") ##Capture right now 
Time/date.

Yz=nowTimeDate2[0:4]  
mz=nowTimeDate2[9:12]
dz=nowTimeDate2[13:15]
Hz=nowTimeDate2[16:18]
Mz=nowTimeDate2[19:22]

def month_converter(month): ##convert text month to number
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 
'Sep', 'Oct', 'Nov', 'Dec']
return months.index(month) + 1

mz = month_converter(mz)
Hz = int(Hz)
AmPm = " AM"
if Hz > 12:
Hz = Hz - 12
if Hz == 0:
   Hz = 12
AmPm = " PM"
if Hz == 0:
Hz = 12
AmPm = " AM"

Yz = str(Yz)
mz = str(mz)
dz = str(dz)
Hz = str(Hz)
Mz = str(Mz)

Tz = ("" + mz + "-" + dz + "-" + Yz + " " + Hz + ":" + Mz + AmPm)
print(' ' + t + " " + Tz + "\n")
time.sleep(3600)
DelayTime -= 1
import winsound as wsBeep
wsBeep.MessageBeep(1)
 
print(' More Insuin? \n \n \n \n \n')
Alarm(3)

countdown(DelayTime)


EOB = input(" Strike any key to continue")
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> This comment suggest that you have missed the general
> motivation for reservoir sampling.

Please don't get personal.  I've devoted a good deal of time thinking about 
your proposal.  Tim is also giving it an honest look. Please devote some time 
to honestly thinking about what we have to say.

FWIW, this is an area of expertise for me.  I too have been fascinated with 
reservoir sampling for several decades, have done a good deal of reading on the 
topic, and routinely performed statistical sampling as part of my job (where it 
needed to be done in a legally defensible manner).


> The idea of reservoir sampling is that you want to sample from
> an iterator, you only get one chance to iterate over it, and 
> you don't know a priori how many items it will yield.

Several thoughts:

* The need for sampling a generator or one-time stream of data is in the 
"almost never" category.  Presumably, that is why you don't find it in numpy or 
Julia.

* The examples you gave involved dicts or sets.  These aren't one-chance 
examples and we do know the length in advance.

* Whether talking about sets, dicts, generators, or arbitrary iterators, 
"sample(list(it), k)" would still work.  Both ways still have to consume the 
entire input before returning.  So really this is just an optimization, one 
that under some circumstances runs a bit faster, but one that forgoes a number 
of desirable characteristics of the existing tool.  

* IMO, sample_iter() is hard to use correctly.  In most cases, the users would 
be worse off than they are now and it would be challenging to communicate 
clearly under what circumstances they would be marginally better off.

At any rate, my recommendation stands.  This should not be part of standard 
library random module API.  Perhaps it could be a recipe or a see-also link.  
We really don't have to do this.

--

___
Python tracker 

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



[issue29447] Add/check os.PathLike support for the tempfile module's 'dir' arguments

2020-07-17 Thread Christoph Anton Mitterer


Change by Christoph Anton Mitterer :


--
nosy: +calestyo

___
Python tracker 

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



A Python installation help doc much more friendly to newcomers? [Was Re: help]

2020-07-17 Thread boB Stepp
On Fri, Jul 17, 2020 at 9:48 PM dn via Python-list
 wrote:
>
> On 18/07/20 1:53 PM, Castillo, Herbert S wrote:
> > I downloaded python not to long ago, and today when I opened Python on 
> > Windows it gave me a modify setup prompt. I have tried to click on modify , 
> > repair and even uninstalled and installed it back, but when I try to open 
> > Python up again, I keep on getting the same modify setup prompt. I am not 
> > sure of what to do? Thank you in advance.
>
>
> Regret that this mailing list does not support graphics attachments.
>
> Which part of https://docs.python.org/dev/using/windows.html failed?

Just for grins I just now glanced at the link dn provided.  Yes, this
is a very thorough, very accurate, very *technical* help resource.
But if I were a person who had never seen a shell, cmd.exe or
Powershell window, never programmed before, had no clue about how to
truly use my OS, etc., I don't think I would understand a bit of this
"help" document, and, at best, would find it very intimidating.  If
this community does wish to cater to those who are totally new to the
world of programming and learning how to really use their PC at any
depth, then I think a different approach or set of documents is
needed.  And an easier way for those playing with the idea of learning
programming and Python to connect with such documentation.

I think that we take a lot for granted that is second nature to most
of us.  Also, most of us have the mindset that even when all of this
programming stuff was new to us (If we can even truly remember that
anymore.), we would have the problem-solving chops to get over these
hurdles.  Many don't have these native inclinations.  Searching online
for technical solutions is completely foreign to many.  Even searching
for anything may be more challenging than we suspect for some.

I am just a Python hobbyist/dabbler, not a pro like most of you, but I
have taught kids through adults various subjects in the past, helped
seniors, etc., and a lot of what we take for granted is *not* easy for
many.  But I believe that almost everyone that can get to the point of
believing that they can perhaps learn programming, can do so, but may
need some encouragement to get to that point of "self-belief".

Sure, some people are just too lazy and want to be spoon-fed, but I
truly believe that is a minority.  Can we make this easier for those
who really would like to try?

Just some thoughts that I hope will be constructively received.

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


Re: excel (multiple sheets) to yml file for each sheet

2020-07-17 Thread dn via Python-list

On 18/07/20 12:04 PM, stack flow wrote:

help please.

On Thursday, July 16, 2020 at 10:38:23 PM UTC-4, stack flow wrote:

Hi,

I have excel file with multiple sheets and need output as yml file for each 
sheet. could someone help me with python code? following is an example:

aep sheet:

aepaep_description infra_vlan
test_AEP  test aepno

aeps_to_domain sheet:

aep   domaindomain_type
test_AEPtest_PHY_DOMphys
test1_AEP   test1_PHY_DOM   l3dom


scription should output two files:

aeps-vars.yml:

aeps:
   - aep: test_AEP
 aep_description: test aep
 infra_vlan: no


aeps_to_domain-vars.yml:

aeps_to_domain:
   - aep: test_AEP
 domain: test_PHY_DOM
 domain_type: phys
   - aep: test_AEP
 domain: test_L3O_DOM
 domain_type: l3dom



Please show us the Python code which you've completed, and ask a 
specific question about the situation which is challenging you.


Be advised that the members of this list are volunteers. That said, if 
you want to pay someone to code for you, perhaps mention your budget...

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


[issue41314] __future__ doc and PEP 563 conflict

2020-07-17 Thread wyz23x2


Change by wyz23x2 :


--
components: +Library (Lib)

___
Python tracker 

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



Re: Issues in downloading python

2020-07-17 Thread dn via Python-list

On 17/07/20 7:22 PM, Shanmika Sugavaneswaran wrote:

Though I install the setup , I couldn’t find Python in my system . I don’t know 
what cause the problem. Please help me!


Please advise if the answer is not already covered in 
https://docs.python.org/dev/using/windows.html

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


Re: help

2020-07-17 Thread dn via Python-list

On 18/07/20 1:53 PM, Castillo, Herbert S wrote:

I downloaded python not to long ago, and today when I opened Python on Windows 
it gave me a modify setup prompt. I have tried to click on modify , repair and 
even uninstalled and installed it back, but when I try to open Python up again, 
I keep on getting the same modify setup prompt. I am not sure of what to do? 
Thank you in advance.



Regret that this mailing list does not support graphics attachments.

Which part of https://docs.python.org/dev/using/windows.html failed?
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: help

2020-07-17 Thread boB Stepp
On Fri, Jul 17, 2020 at 9:00 PM Castillo, Herbert S
 wrote:

> I downloaded python not to long ago, and today when I opened Python on 
> Windows it gave me a modify setup prompt. I have tried to click on modify , 
> repair and even uninstalled and installed it back, but when I try to open 
> Python up again, I keep on getting the same modify setup prompt. I am not 
> sure of what to do? Thank you in advance.

It sounds like you are just rerunning the python installer.  Instead,
open a command prompt or Powershell and type "py".  That will bring up
the Python interactive environment where you can type Python commands.
Or, probably better, open IDLE -- the provided Python editing
environment -- by pressing your Windows key which brings up the list
of available programs/program folders, find Python, expand that if
needed by clicking on it and then clicking on "IDLE".  That will bring
up the Python interactive prompt as well.  You can also create a new
Python file using the provided "File" menu, etc.  BTW, I am doing this
from memory.  I don't have a Windows PC handy, but hopefully it is
enough to get you over the hump.

BTW, there is a Python Tutor mailing list designed for those learning
Python.  Also, the main Python website has documentation, lists of
resources, tutorial, etc., to also help jumpstart your learning.  Have
fun!

HTH!



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


[issue41220] add optional make_key argument to lru_cache

2020-07-17 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I've left this open for a week to collect comments.  I concur with Felipe that 
this should be the responsibility of the caller.  And I concur with Jim that 
the use cases are likely too rare to warrant shoehorning in the extra 
functionality.

For my part, I'm concerned that this would be bug bait.  The result of the 
function would need to be uniquely associated with a particular output, 
independent of the contents of the mutable arguments.  I don't think it is good 
design for function calls to be disregarding the part of the input that was 
originally used to compute the output — in a way that notion conflict with the 
core idea of the of the lru_cache giving the same outputs for the same inputs.

Likewise, debugging and exception handing would be complicated by having two 
underlying user functions.  Exceptions could arise from three sources: the 
make_key() function, the cached function, and the lru cache internals.

Further, if the make_key() function turns out not to be unique, the ensuring 
bugs would be hard to find.  In the OP's later example, if we get two distinct 
inputs which happen to have the same timestamp, the error would pass without 
warning and would be hard to reproduce.  Similarly, the make_key() function has 
to assume that the mutable portion of the data hasn't mutated, but a key 
feature of mutable data is that it can mutate.  That too would result in a hard 
to find bug.

Also, while the OP has a specific use case in mind, we can't know in advance 
how others will use make_key().  It could be misused to convert mutable data to 
immutable data, possibly resulting in a cached function that is slower than the 
original (caching mean() for example).  Or the make_key() function could had 
side-effects.  The OP's original "my_list[0]" example showed yet another way 
that bugs could arise. It is problematic that that particular bug might not 
have been caught by a test suite that didn't know to call the function twice 
with a common first argument but with differing subsequent arguments.

Another possible bug trap is that it would make it easier to accidentally cache 
mutable function results without getting a warning.  For example:
  @lru_cache(128, make_key = lambda target, size, uniq_id, data: uniq_id)
  def search(target, size, uniq_id, data):
   i = data.index(target)
   return data[i : i+size]# <== bug because this is mutable if data 
is mutable
   
I think the suggestion was a neat idea (and thought provoking), but I think we 
should decline because 1) the use case is uncommon 2) because it makes the API 
harder to understand 3) because it is bug bait and 4) because the 
responsibility should probably be with the caller.

Thank you for the suggestion.  It was inspired.  Don't be discouraged — many of 
my proposals don't get accepted as well.  Please continue to submit suggestions.



P.S. make_key() shouldn't be called a key-function so that we don't make that 
term ambiguous.  Elsewhere key-functions are all about comparison logic rather 
than hashing.  They can be created by functools.cmp_to_key(), they tend to be 
used only once per data element, and the same function tends to be inoperable 
with all the tools that accept key-functions.  So the term make_key() was 
likely the better terminology.  Perhaps get_unique_id() would have been even 
less ambiguous.

--
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



help

2020-07-17 Thread Castillo, Herbert S
Hi,

I downloaded python not to long ago, and today when I opened Python on Windows 
it gave me a modify setup prompt. I have tried to click on modify , repair and 
even uninstalled and installed it back, but when I try to open Python up again, 
I keep on getting the same modify setup prompt. I am not sure of what to do? 
Thank you in advance.

[cid:image002.jpg@01D65C6B.97D73D90]

Herbert S. Castillo
Graduate Student, CSULA
hcast...@calstatela.edu
C: 310-462-6269

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


[issue41271] Add support for io_uring to cpython

2020-07-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I think that the answer is maybe, eventually, and if so, an ioring module that 
any event framework can use and a separate asyncio module for its use with 
asyncio.  I say maybe because the lwn article suggests that additions and 
revisions might continue for a decade or more.  A pypi py_iorin wrapper for 
lib_ioring might need revision with each Linux x.y release for a long time.

The opening question could have been raised on the python-ideas or possibly 
pydev lists.  Since this list is for patches to cpython, creating and 
maintaining a py_ioring package on pypi should be discussed elsewhere.  In the 
meanwhile, this issue could be closed as 'later' ("Issue is to be worked on in 
a later release cycle.").

--
nosy: +terry.reedy

___
Python tracker 

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



[issue41315] Add mathematical functions as wrappers to decimal.Decimal methods

2020-07-17 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

FWIW, I don't really buy into the use case.  In my experience a nest of 
existing functions that are designed for floats will somewhere being using a 
float constant like 0.5, e, pi, or tau.  So, just feeding in a decimal input 
isn't sufficient to get it to work.  Also, for your idea to work, the function 
couldn't explicitly reference math.exp(x); instead, it must just use exp() so 
that you could substitute, "from decimal import exp" for "from math import 
exp". 

Also, this proposal would be a limited utility because most of the functions in 
the math module don't have an existing equivalent in the decimal methods.  The 
inconvenient fact is that the decimal module wasn't designed to be a drop-in 
substitute for floats — it's principal design objectives were somewhat 
different.

--

___
Python tracker 

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



[issue41271] Add support for io_uring to cpython

2020-07-17 Thread Giampaolo Rodola'


Change by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue41297] Remove doctest import from heapq

2020-07-17 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

If not, could modulegraph add a flag to drop imports commonly found in main 
sections:  doctest, unittest, argparse, etc.?   

Asking the standard library to change seems like the tail wagging the dog — it 
only paints over the problem since third-party modules, other standard library 
modules, and user code commonly use main sections as well.

--

___
Python tracker 

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



[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-17 Thread Oscar Benjamin


Oscar Benjamin  added the comment:

> At its heart, this a CPython optimization to take advantage of list() being 
> slower than a handful of islice() calls.

This comment suggest that you have missed the general motivation for reservoir 
sampling. Of course the stdlib can not satisfy all use cases so this can be out 
of scope as a feature. It is not the case though that this is a CPython 
optimisation.

The idea of reservoir sampling is that you want to sample from an iterator, you 
only get one chance to iterate over it, and you don't know a priori how many 
items it will yield. The classic example of that situation is reading from a 
text file but in general it maps neatly onto Python's concept of iterators. The 
motivation for generators/iterators in Python is that there are many situations 
where it is better to avoid building a concrete in-memory data structure and it 
can be possible to avoid doing so with appropriately modified algorithms (such 
as this one). 

The core use case for this feature is not sampling from an in-memory data 
structure but rather sampling from an expensive generator or an iterator over a 
file/database. The premise is that it is undesirable or perhaps impossible to 
build a list out of the items of the iterable. In those contexts the 
comparative properties of sample/choices are to some extent irrelevant because 
those APIs can not be used or should be avoided because of their overhead in 
terms of memory or other resources.

--

___
Python tracker 

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



Re: Python pandas Excel

2020-07-17 Thread dn via Python-list

On 18/07/20 11:06 AM, Dennis Lee Bieber wrote:

On Sat, 18 Jul 2020 09:08:50 +1200, dn via Python-list
 declaimed the following:


Assuming the import produces a string, are you able to "slice" the
string into the requisite components?


Given the OP's stated output -- I would suspect they are being
imported/parsed as DateTime objects. Which is quite likely also what the
column is defined to be in Excel.



Agreed, but the lack of 'how' information reduces us to guessing...

TBH in this mode, I tend to reduce a DateTime to a string and deal with 
it that way; whereas the 'official' answer is likely to use DateTime 
methods to extract the requisite sub-items.
(I've not stopped to perform a speed-comparison, so it's as basic as 
what I 'see' as the more simple option)



More importantly, if that lack indicates that the OP hasn't ascertained 
such details, the earlier questions must be answered before the 
finer-details.

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


[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

More thoughts:

* If sample_iter() were added, people would expect a choices_iter() as well.

* Part of the reason that Set support was being dropped from sample() is that 
it was rarely used and that it was surprising that it was a O(n) operation 
instead of O(k).

--

___
Python tracker 

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



RE: An I connected here?

2020-07-17 Thread Steve
Thanks for the verification.  I received my original message back and that
also shows success in my attempt.  The first message had no such copy back
so it went off somewhere...

Thanks for the guidance but I always try to make the subject line pertinent
and explanatory.  It is the selling point to get results.

I will repost it later.

FootNote:
If money does not grow on trees, then why do banks have branches?

-Original Message-
From: Python-list  On
Behalf Of Grant Edwards
Sent: Friday, July 17, 2020 4:13 PM
To: python-list@python.org
Subject: Re: An I connected here?

On 2020-07-17, Rhodri James  wrote:
> On 17/07/2020 19:33, Steve wrote:
>
>> I posted a request for assistance about a week ago, no response.  I 
>> also see very little traffic here, less than there used to be.  Has 
>> something gone wrong with my set up?
>
> No, nothing's wrong.  I can't answer for anyone else and I can't 
> recall your specific question, but I suspect you were asking about 
> something I know nothing about and wasn't sufficiently intrigued to go
find out about.

And if it's not clear from the subject line that it _is_ something somebody
knows/cares about, then that somebody is unlikely to read the body of the
message.

Subject lines like "help me please" or "Python doesn't work" or "An I
connected here" are likely to be ignored by most of the people who probably
know how to help.  There are a few kind souls who make a habit of reading
those, dog bless em.  [I'm not one of them, I only read this by accident.]

That said, there is definitely less traffic these days.  I assume it's a
continuation the gradual abandonment of usenet/email in favor of various
almost-entirely-useless web "forums".

--
Grant


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

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


Re: excel (multiple sheets) to yml file for each sheet

2020-07-17 Thread stack flow
help please.

On Thursday, July 16, 2020 at 10:38:23 PM UTC-4, stack flow wrote:
> Hi,
> 
> I have excel file with multiple sheets and need output as yml file for each 
> sheet. could someone help me with python code? following is an example:
> 
> aep sheet:
> 
> aepaep_description infra_vlan
> test_AEP  test aepno
> 
> aeps_to_domain sheet:
> 
> aep domaindomain_type
> test_AEP  test_PHY_DOMphys
> test1_AEP test1_PHY_DOM   l3dom
> 
> 
> scription should output two files:
> 
> aeps-vars.yml:
> 
> aeps:
>   - aep: test_AEP
> aep_description: test aep
> infra_vlan: no
> 
> 
> aeps_to_domain-vars.yml:
> 
> aeps_to_domain:
>   - aep: test_AEP
> domain: test_PHY_DOM
> domain_type: phys  
>   - aep: test_AEP
> domain: test_L3O_DOM
> domain_type: l3dom

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


[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-17 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I've put more thought into the proposal and am going to recommend against it.

At its heart, this a CPython optimization to take advantage of list() being 
slower than a handful of islice() calls.  It also gains a speed benefit by 
dropping the antibias logic because random() is faster than _randbelow().  IMO, 
this doesn't warrant an API extension.  I'm not looking forward to years of 
teaching people that there are two separate APIs for sampling without 
replacement and that the second one is almost never what they should use.

A few years ago, GvR rejected adding a pre-sizing argument to dicts even though 
there were some cases where it gave improved performance.  His rationale was 
that it was challenging for a user to know when they were better off and when 
they weren't.  It added a new complication that easily led to suboptimal 
choices. IMO, this new API puts the users in a similar situation.  There are a 
number of cases where a person is worse off, sometimes much worse off.

This new code runs O(n) instead of O(k).  It eats more entropy. It loses the 
the antibias protections.  The API makes it less explicit that the entire input 
iterable is consumed.  It can only be beneficial is the input is not a 
sequence.  When k gets bigger, the repeated calls to islice() become more 
expensive than a single call to list.   And given the math library functions 
involved, I not even sure that this code can guarantee it gives the same 
results across platforms.

Even if the user makes a correct initial decision about which API to use, the 
decision can become invalidated when the population sizes or sample sizes 
change over time.

Lastly, giving users choices between two substantially similar tools typically 
makes them worse off.  It creates a new burden to learn, remember, and 
distinguish the two.  It's really nice that we currently have just one sample() 
and that it behaves well across a broad range of cases — you generally get a 
good result without having to think about it.  Presumably, that was the wisdom 
behind having one-way-to-do-it.

--

___
Python tracker 

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



[issue41024] doc: Explicitly mention use of 'enum.Enum' as a valid container for 'choices' argument of 'argparse.ArgumentParser.add_argument'

2020-07-17 Thread Raymond Hettinger

Raymond Hettinger  added the comment:


New changeset 760552ceb8c5f5ca4f1bf13f47543b42b25e0b83 by Miss Islington (bot) 
in branch '3.9':
bpo-41024: doc: Explicitly mention use of 'enum.Enum' as a valid container for 
'… (GH-20964) (GH-21527)
https://github.com/python/cpython/commit/760552ceb8c5f5ca4f1bf13f47543b42b25e0b83


--

___
Python tracker 

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



[issue41024] doc: Explicitly mention use of 'enum.Enum' as a valid container for 'choices' argument of 'argparse.ArgumentParser.add_argument'

2020-07-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the PR.

--
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



[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-17 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
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: frozendict: an experiment

2020-07-17 Thread Marco Sulla
On Fri, 17 Jul 2020 at 04:13, Inada Naoki  wrote:
> > 3. many python internals uses a mapping proxy to a dict, to avoid its
> > modification. A frozendict can be used instead.
>
> Are they used frequently in performance critical path?
> Could you point some concrete examples?

I searched a little in CPython code, and it seems that MappingProxy is
used in a number of critical points.

In re:
./Modules/_sre.c:return PyDictProxy_New(self->groupindex);

in mutiprocessing:
./Lib/multiprocessing/managers.py:DictProxy = MakeProxyType('DictProxy', (
./Lib/multiprocessing/managers.py:DictProxy._method_to_typeid_ = {
./Lib/multiprocessing/managers.py:SyncManager.register('dict', dict, DictProxy)

In functools:
./Lib/functools.py:wrapper.registry = types.MappingProxyType(registry)

In enum:
./Lib/enum.py:return MappingProxyType(cls._member_map_)

I suppose the more crucial is _sre, since it's used extensively in
CPython. groupindex is used by a large number of _sre functions.
Note: I'm not sure that mappingproxyobject is much slower than dict,
as types.MappyingProxyType.

On Fri, 17 Jul 2020 at 04:13, Inada Naoki  wrote:
> I am not sure tuple is "internined" or just "merged". (I don't know precise
> definition of the "interning").
>
> Tuples are merged while compiling.
>
> ```
> for a in ["foo", "bar"]:  # compiler convert this list to tuple
> ...
> for b in ("foo", "bar"):  # and compiler merge same tuple
> ...
> ```
>
> But when frozendicts are merged?
> I think there is a very little chance.

frozendicts could be used for kwargs:

f(a=1, b=2)
# some code
f(a=1, b=2)

For what I know, CPython uses PyDictObject for kwargs. Since dicts are
mutable, it's a problem to cache them properly.

On Fri, 17 Jul 2020 at 04:13, Inada Naoki  wrote:
> I'm OK to all combined dict for frozen dict.  But I think key-sharing is still
> interesting optimization for frozen dict. And supporting key-sharing dict
> is much easier for frozendict than for mutable dict.

Yes, I think the same.

On Fri, 17 Jul 2020 at 04:13, Inada Naoki  wrote:
> Then, there is no reason to not support the view for frozendict?

I didn't say to not support views... I said that "real objects", that
implement the dictview API, could be returned by frozendict.keys()
etc.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fake news Detect

2020-07-17 Thread Grant Edwards
On 2020-07-17, Dennis Lee Bieber  wrote:
> On Fri, 17 Jul 2020 16:02:15 - (UTC), Gazu  declaimed
> the following:
>
>>Hey Guys I am new to python and i am building a fake news detection
>>system ...
>
>   I suspect that, if anyone had done this already, it would likely be
> found on some source code archive (github?) -- and you'd just be
> duplicating the effort.
>
>   Essentially, since the core of this functionality depends upon the
> algorithm, YOU will have to develop the algorithm.

Or he could do something easier like eliminating hunger, war and
Covid-19.

--
Grant

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


Re: An I connected here?

2020-07-17 Thread Grant Edwards
On 2020-07-17, Rhodri James  wrote:
> On 17/07/2020 19:33, Steve wrote:
>
>> I posted a request for assistance about a week ago, no response.  I
>> also see very little traffic here, less than there used to be.  Has
>> something gone wrong with my set up?
>
> No, nothing's wrong.  I can't answer for anyone else and I can't recall 
> your specific question, but I suspect you were asking about something I 
> know nothing about and wasn't sufficiently intrigued to go find out about.

And if it's not clear from the subject line that it _is_ something
somebody knows/cares about, then that somebody is unlikely to read the
body of the message.

Subject lines like "help me please" or "Python doesn't work" or "An I
connected here" are likely to be ignored by most of the people who
probably know how to help.  There are a few kind souls who make a
habit of reading those, dog bless em.  [I'm not one of them, I only
read this by accident.]

That said, there is definitely less traffic these days.  I assume it's
a continuation the gradual abandonment of usenet/email in favor of
various almost-entirely-useless web "forums".

--
Grant


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


[issue41024] doc: Explicitly mention use of 'enum.Enum' as a valid container for 'choices' argument of 'argparse.ArgumentParser.add_argument'

2020-07-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The backport failed for 3.9.  I'll trigger it again.

Don't see a need to go back to older versions.  This is a minor informational 
note, not a bug.

--
versions:  -Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue41024] doc: Explicitly mention use of 'enum.Enum' as a valid container for 'choices' argument of 'argparse.ArgumentParser.add_argument'

2020-07-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20663
status: pending -> open
pull_request: https://github.com/python/cpython/pull/21527

___
Python tracker 

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



[issue41329] IDLE not saving .py files

2020-07-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

In calling this a duplicate, and suggesting the fix above, I am assuming that 
a) you are using the new 3.8.4 and b) you have a non-ascii character in the .py 
file or files you tested.  Since several years ago, the is the only case of 
save failing that I know of.  If either is not the case, please reopen and 
report exact os, python version, minimal file that does not save, and any other 
possibly relevant details you can think of.

--

___
Python tracker 

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



[issue41329] IDLE not saving .py files

2020-07-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Add 'import io' to the top of /Lib/idlelib/iomenu.py.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDLE: add missing import io in iomenu.py

___
Python tracker 

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



Re: Python pandas Excel

2020-07-17 Thread dn via Python-list

On 18/07/20 3:36 AM, J Conrado wrote:

HI,

I have an excel file with several columns, the first day/month,/year and 
hour:


Data
01/11/2017 00:00
01/11/2017 03:00

...

Please, how can I get four arrays for day, month, year and hour this 
column of my excel.



What do you have so-far?
How are you importing the Excel data into the Python environment?
Are you able to import a single cell's value, eg "01/11/2017 00:00"
Assuming the import produces a string, are you able to "slice" the 
string into the requisite components?

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


[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-17 Thread Tim Peters


Tim Peters  added the comment:

Julia's randsubseq() doesn't allow to specify the _size_ of the output desired. 
It picks each input element independently with probability p, and the output 
can be of any size from 0 through the input's size (with mean output length 
p*length(A)). Reservoir sampling is simply irrelevant to that, although they 
almost certainly use a form of skip-generation internally.

The quoted docs don't make much sense: for any given p, O(p*N) = O(N). I'm 
guessing they're trying to say that the mean of the number of times the RNG is 
called is p*N.

--

___
Python tracker 

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



[issue41297] Remove doctest import from heapq

2020-07-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Ronald, can modulegraph be made smarter with respect to sections of code 
guarded by __name__ == '__main__'?That Python idiom is old and pervasive.

--

___
Python tracker 

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



[issue41319] IDLE 3.8 can not save and run this file

2020-07-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

宋嘉腾 put 'import io' at the top of idlelib/iomenu.py

--

___
Python tracker 

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



[issue41329] IDLE not saving .py files

2020-07-17 Thread Nick.Lupariello


New submission from Nick.Lupariello :

IDLE will not save .py files. Neither Ctrl + S nor file -> Save file nor file 
-> Save file as function as intended and the .py file is not updated. 
This happens for both 32 bit and 64 bit distributions on multiple computers 
with 4 GB of ram running on a AMD A6-9220e RADEON R4. Tested installation in 
multiple locations. 
IDLE will not write to file anywhere in the file system including documents, 
desktop, and the installation folder itself.

--
assignee: terry.reedy
components: IDLE
messages: 373854
nosy: nicklupe13, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE not saving .py files
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Other implementations aren't directly comparable, but I thought I would check 
to see what others were doing:

* Scikit-learn uses reservoir sampling but only when k / n > 0.99.  Also, it 
requires a follow-on step to shuffle the selections.

* numpy does not use reservoir sampling.

* Julia's randsubseq() does not use reservoir sampling.  The docs guarantee 
that, "Complexity is linear in p*length(A), so this function is efficient even 
if p is small and A is large."

--

___
Python tracker 

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



[issue41328] Hudson CI is not available anymore

2020-07-17 Thread Dmytro Litvinov


New submission from Dmytro Litvinov :

In the documentation (https://docs.python.org/3.8/library/unittest.html) there 
is a mention of Hudson(http://hudson-ci.org/) as continuous integration system 
for tests. According to 
wikipedia(https://en.wikipedia.org/wiki/Hudson_(software)), Hudson "Having been 
replaced by Jenkins, Hudson is no longer maintained[9][10] and was announced as 
obsolete in February 2017.[11]" 

My recommendation for that is to change the mention of "Hudson" to "Jenkins".

I am ready to prepare PR for that change.

--
assignee: docs@python
components: Documentation
messages: 373852
nosy: DmytroLitvinov, docs@python
priority: normal
severity: normal
status: open
title: Hudson CI is not available anymore
type: enhancement

___
Python tracker 

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



Re: Fake news Detect

2020-07-17 Thread Orges Leka
you could use scikit learn tfidf and svm or random forest.
for this you need labeled data ( fake news, no fake news) you could start
at Kaggle (natural language processing) if you are new to this.


Reto  schrieb am Fr., 17. Juli 2020, 20:49:

> What you want is called "natural language processing" and whole research
> papers
> have been written about this topic.
>
> Search your favorite research paper index for those keywords, say google
> scholar.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41327] Windows Store "stub" Python executables give confusing behaviour

2020-07-17 Thread Tzu-ping Chung

Tzu-ping Chung  added the comment:

FWIW, I tweeted about this a while ago (January) and IIRC Steve said there’s 
plan to change that. https://twitter.com/uranusjr/status/1212450480917340160

--
nosy: +uranusjr

___
Python tracker 

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



Re: An I connected here?

2020-07-17 Thread Rhodri James

On 17/07/2020 20:12, J. Pic wrote:

And Hollidays ;)


Nah, that's next week ;-)



Le ven. 17 juil. 2020 à 21:03, Rhodri James  a écrit :


On 17/07/2020 19:33, Steve wrote:

Sorry folks, I really messed that one up.  I tried to doctor up a reply

to

get the address correct but failed to delete enough to own the message...


Yeah, don't do that.  Just start a new message, otherwise you'll end up
with all the threading for the old message thread, irritating those of
us who sort by thread so that we aren't chopping and changing subject
all the time :-/


My message did not have anything to do with the "Fake News Detect"

subject.


I posted a request for assistance about a week ago, no response.  I also

see

very little traffic here, less than there used to be.  Has something gone
wrong with my set up?


No, nothing's wrong.  I can't answer for anyone else and I can't recall
your specific question, but I suspect you were asking about something I
know nothing about and wasn't sufficiently intrigued to go find out about.

I think there are fewer experts with time lurking around here (and I
don't count myself as one of those, TBH).  Recent controversies and the
attempts to moderate them have probably upset quite a lot of people one
way or another.

--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list






--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


[issue41322] unittest: Generator test methods will always be marked as passed

2020-07-17 Thread Zachary Ware


Zachary Ware  added the comment:

In the same vein as Serhiy's suggestion, I would like to see unittest raise a 
DeprecationWarning when a test method returns anything other than `None`, and 
eventually switch that to an error (probably TypeError or ValueError).

--
nosy: +zach.ware

___
Python tracker 

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



Re: An I connected here?

2020-07-17 Thread J. Pic
And Hollidays ;)

Le ven. 17 juil. 2020 à 21:03, Rhodri James  a écrit :

> On 17/07/2020 19:33, Steve wrote:
> > Sorry folks, I really messed that one up.  I tried to doctor up a reply
> to
> > get the address correct but failed to delete enough to own the message...
>
> Yeah, don't do that.  Just start a new message, otherwise you'll end up
> with all the threading for the old message thread, irritating those of
> us who sort by thread so that we aren't chopping and changing subject
> all the time :-/
>
> > My message did not have anything to do with the "Fake News Detect"
> subject.
> >
> > I posted a request for assistance about a week ago, no response.  I also
> see
> > very little traffic here, less than there used to be.  Has something gone
> > wrong with my set up?
>
> No, nothing's wrong.  I can't answer for anyone else and I can't recall
> your specific question, but I suspect you were asking about something I
> know nothing about and wasn't sufficiently intrigued to go find out about.
>
> I think there are fewer experts with time lurking around here (and I
> don't count myself as one of those, TBH).  Recent controversies and the
> attempts to moderate them have probably upset quite a lot of people one
> way or another.
>
> --
> Rhodri James *-* Kynesim Ltd
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41327] Windows Store "stub" Python executables give confusing behaviour

2020-07-17 Thread Paul Moore


Paul Moore  added the comment:

I thought that might be the answer. But does anyone know where I can repost 
this as an issue against the Store distribution? I'm happy to report there if I 
can find out how...

Hopefully Steve can point me in the right direction.

--

___
Python tracker 

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



Re: An I connected here?

2020-07-17 Thread Rhodri James

On 17/07/2020 19:33, Steve wrote:

Sorry folks, I really messed that one up.  I tried to doctor up a reply to
get the address correct but failed to delete enough to own the message...


Yeah, don't do that.  Just start a new message, otherwise you'll end up 
with all the threading for the old message thread, irritating those of 
us who sort by thread so that we aren't chopping and changing subject 
all the time :-/



My message did not have anything to do with the "Fake News Detect" subject.

I posted a request for assistance about a week ago, no response.  I also see
very little traffic here, less than there used to be.  Has something gone
wrong with my set up?


No, nothing's wrong.  I can't answer for anyone else and I can't recall 
your specific question, but I suspect you were asking about something I 
know nothing about and wasn't sufficiently intrigued to go find out about.


I think there are fewer experts with time lurking around here (and I 
don't count myself as one of those, TBH).  Recent controversies and the 
attempts to moderate them have probably upset quite a lot of people one 
way or another.


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


[issue41323] Perform "peephole" optimization directly on control-flow graph.

2020-07-17 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

+1 This looks like a nice improvement.  I've long wanted the optimizations to 
be moved upstream.  

At the time the peephole logic was first written, operating directly on the 
code object was the only option that kept optimizations separate from the core 
compiler logic. But disassembling and reassembling bytecode was always awkward 
— it is nice to no longer have to do so.

--
nosy: +rhettinger

___
Python tracker 

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



[issue41327] Windows Store "stub" Python executables give confusing behaviour

2020-07-17 Thread Brett Cannon


Brett Cannon  added the comment:

Closing as "third-party" as those stubs are controlled by Microsoft Windows and 
has nothing to do with us as a project beyond that they install the Windows 
Store copy that Steve uploads (although this is all feedback to Steve who has 
connections on the Windows team).

And I will say I believe there are shims on some Linux distros like Ubuntu for 
things like venv, pip, etc. which are not included in-box which people 
typically expect to be there.

--
nosy: +brett.cannon
resolution:  -> third party
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



Re: Fake news Detect

2020-07-17 Thread Reto
What you want is called "natural language processing" and whole research papers
have been written about this topic.

Search your favorite research paper index for those keywords, say google 
scholar.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41323] Perform "peephole" optimization directly on control-flow graph.

2020-07-17 Thread Brett Cannon


Change by Brett Cannon :


--
nosy: +vstinner

___
Python tracker 

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



[issue41327] Windows Store "stub" Python executables give confusing behaviour

2020-07-17 Thread Paul Moore


Paul Moore  added the comment:

See, for example, https://github.com/pypa/packaging-problems/issues/379 as an 
illustration of the user (and project maintainer!) confusion this causes.

--

___
Python tracker 

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



[issue41327] Windows Store "stub" Python executables give confusing behaviour

2020-07-17 Thread Paul Moore


New submission from Paul Moore :

First of all, I do know that this is an issue with the Windows Store 
distribution, rather than the python.org one. But (a) I don't know where to 
report a bug against the Store implementation except here, and (b) it's 
arguably a case of the Windows implementation "stealing" the Python command, so 
worth flagging against core Python.

The problem is that Windows 10 installs `python` and `python3` executables by 
default, which open the Windows Store offering to install Python. That's not a 
bad thing - it's nice to have Python available with the OS! Although (see 
below) hijacking the `python` and `python3` commands for this purpose has some 
problems.

But those stubs silently do nothing when run with command line arguments, and 
because the python.org distribution doesn't put Python on PATH by default, 
users end up with the stubs available even if they install python.org Python.

We're getting a lot of bug reports from users as a result of this, when they 
follow standard instructions like "execute `python -m pip`". With the stub on 
the path, this silently does nothing, even though the user has installed 
Python. This is a very bad user experience, and not one that projects like pip 
can do anything to alleviate, other than having extremely convoluted "how to 
run pip" commands:

"""
To run pip, type `python -m pip` if you're on Unix, and `py -m pip` on Windows. 
Unless you're using the Windows Store version when you should do `python -m 
pip` on Windows too. Or on Unix when you might need to do `python3 -m pip`. 
Or...
"""

I don't have a good answer to this issue. Maybe the Windows Store stubs could 
detect core Python and do something better if it's installed? Maybe the stubs 
should print an explanatory message if run with command line arguments? Maybe 
Store Python should be available on Windows via some less error-prone mechanism?

I'm pretty sure if a Linux distribution shipped a `python` command that didn't 
run Python the way users expected, there would be complaints. After all, we 
have PEP 394 that explicitly states how we expect Unix systems to work. Maybe 
we need something similar for Windows?

--
assignee: steve.dower
components: Windows
messages: 373845
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Windows Store "stub" Python executables give confusing behaviour
versions: Python 3.9

___
Python tracker 

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



about the function in class

2020-07-17 Thread xuanwu348
Hi, all


There are some methods to define functions in a class, include member 
functions, static method, class method. 


My question is that which type of function for  "decorate(f),diff_con(f)" 


I think these functions all were  belong to member function, (f <-->self) f can 
be replace by self.


but how to explain "decorate(f)", "@decorate(f)"
if f == self; then in wrapper function: res = self(*args, **kwargs)
and self means Diff_methods("somgthing") <==> Diff_methods("somgthing")(*args, 
**kwargs)
But it's not correct. 


thanks
lass Diff_methods:

def __init__(self, something):
self.something = something

def decorate(f):
@wraps(f)
def wrapper(*args, **kwargs):
start_time = time.time()
res = f(*args, **kwargs)
elapse = time.time() - start_time
return res, elapse
return wrapper

def diff_con(f):
print(f.something)
@decorate
def member_function(self, n):
return 2 << n

@staticmethod
def static_function():
pass

@classmethod
def class_method(cls):
pass

if __name__ == "__main__":

s = Diff_methods("something")
print(s.member_function(10))
s.diff_con()

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


An I connected here?

2020-07-17 Thread Steve
Sorry folks, I really messed that one up.  I tried to doctor up a reply to
get the address correct but failed to delete enough to own the message...

My message did not have anything to do with the "Fake News Detect" subject. 

I posted a request for assistance about a week ago, no response.  I also see
very little traffic here, less than there used to be.  Has something gone
wrong with my set up?

My goof, sorry about that.


Footnote:
There's 99 bugs in the code, in the code.
99 bugs in the code.
Take one down and patch it all around.
Now there's 117 bugs in the code.

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


Re: Issues in downloading python

2020-07-17 Thread Mats Wichmann
On 7/17/20 11:09 AM, Abhiram R wrote:
> It's most likely because you haven't added Python to your environment PATH
> variable.
> 
> The easiest path forward is to uninstall it from Applications and then when
> you reinstall, tick the option on the bottom of the first splash screen of
> the installer. It will add Python to your PATH variable automatically and
> you should be able to access it from CMD after that.
> 
> Regards
> Abhiram R 

The Python Launcher exists for this purpose.  Otherwise, as Abhiram
notes, you have to add to PATH, which on Windows is a bit of an
irritant, because that path entry will change as the Python version
changes (e.g. when you change from 3.8 to 3.9 you'll have a different
default path location). Try locating Python by using the command

py

in a command shell (or in PowerShell).


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


[issue41326] Build failure in blurb-it repo: "Failed building wheel for yarl"

2020-07-17 Thread Mariatta


Mariatta  added the comment:

Adding Victor Stinner to nosy

--
nosy: +vstinner

___
Python tracker 

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



[issue41326] Build failure in blurb-it repo: "Failed building wheel for yarl"

2020-07-17 Thread Mariatta

New submission from Mariatta :

We're seeing travis CI build failure against the nightly Python build v3.10.0a0.

Build log: https://travis-ci.org/github/python/blurb_it/jobs/707532881

Last few lines of the build log:


In file included from 
/opt/python/3.10-dev/include/python3.10/unicodeobject.h:1026:0,
   from /opt/python/3.10-dev/include/python3.10/Python.h:97,
   from yarl/_quoting.c:4:
  /opt/python/3.10-dev/include/python3.10/cpython/unicodeobject.h:551:42: note: 
declared here
   Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
^
  yarl/_quoting.c: In function ‘__Pyx_decode_c_bytes’:
  yarl/_quoting.c:9996:9: warning: ‘PyUnicode_FromUnicode’ is deprecated 
[-Wdeprecated-declarations]
   return PyUnicode_FromUnicode(NULL, 0);
   ^
  In file included from 
/opt/python/3.10-dev/include/python3.10/unicodeobject.h:1026:0,
   from /opt/python/3.10-dev/include/python3.10/Python.h:97,
   from yarl/_quoting.c:4:
  /opt/python/3.10-dev/include/python3.10/cpython/unicodeobject.h:551:42: note: 
declared here
   Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
^
  error: command '/usr/bin/gcc' failed with exit code 1
  
  ERROR: Failed building wheel for yarl


I'm not familiar with that part of codebase. If anyone has any insight, it 
would be appreciated. Thanks.

--
messages: 373843
nosy: Mariatta
priority: normal
severity: normal
status: open
title: Build failure in blurb-it repo: "Failed building wheel for yarl"
type: compile error
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



[issue41324] Add a minimal decimal capsule API

2020-07-17 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I probably won't try it out explicitly (it's basically cumbersome for us to 
test with non-release Pythons, because of our dependencies to Numpy and 
Cython), but reviewing the API should be enough anyway.

--

___
Python tracker 

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



Re: Issues in downloading python

2020-07-17 Thread Daley Okuwa via Python-list
 on linux or windows
On Friday, 17 July 2020, 17:57:01 BST, Shanmika Sugavaneswaran 
 wrote:  
 
 Though I install the setup , I couldn’t find Python in my system . I don’t 
know what cause the problem. Please help me!



Sent from Mail for Windows 10

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


[issue1823] Possible to set invalid Content-Transfer-Encoding on email.mime.multipart.MIMEMultipart

2020-07-17 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

I agree with @Victor. I removed the easy tag on this easy

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue1823] Possible to set invalid Content-Transfer-Encoding on email.mime.multipart.MIMEMultipart

2020-07-17 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
keywords:  -easy

___
Python tracker 

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



[issue41317] sock_accept() does not remove server socket reader on cancellation

2020-07-17 Thread Alex Grönholm

Alex Grönholm  added the comment:

This bug is the same as https://bugs.python.org/issue30064 except for 
sock_accept().

--

___
Python tracker 

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



[issue41325] Document addition of `mock.call_args.args` and `mock.call_args.kwargs` in 3.8

2020-07-17 Thread Jordan Speicher


Change by Jordan Speicher :


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

___
Python tracker 

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



RE: Fake news Detect

2020-07-17 Thread Steve
I posted a request for assistance about a week ago, no response.  I also see
very little traffic here, less than there used to be.  Has something gone
wrong with my set up?



Footnote:
There's 99 bugs in the code, in the code.
99 bugs in the code.
Take one down and patch it all around.
Now there's 117 bugs in the code.

-Original Message-
From: Python-list  On
Behalf Of Gazu
Sent: Friday, July 17, 2020 12:02 PM
To: python-list@python.org
Subject: Fake news Detect

Hey Guys I am new to python and i am building a fake news detection system
my goal is that when some one post a news the system will check it by
searching that news on Web and find solution that whether that news is Fake
or Not.
But the issue is that i have no idea how to search on Web or which algorithm
to use. However i know about web scrapping and other stuff, so guys help me
out on this by giving your remarks.
thanks in advance.
--
https://mail.python.org/mailman/listinfo/python-list

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


[issue41325] Document addition of `mock.call_args.args` and `mock.call_args.kwargs` in 3.8

2020-07-17 Thread Jordan Speicher


New submission from Jordan Speicher :

`args` and `kwargs` were added to unittest `mock.call_args` in 
https://bugs.python.org/issue21269 however documentation was not updated to 
state that this was added in python 3.8

--
assignee: docs@python
components: Documentation
messages: 373839
nosy: docs@python, uspike
priority: normal
severity: normal
status: open
title: Document addition of `mock.call_args.args` and `mock.call_args.kwargs` 
in 3.8
versions: Python 3.10, 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: Issues in downloading python

2020-07-17 Thread Abhiram R
It's most likely because you haven't added Python to your environment PATH
variable.

The easiest path forward is to uninstall it from Applications and then when
you reinstall, tick the option on the bottom of the first splash screen of
the installer. It will add Python to your PATH variable automatically and
you should be able to access it from CMD after that.

Regards
Abhiram R 

On Fri, Jul 17, 2020 at 10:28 PM Shanmika Sugavaneswaran <
shanmisugu8...@outlook.com> wrote:

> Though I install the setup , I couldn’t find Python in my system . I don’t
> know what cause the problem. Please help me!
>
>
>
> Sent from Mail for
> Windows 10
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


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


[issue39280] Don't allow datetime parsing to accept non-Ascii digits

2020-07-17 Thread Ram Rachum


Change by Ram Rachum :


--
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



Issues in downloading python

2020-07-17 Thread Shanmika Sugavaneswaran
Though I install the setup , I couldn’t find Python in my system . I don’t know 
what cause the problem. Please help me!



Sent from Mail for Windows 10

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


Web Developer | Job position at CMCC Foundation, Italy

2020-07-17 Thread CMCC Info

/Please, feel free to circulate //to anyone you think may be interested.///
--

Web Developer (code 11648*)* 

*Deadline: **23/08/2020*

The CMCC is taking into consideration the possibility to hire a 
talented, motivated and proactive Web Developer to support research and 
development activities.
This job announcement is a public invitation to express interest for the 
above mentioned CMCC Position.


 The location of reference is CMCC premises in Lecce, Italy.

The primary purposes for this position are to support the CMCC 
Communication and Media Office in the design, development, realization, 
and maintenance of websites and web-based products and initiatives that 
are aimed at:


- disseminating the CMCC’s scientific research and its outcomes
- exploring innovative languages to communicate climate science to a 
vast and diversified audience.


_The desired qualifications are:_

    Experience in WordPress websites, themes and plugins development 
and maintenance;
    Experience with web tools and languages like HTML, CSS3, SASS, 
JavaScript and PHP, SQL programming languages and good attitude to learn 
new tools and software languages and paradigms;

    Experience with Unix/Linux and MAC OS Systems;
    Experience with computer graphics software: raster and vector graphic;
    Experience with development tools (github, docker, pipelines 
building tools);
    Experience with remote collaboration and office tools like GSuite 
and good attitude in working with teams;

    Fluency in English language;
    Attitude to work remotely and availability to take part in meeting 
in presence and in videoconference;

    Willing to travel in Italy and abroad.

_Appreciated qualifications and skills:_

    Competencies in sysadmin tasks for GNU/Linux systems;
    Experience with frontend frameworks and libraries (like React, 
jQuery, d3.js);

    Experience of devops tools like terraform, ansible;
    Experience with cloud services providers (AWS, Google Cloud);
    Experience with backend environments like Node.js;
    Experience with the Clojure/ClojureScript language.

Belonging to legally protected categories (ex L. 68/99) will constitute 
a preferential condition.


The initial appointment is for 12 months starting from September 2020 at 
an annual salary ranging from 20K to 30K Euros, comprehensive of 
benefits, depending on qualification and experience.


*How to Apply*
Applicants should register to CMCC JAM (Job Application Manager) website 
and fill the online form following the link below:

http://jam.cmcc.it/careers/apply/11648/

--

Fondazione Centro Euro-Mediterraneo sui Cambiamenti Climatici
Web: www.cmcc.it  - Contact us: i...@cmcc.it 



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


[issue41304] [CVE-2020-15801] python 38 embed ignore python38._pth file on windows

2020-07-17 Thread Steve Dower


Steve Dower  added the comment:


New changeset a16ac4e43c8ed15bf2fca52df3a0a5de26ad2705 by Miss Islington (bot) 
in branch '3.9':
bpo-41304: Update NEWS to include CVE-2020-15801 reference (GH-21521)
https://github.com/python/cpython/commit/a16ac4e43c8ed15bf2fca52df3a0a5de26ad2705


--

___
Python tracker 

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



[issue41304] [CVE-2020-15801] python 38 embed ignore python38._pth file on windows

2020-07-17 Thread Steve Dower


Steve Dower  added the comment:


New changeset 79ed1a53fa44a1b74e3c24c9d5f698abd9610921 by Miss Islington (bot) 
in branch '3.8':
bpo-41304: Update NEWS to include CVE-2020-15801 reference (GH-21521)
https://github.com/python/cpython/commit/79ed1a53fa44a1b74e3c24c9d5f698abd9610921


--

___
Python tracker 

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



[issue41304] [CVE-2020-15801] python 38 embed ignore python38._pth file on windows

2020-07-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20660
pull_request: https://github.com/python/cpython/pull/21524

___
Python tracker 

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



[issue41304] [CVE-2020-15801] python 38 embed ignore python38._pth file on windows

2020-07-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20661
pull_request: https://github.com/python/cpython/pull/21523

___
Python tracker 

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



[issue41304] [CVE-2020-15801] python 38 embed ignore python38._pth file on windows

2020-07-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20659
pull_request: https://github.com/python/cpython/pull/21522

___
Python tracker 

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



[issue41304] [CVE-2020-15801] python 38 embed ignore python38._pth file on windows

2020-07-17 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +20658
pull_request: https://github.com/python/cpython/pull/21521

___
Python tracker 

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



[issue41304] [CVE-2020-15801] python 38 embed ignore python38._pth file on windows

2020-07-17 Thread Steve Dower


Steve Dower  added the comment:

This is now assigned CVE-2020-15801

--
title: python 38 embed ignore python38._pth file on windows -> [CVE-2020-15801] 
python 38 embed ignore python38._pth file on windows

___
Python tracker 

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



[issue21625] Make help() beginner helpful when no PAGER or LESS variable

2020-07-17 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 7.0 -> 8.0
pull_requests: +20657
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/21520

___
Python tracker 

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



Fake news Detect

2020-07-17 Thread Gazu
Hey Guys I am new to python and i am building a fake news detection system
my goal is that when some one post a news the system will check it by searching
that news on Web and find solution that whether that news is Fake or Not.
But the issue is that i have no idea how to search on Web or which algorithm
to use. However i know about web scrapping and other stuff,
so guys help me out on this by giving your remarks.
thanks in advance.
-- 
https://mail.python.org/mailman/listinfo/python-list


Python pandas Excel

2020-07-17 Thread J Conrado












HI,


I have an excel file with several columns, the first day/month,/year and 
hour:



Data
01/11/2017 00:00
01/11/2017 03:00
01/11/2017 06:00
01/11/2017 09:00
01/11/2017 12:00
01/11/2017 15:00
01/11/2017 18:00
01/11/2017 21:00
02/11/2017 00:00
02/11/2017 03:00
02/11/2017 06:00
02/11/2017 09:00
02/11/2017 12:00
02/11/2017 15:00
02/11/2017 18:00
02/11/2017 21:00
03/11/2017 00:00
03/11/2017 03:00
03/11/2017 06:00
03/11/2017 09:00
03/11/2017 12:00
03/11/2017 15:00
03/11/2017 18:00
03/11/2017 21:00
04/11/2017 00:00
04/11/2017 03:00
04/11/2017 06:00
04/11/2017 09:00
04/11/2017 12:00
04/11/2017 15:00
04/11/2017 18:00
04/11/2017 21:00
05/11/2017 00:00
05/11/2017 03:00
05/11/2017 06:00
05/11/2017 09:00
05/11/2017 12:00
05/11/2017 15:00
05/11/2017 18:00
05/11/2017 21:00
06/11/2017 00:00
06/11/2017 03:00
06/11/2017 06:00
06/11/2017 09:00
06/11/2017 12:00
06/11/2017 15:00
06/11/2017 18:00
06/11/2017 21:00
07/11/2017 00:00
07/11/2017 03:00
07/11/2017 06:00
07/11/2017 09:00
07/11/2017 12:00
07/11/2017 15:00
07/11/2017 18:00
07/11/2017 21:00
08/11/2017 00:00
08/11/2017 03:00
08/11/2017 06:00
08/11/2017 09:00
08/11/2017 12:00
08/11/2017 15:00
08/11/2017 21:00
09/11/2017 00:00
09/11/2017 03:00
09/11/2017 06:00
09/11/2017 09:00
09/11/2017 12:00
09/11/2017 15:00
09/11/2017 18:00
09/11/2017 21:00
10/11/2017 00:00
10/11/2017 03:00
10/11/2017 06:00
10/11/2017 09:00
10/11/2017 12:00
10/11/2017 15:00
10/11/2017 18:00
10/11/2017 21:00
11/11/2017 00:00
11/11/2017 03:00
11/11/2017 06:00
11/11/2017 09:00
11/11/2017 12:00
11/11/2017 15:00
11/11/2017 18:00
11/11/2017 21:00
12/11/2017 00:00
12/11/2017 03:00
12/11/2017 06:00
12/11/2017 09:00
12/11/2017 12:00
12/11/2017 15:00
12/11/2017 18:00
12/11/2017 21:00
13/11/2017 00:00
13/11/2017 03:00
13/11/2017 06:00
13/11/2017 09:00
13/11/2017 12:00
13/11/2017 15:00
13/11/2017 18:00
13/11/2017 21:00
14/11/2017 00:00
14/11/2017 03:00
14/11/2017 06:00
14/11/2017 09:00
14/11/2017 12:00
14/11/2017 15:00
14/11/2017 18:00
14/11/2017 21:00
15/11/2017 00:00
15/11/2017 03:00
15/11/2017 06:00
15/11/2017 09:00
15/11/2017 12:00
15/11/2017 15:00
15/11/2017 18:00
15/11/2017 21:00
16/11/2017 00:00
16/11/2017 03:00
16/11/2017 06:00
16/11/2017 09:00
16/11/2017 12:00
16/11/2017 15:00
16/11/2017 18:00
16/11/2017 21:00
17/11/2017 00:00
17/11/2017 03:00
17/11/2017 06:00
17/11/2017 09:00
17/11/2017 12:00
17/11/2017 15:00
17/11/2017 18:00
18/11/2017 00:00
18/11/2017 03:00
18/11/2017 06:00
18/11/2017 09:00
18/11/2017 12:00
18/11/2017 15:00
18/11/2017 18:00
18/11/2017 21:00
19/11/2017 00:00
19/11/2017 03:00
19/11/2017 06:00
19/11/2017 09:00
19/11/2017 12:00
19/11/2017 15:00
19/11/2017 18:00
19/11/2017 21:00
20/11/2017 00:00
20/11/2017 03:00
20/11/2017 06:00
20/11/2017 09:00
20/11/2017 12:00
20/11/2017 15:00
20/11/2017 18:00
20/11/2017 21:00
21/11/2017 00:00
21/11/2017 03:00
21/11/2017 06:00
21/11/2017 09:00
21/11/2017 12:00
21/11/2017 15:00
21/11/2017 18:00
22/11/2017 03:00
22/11/2017 06:00
22/11/2017 09:00
22/11/2017 12:00
22/11/2017 15:00
22/11/2017 18:00
22/11/2017 21:00
23/11/2017 00:00
23/11/2017 03:00
23/11/2017 06:00
23/11/2017 09:00
23/11/2017 12:00
23/11/2017 15:00
23/11/2017 18:00
23/11/2017 21:00
24/11/2017 00:00
24/11/2017 03:00
24/11/2017 06:00
24/11/2017 09:00
24/11/2017 12:00
24/11/2017 15:00
24/11/2017 18:00
24/11/2017 21:00
25/11/2017 00:00
25/11/2017 03:00
25/11/2017 06:00
25/11/2017 09:00
25/11/2017 12:00
25/11/2017 15:00
25/11/2017 18:00
25/11/2017 21:00
26/11/2017 00:00
26/11/2017 03:00
26/11/2017 06:00
26/11/2017 09:00
26/11/2017 12:00
26/11/2017 15:00
26/11/2017 18:00
26/11/2017 21:00
27/11/2017 03:00
27/11/2017 06:00
27/11/2017 09:00
27/11/2017 12:00
27/11/2017 15:00
27/11/2017 18:00
27/11/2017 21:00
28/11/2017 06:00
28/11/2017 09:00
28/11/2017 12:00
28/11/2017 15:00
28/11/2017 18:00
28/11/2017 21:00
29/11/2017 00:00
29/11/2017 03:00
29/11/2017 06:00
29/11/2017 09:00
29/11/2017 12:00
29/11/2017 15:00
29/11/2017 18:00
29/11/2017 21:00
30/11/2017 00:00
30/11/2017 03:00
30/11/2017 06:00
30/11/2017 09:00
30/11/2017 12:00
30/11/2017 15:00
30/11/2017 18:00
30/11/2017 21:00


This is the value tha a have using pandas:


print(data)


0 2017-01-11 00:00:00
1 2017-01-11 03:00:00
2 2017-01-11 06:00:00
3 2017-01-11 09:00:00
4 2017-01-11 12:00:00
  ...
228   2017-11-30 09:00:00
229   2017-11-30 12:00:00
230   2017-11-30 15:00:00
231   2017-11-30 18:00:00
232   2017-11-30 21:00:00

Please, how can I get four arrays for day, month, year and hour this 
column of my excel.



:


Conrado


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


[issue41024] doc: Explicitly mention use of 'enum.Enum' as a valid container for 'choices' argument of 'argparse.ArgumentParser.add_argument'

2020-07-17 Thread Vincent Férotin

Vincent Férotin  added the comment:

Unless I am mistaken, merged pull-request was not backported from master to 
other potential branches (3.5 -> 3.9 included). There was a message from GitHub 
'miss-islington' bot 
(https://github.com/python/cpython/pull/20964#issuecomment-646991186) saying, 
if I understand correctly, to manually cherry-pick merged commit to other 
branches. Am I correct?
And if so, is there some automatic process for this cherry-picking to re-run, 
or do someone have to do it manually?

--
status: open -> pending

___
Python tracker 

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



[issue41024] doc: Explicitly mention use of 'enum.Enum' as a valid container for 'choices' argument of 'argparse.ArgumentParser.add_argument'

2020-07-17 Thread Vincent Férotin

Vincent Férotin  added the comment:

Explicitly add Raymond Hettinger to nosy list, as he reviewed the corresponding 
PR.

--
nosy: +rhettinger

___
Python tracker 

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



[issue41315] Add mathematical functions as wrappers to decimal.Decimal methods

2020-07-17 Thread Jean Abou Samra


Jean Abou Samra  added the comment:

I would argue that given a function,

from math import *

def naive_calc_pi(n=100):
u = sqrt(8)
v = 4
for _ in range(n):
v = 2*u*v/(u + v)
u = sqrt(u*v)
return u

when you realize that floats have limited precision (happened to me several 
times while being taught and teaching Python), you could just replace

from math import *

with

from decimal import *

and use it, instead of the current

from decimal import Decimal as D

def sqrt(x):
return D(x).sqrt()

Of course, you can define these, but as I repeatedly ended up doing this, I 
just thought I'd bring the idea upstream.

Another, perhaps more important argument is readability. We all think in terms 
of functions: log(x), not x.log(). I find it a significant fact that NumPy has 
both numpy.dot(A, B) and numpy.ndarray.dot(self, B), but the former is 
generally preferred (the method's documentation points to the function and the 
first dozen Google search results for "numpy dot product" yield the function). 
It makes expressions resemble what we are used to: compare

(a + b).tan().log() = (a.tan() + b.tan()).sqrt()/(1 - a.tan()*b.tan()).sqrt()
with
sqrt(tan(a + b)) = sqrt(tan(a) + tan(b))/sqrt(1 - tan(a)*tan(b))

> Also, the APIs aren't completely harmonious because the Decimal methods 
> accept an optional context object.

I don't see a problem with the functions also accepting this parameter. 
(np.sin() has many parameters after all.)

Overall, I think this modest addition would bring an improvement in the 
usability of the decimal module. I can make a PR.

--
nosy: +Jean_Abou_Samra

___
Python tracker 

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



[issue38656] mimetypes for python 3.7.5 fails to detect matroska video

2020-07-17 Thread David K. Hess


David K. Hess  added the comment:

@michael-lazar a documentation change seems the path of least resistance given 
the complicated history of this module. +1 from me.

--

___
Python tracker 

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



[issue41324] Add a minimal decimal capsule API

2020-07-17 Thread Stefan Krah


Stefan Krah  added the comment:

Adding Daniele Varrazzo, in case this is useful for the PostgreSQL
adapter.

--
nosy: +piro

___
Python tracker 

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



[issue41321] Calculate timestamp is wrong in datetime.datetime

2020-07-17 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Serhiy, you are right. I wrote below script that could explain the difference.

# ../backups/bpo41321.py
import datetime
import zoneinfo

for tz in zoneinfo.available_timezones():
diff = datetime.datetime(1986, 5, 4, 7, 13, 22, 
tzinfo=zoneinfo.ZoneInfo(tz)).timestamp() - datetime.datetime(1986, 5, 4, 0, 0, 
0, tzinfo=zoneinfo.ZoneInfo(tz)).timestamp()
if diff != 26002:
print(diff, tz)

for tz in zoneinfo.available_timezones():
diff = datetime.datetime(1986, 5, 2, 7, 13, 22, 
tzinfo=zoneinfo.ZoneInfo(tz)).timestamp() - datetime.datetime(1986, 5, 2, 0, 0, 
0, tzinfo=zoneinfo.ZoneInfo(tz)).timestamp()
if diff != 26002:
print("Diff using second day", diff, tz)

$ ./python ../backups/bpo41321.py
22402.0 Asia/Harbin
22402.0 Asia/Shanghai
22402.0 PRC
22402.0 Asia/Chongqing
22402.0 Asia/Chungking

--

___
Python tracker 

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



[issue41324] Add a minimal decimal capsule API

2020-07-17 Thread Stefan Krah


Stefan Krah  added the comment:

Also as a note for Mark and Raymond: This API is for exact conversions
and avoids the use of the context except for raising ConversionSyntax.

I'll add documentation once Antoine has tried it out for his use case.

--

___
Python tracker 

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



[issue41311] Add a function to get a random sample from an iterable (reservoir sampling)

2020-07-17 Thread Oscar Benjamin

Oscar Benjamin  added the comment:

All good points :)

Here's an implementation with those changes and that shuffles but gives the 
option to preserve order. It also handles the case W=1.0 which can happen at 
the first step with probability 1 - (1 - 2**53)**k.

Attempting to preserve order makes the storage requirements expected 
O(k*log(k)) rather than deterministic O(k) but note that the log(k) part just 
refers to the values list growing larger with references to None: only k of the 
items from iterable are stored at any time. This can be simplified by removing 
the option to preserve order which would also make it faster in the 
small-iterable case.

There are a few timings below for choosing from a dict vs converting to a list 
and using sample (I don't have a 3.9 build immediately available to use 
choices). Note that these benchmarks are not the primary motivation for 
sample_iter though which is the case where the underlying iterable is much more 
expensive in memory and/or time and where the length is not known ahead of time.



from math import exp, log, log1p, floor
from random import random, randrange, shuffle as _shuffle
from itertools import islice


def sample_iter(iterable, k=1, shuffle=True):
"""Choose a sample of k items from iterable

shuffle=True (default) gives the items in random order
shuffle=False preserves the original ordering of the items
"""
iterator = iter(iterable)
values = list(islice(iterator, k))

irange = range(len(values))
indices = dict(zip(irange, irange))

kinv = 1 / k
W = 1.0
while True:
W *= random() ** kinv
# random() < 1.0 but random() ** kinv might not be
# W == 1.0 implies "infinite" skips
if W == 1.0:
break
# skip is geometrically distributed with parameter W
skip = floor( log(random())/log1p(-W) )
try:
newval = next(islice(iterator, skip, skip+1))
except StopIteration:
break
# Append new, replace old with dummy, and keep track of order
remove_index = randrange(k)
values[indices[remove_index]] = None
indices[remove_index] = len(values)
values.append(newval)

values = [values[indices[i]] for i in irange]

if shuffle:
_shuffle(values)

return values


Timings for a large dict (1,000,000 items):

In [8]: n = 6   
   

In [9]: d = dict(zip(range(10**n), range(10**n)))   
   

In [10]: %timeit sample_iter(d, 10) 
   
16.1 ms ± 363 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

In [11]: %timeit sample(list(d), 10)
   
26.3 ms ± 1.88 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)


Timings for a small dict (5 items):

In [14]: d2 = dict(zip(range(5), range(5))) 
   

In [15]: %timeit sample_iter(d2, 2) 
   
14.8 µs ± 539 ns per loop (mean ± std. dev. of 7 runs, 10 loops each)

In [16]: %timeit sample(list(d2), 2)
   
6.27 µs ± 457 ns per loop (mean ± std. dev. of 7 runs, 10 loops each)


The crossover point for this benchmark is around 10,000 items with k=2. 
Profiling at 10,000 items with k=2 shows that in either case the time is 
dominated by list/next so the time difference is just about how efficiently we 
can iterate vs build the list. For small dicts it is probably possible to get a 
significant factor speed up by removing the no shuffle option and simplifying 
the routine.


> Although why it keeps taking k'th roots remains a mystery to me ;-)

Thinking of sample_iter_old, before doing a swap the uvals in our reservoir 
look like:

  U0 = {u[1], u[2], ... u[k-1], W0}
  W0 = max(V0)

Here u[1] ... u[k-1] are uniform in (0, W0). We find a new u[n] < W0 which we 
swap in while removing W0 and afterwards we have

  U1 = {u[1], u[2], ... u[k-1], u[k]}
  W1 = max(U1)

Given that U1 is k iid uniform variates in (0, W0) we have that

  W1 = W0 * max(random() for _ in range(k)) = W0 * W'

Here W' has cdf x**k and so by the inverse sampling method we can generate it 
as random()**(1/k). That gives the update rule for sample_iter:

  W *= random() ** (1/k)

--

___
Python tracker 

___

[issue25538] Traceback from __exit__ method is misleading

2020-07-17 Thread Tadhg McDonald-Jensen


Tadhg McDonald-Jensen  added the comment:

uploaded `with_traceback_fixed+async.py` because I forgot to include async with 
in my first code.

--
Added file: https://bugs.python.org/file49323/with_traceback_fixed+async.py

___
Python tracker 

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



[issue41241] Unnecessary Type casting in 'if condition'

2020-07-17 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi Wansoo, welcome to Python!


Changes that are purely cosmetic but do not change the underlying meaning of 
the code are usually refused as they create unwanted code churn. You will find 
some info about this and all the other aspects of contributing to Python in the 
Python Dev Guide: https://devguide.python.org/.


If you want to find an issue on which you could work, please have a look at the 
`easy` `easy (C)` and `newcomer_friendly` issues in the bug tracker. You can 
find them using the search function of https://bugs.python.org/

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue41324] Add a minimal decimal capsule API

2020-07-17 Thread Stefan Krah


Change by Stefan Krah :


--
type:  -> enhancement

___
Python tracker 

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



[issue22194] access to cdecimal / libmpdec API

2020-07-17 Thread Stefan Krah


Stefan Krah  added the comment:

Closing in favor of #41324, which adds just the most important
functions.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Add a minimal decimal capsule API

___
Python tracker 

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



[issue41322] unittest: Generator test methods will always be marked as passed

2020-07-17 Thread Alexander Hungenberg


Alexander Hungenberg  added the comment:

I would also strongly vote for raising an error if the test method is a 
generator - not even silently turn it into a list.

It would be straight forward to implement various checks (like the ones you 
mentioned for generators, coroutines, ...) - and they will absolutely help to 
prevent unintended errors, especially by more junior developers.

--

___
Python tracker 

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



[issue41324] Add a minimal decimal capsule API

2020-07-17 Thread Stefan Krah


New submission from Stefan Krah :

This adds a minimal decimal capsule API.  As can be seen from the patch,
adding anything to decimal while doing it properly is quite labor and
testing intensive, so the intent is to *keep* the API minimal!

That said, some functions are really necessary:

  1) PyDec_TypeCheck() -- for obvious reasons.

  2) PyDec_Alloc() -- create new decimals.

  3) PyDec_Get()   -- get the mpd_t, enables the use of all 
libmpdec functions.

  4) PyDec_AsUint128Triple()   -- export the decimal as (sign, hi, lo, exp).

  5) PyDec_FromUint128Triple() -- create a decimal from (sign, hi, lo, exp).


4) and 5) have been requested by Antoine for a real world use case.  (hi, lo)
is the coefficient as a __uint128_t split in two uint64_t.


Antoine, could you verify that this is sufficient for the database use case?

--
nosy: +mark.dickinson, pitrou, rhettinger

___
Python tracker 

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



[issue41319] IDLE 3.8 can not save and run this file

2020-07-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Already fixed.  I have asked the fix go in 3.8.5 on Monday.

--

___
Python tracker 

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



[issue41319] IDLE 3.8 can not save and run this file

2020-07-17 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDLE: add missing import io in iomenu.py

___
Python tracker 

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



[issue25538] Traceback from __exit__ method is misleading

2020-07-17 Thread Tadhg McDonald-Jensen


Tadhg McDonald-Jensen  added the comment:

This is doable, the feature that decides which line is shown in the traceback 
is the `lnotab` structure in the relevant code object, the structure is 
described here 
(https://github.com/python/cpython/blob/3.8/Objects/lnotab_notes.txt) and it 
supports negative line offsets so it'd be possible to get the with statement 
closing statements to backup the line numbers to point to the with statement in 
question.

I have attached a python script which actually achieves this. 
`correct_with_cleanup_traceback` when passed a function changes the relevant 
line numbers so the traceback actually point to the with statement when the 
error is thrown in the __exit__, most of the relevant work is just dealing with 
the weird format of lnotab.

This is the error thrown by the test script, it has 2 cascading failures in 
exit so that I could confirm it worked for nested withs and it absolutely 
points to the relevant with statement as I have highlighted on the traceback,

Traceback (most recent call last):
  File "/Users/tadhgmcdonald-jensen/Documents/test.py", line 71, in my_test
>>  with Test(True) as will_fail_first: 
<<<- HERE
  File "/Users/tadhgmcdonald-jensen/Documents/test.py", line 67, in __exit__
raise Exception("error in exit")
Exception: error in exit

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/tadhgmcdonald-jensen/Documents/test.py", line 78, in 
my_test()
  File "/Users/tadhgmcdonald-jensen/Documents/test.py", line 70, in my_test
>>  with Test(True) as fail_during_handling:
<<<- HERE 
  File "/Users/tadhgmcdonald-jensen/Documents/test.py", line 67, in __exit__
raise Exception("error in exit")
Exception: error in exit

--
Added file: https://bugs.python.org/file49322/with_traceback_monkeypatch.py

___
Python tracker 

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



  1   2   >