[issue31639] http.server and SimpleHTTPServer hang after a few requests

2017-12-17 Thread Glenn Linderman

Glenn Linderman  added the comment:

This probably has been around for a while: this 2011 thread in a Chromium 
wontfix bug is enlightening, but the solution suggested, a ThreadingMixIn for 
the HTTPServer, didn't help me.

https://bugs.chromium.org/p/chromium/issues/detail?id=195550

--

___
Python tracker 

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



[issue32352] `inspect.getfullargspec` doesn't work fine for some builtin callable objects

2017-12-17 Thread Martin Panter

Martin Panter  added the comment:

This was documented for the “getfullargspec” function in Issue 7422 (long 
before “signature” existed). The error message was also clarified in Issue 
6905. However IMO the term “Python function” is too subtle and ambiguous.

--
nosy: +martin.panter

___
Python tracker 

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



Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 5:59 PM, Marko Rauhamaa  wrote:
> Chris Angelico :
>
>> On Mon, Dec 18, 2017 at 9:33 AM, Marko Rauhamaa  wrote:
>>> Then I graduated and joined the workforce. Since then, I have learned
>>> a thing or two, but I learned more during my first year in college
>>> than I have during the 25 since I left.
>>
>> Interesting. I'm not surprised that you can learn more in college than
>> in the years *prior* to it (if you were just dabbling), but I would
>> have expected that you learn more actually on the job. Are you
>> seriously saying that you've been 25 years in the workforce and not
>> learned anything new?
>
> Let's see. What I have learned on the job is projects and processes
> (even though college tried to give a taste of those, as well). Then, I
> have gathered some encyclopedic knowledge about programming languages,
> libraries, frameworks and operating systems. Finally, I have developed
> routine.
>
> But true eye-openers took place in college: data structures, algorithms,
> complexity theory, parsing and compiling, recursion, object-oriented
> programming, logic programming, functional programming, distributed
> systems, cryptography, logic and formalisms, mathematical rigor etc.
>

So if you were to choose between two potential hires, one who had 25
years' experience and the other had nothing but college, which would
you choose? Are you worth virtually the same salary now as you were
worth straight out of college?

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


Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 5:43 PM, Random832  wrote:
> On Sun, Dec 17, 2017, at 10:46, Chris Angelico wrote:
>> But if you're trying to *validate* an email address - for instance, if
>> you receive a form submission and want to know if there was an email
>> address included - then my recommendation is simply DON'T. You can't
>> get all the edge cases right; it is actually impossible for a regex to
>> perfectly match every valid email address and no invalid addresses.
>
> That's not actually true (the thing that notoriously can't be matched in
> a regex, RFC822 "address", is basically most of the syntax of the To:
> header - the part that is *the address* as we speak of it normally is
> "addr-spec" and is in fact a regular language, though a regex to match
> it goes on for a few hundred characters.

Hmm, is that true? I was under the impression that the quoting rules
were impossible to match with a regex. Or maybe it's just that they're
impossible to match with a *standard* regex, but the extended
implementations (including Python's, possibly) are able to match them?

Anyhow, it is FAR from simple; and also, for the purpose of "detect
email addresses in text documents", not desirable. Same as with URL
detection - it's better to have a handful of weird cases that don't
autolink correctly than to mis-detect any address that's at the end of
a sentence, for instance. For that purpose, it's better to ignore the
RFC and just craft a regex that matches *common* email address
formats.

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


Re: Python Learning

2017-12-17 Thread Marko Rauhamaa
Chris Angelico :

> On Mon, Dec 18, 2017 at 9:33 AM, Marko Rauhamaa  wrote:
>> Then I graduated and joined the workforce. Since then, I have learned
>> a thing or two, but I learned more during my first year in college
>> than I have during the 25 since I left.
>
> Interesting. I'm not surprised that you can learn more in college than
> in the years *prior* to it (if you were just dabbling), but I would
> have expected that you learn more actually on the job. Are you
> seriously saying that you've been 25 years in the workforce and not
> learned anything new?

Let's see. What I have learned on the job is projects and processes
(even though college tried to give a taste of those, as well). Then, I
have gathered some encyclopedic knowledge about programming languages,
libraries, frameworks and operating systems. Finally, I have developed
routine.

But true eye-openers took place in college: data structures, algorithms,
complexity theory, parsing and compiling, recursion, object-oriented
programming, logic programming, functional programming, distributed
systems, cryptography, logic and formalisms, mathematical rigor etc.


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


[issue29469] AST-level Constant folding

2017-12-17 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset 87010e85cb37192d63b1a30e5fabba307ad5a3f5 by INADA Naoki in branch 
'master':
bpo-29469: peephole: Remove const_stack (GH-4879)
https://github.com/python/cpython/commit/87010e85cb37192d63b1a30e5fabba307ad5a3f5


--

___
Python tracker 

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



Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Random832
On Sun, Dec 17, 2017, at 10:46, Chris Angelico wrote:
> But if you're trying to *validate* an email address - for instance, if
> you receive a form submission and want to know if there was an email
> address included - then my recommendation is simply DON'T. You can't
> get all the edge cases right; it is actually impossible for a regex to
> perfectly match every valid email address and no invalid addresses.

That's not actually true (the thing that notoriously can't be matched in
a regex, RFC822 "address", is basically most of the syntax of the To:
header - the part that is *the address* as we speak of it normally is
"addr-spec" and is in fact a regular language, though a regex to match
it goes on for a few hundred characters. The formal syntax also has some
surprising corners that might not reflect real-world implementations:
for example, a local-part may not begin or end with a dot or contain two
dots in a row (unless quoted - the suggestion someone else made that a
local-part may contain an @ sign also requires quoting). It's also
unfortunate that a domain-part may not end with the dot, since this
would provide a way to specify TLD- only addresses without allowing the
error of mistakenly leaving the TLD off of an address.

> And that's only counting *syntactically* valid - it doesn't take into
> account the fact that "b...@junk.example.com" is not going to get
> anywhere. So if you're trying to do validation, basically just don't.

The recommendation still stands, of course - this script is probably not
the place to explore these obscure corners. If the email address is
important, you can send a link to it and wait for them to click it to
confirm the email. If it's not, don't bother at all.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31639] http.server and SimpleHTTPServer hang after a few requests

2017-12-17 Thread Glenn Linderman

Glenn Linderman  added the comment:

Same behavior on Windows.

--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, v+python, zach.ware

___
Python tracker 

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



[issue32358] json.dump: fp must be a text file object

2017-12-17 Thread TaoQingyun

New submission from TaoQingyun <845767...@qq.com>:

```
>>> import json
>>> f = open('/tmp/t.json', 'wb')  
>>> json.dump(123, f)  
Traceback (most recent call last): 
  File "", line 1, in   
  File "/usr/lib/python3.6/json/__init__.py", line 180, in dump 
  
fp.write(chunk)
TypeError: a bytes-like object is required, not 'str'
```

This may not a bug. But it should mention at docs 
https://docs.python.org/3/library/json.html#json.dump

--
components: Library (Lib)
messages: 308517
nosy: qingyunha
priority: normal
severity: normal
status: open
title: json.dump: fp must be a text file object
versions: Python 3.6

___
Python tracker 

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



[issue32338] Save OrderedDict import in re

2017-12-17 Thread INADA Naoki

INADA Naoki  added the comment:

Please don't do this.
del d[next(iter(d))] is not O(1) on current dict implementation.
OrderedDict is designed for such use cases. Please keep using it.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue32357] Optimize asyncio.iscoroutine() and loop.create_task() for non-native coroutines

2017-12-17 Thread Yury Selivanov

Change by Yury Selivanov :


--
keywords: +patch
pull_requests: +4809
stage:  -> patch review

___
Python tracker 

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



[issue32357] Optimize asyncio.iscoroutine() and loop.create_task() for non-native coroutines

2017-12-17 Thread Yury Selivanov

Change by Yury Selivanov :


--
title: Optimize asyncio.iscoroutine() for non-native coroutines -> Optimize 
asyncio.iscoroutine() and loop.create_task() for non-native coroutines

___
Python tracker 

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



[issue32357] Optimize asyncio.iscoroutine() for non-native coroutines

2017-12-17 Thread Yury Selivanov

New submission from Yury Selivanov :

asyncio.Task now uses asyncio.iscoroutine() to give a comprehensible error if a 
user creates a Task for a non-awaitable type.

The problem is that iscoroutine() is quite expensive for non-native coroutines 
(like the ones compiled with Cython), as it uses `isinstance(obj, 
collections.abc.Coroutine)` call.  This makes 
'loop.create_task(cython_coroutine)' 20% slower than 
'loop.create_task(python_coroutine)'.

The PR adds a positive type cache to the iscoroutine() function and to the 
asyncio.Task C implementation.  Both caches make 'loop.create_task()' equally 
fast for all kinds of coroutines.

--
components: asyncio
messages: 308515
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Optimize asyncio.iscoroutine() for non-native coroutines
versions: 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: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:

On Mon, Dec 18, 2017 at 4:04 PM, Chris Angelico  wrote:

On Mon, Dec 18, 2017 at 3:54 PM, Bill  wrote:

Chris Angelico wrote:

I don't know about vtables as needing to be in ANY programming course.
They're part of a "let's dive into the internals of C++" course. You
certainly don't need them to understand how things work in Python,
because they don't exist; and I'm doubtful that you need to explain
them even to C++ programmers.


Then how are you going to explain dynamic_cast?


I wouldn't. I'd teach Python to beginning programmers. C++ is not a
good first language.

And even for C++ programners, you can go a pretty long way without dynamic_cast.
You either know it exists, and what it can do for you, or you don't.  If 
you want to teach a 2nd course in C++, and leave out vtables and 
dynamic_cast, I don't have a problem with that. If you always choose the 
lowest common denominator, your class may not be that interesting.  I 
told my students that my goal was for them was to learn how to learn so 
that they "didn't need me".




ChrisA


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


Re: Repeated Names (Repeated Names)

2017-12-17 Thread Christian Gollwitzer

Am 17.12.17 um 15:30 schrieb Skip Montanaro:

I've emailed the administrator of bbs.geek.nz, maybe he
will be able to stop it.


Thanks, Greg. We're actually blocking via that and related headers at
the gateway, which is why the mailing list is no longer seeing the
duplicates. I'm not sure any of us thought to email the news server
admin, though!


I did; the address is fake.


Worked for me. From the URL http://news.bbs.geek.nz/

*Welcome to Agency News - a Usenet News system located in Dunedin, New
Zealand.*
*...*
*Agency News is run as a not-for-profit hobby and offers free access to
text-only Usenet News*
*...*
*Contact - newsmaster {at} news.bbs.geek.nz  to
obtain a username / password.*

I just sent a note to that email address. No bounce yet.


He already replied; maybe it's not going through to the list because of 
the blocking. Here is the post:



Apologies guys for the dupes being injected in to this newsgroup.

I run a message network using Fido Technical Networking standards and a
single node within fsxNet (bbs.geek.nz/fsxnet.zip) that was connected to the
gateway software had seemingly sent a bunch of looped messages though the
gateway. I have closed the node access off and removed some borked packets on
my side of the gateway.

Hopefully someone will see this reply and know I've acted as soon as I heard
from Greg. :)

If anyone spots anything further amiss you can reach me at avon [at] bbs
[dot] geek [dot] nz

Best, Paul


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


Re: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:


I agree with some of that, but you then take it to absurdity. You most
certainly CAN drive a car without knowing how one works; in fact, with
this century's cars, I think that's very much the case. How many
people REALLY know what happens when you push the accelerator pedal,
and how that makes the car go faster? Originally, it would actually
open a valve and allow more fuel into the engine; now, it's all
managed by a computer. So how much can you really understand of how it
works?


You can understand the "systems" which comprise your car. Engine, 
Cooling, braking, transmission, exhaust, etc.  And you can similarly 
understand the systems which comprise the workings of your computer 
program. As it happens, I've been studying electronics lately.
In answer to your question, there is an "invisible line" between 
hardware and software which most people don't generally cross. As 
another response to your question, try to master all of the features of 
the emacs editor. Personally, I've never felt motivated enough to do so.





You can certainly use functions without knowing details of the
run-time stack, though you'll need at least SOME comprehension of it.

Avoiding functions and documentation, though, now you're just being ridiculous.

ChrisA


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


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 4:04 PM, Chris Angelico  wrote:
> On Mon, Dec 18, 2017 at 3:54 PM, Bill  wrote:
>> Chris Angelico wrote:
>>>
>>> I don't know about vtables as needing to be in ANY programming course.
>>> They're part of a "let's dive into the internals of C++" course. You
>>> certainly don't need them to understand how things work in Python,
>>> because they don't exist; and I'm doubtful that you need to explain
>>> them even to C++ programmers.
>>>
>> Then how are you going to explain dynamic_cast?
>>
>
> I wouldn't. I'd teach Python to beginning programmers. C++ is not a
> good first language.

And even for C++ programners, you can go a pretty long way without dynamic_cast.

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


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 3:54 PM, Bill  wrote:
> Chris Angelico wrote:
>>
>> I don't know about vtables as needing to be in ANY programming course.
>> They're part of a "let's dive into the internals of C++" course. You
>> certainly don't need them to understand how things work in Python,
>> because they don't exist; and I'm doubtful that you need to explain
>> them even to C++ programmers.
>>
> Then how are you going to explain dynamic_cast?
>

I wouldn't. I'd teach Python to beginning programmers. C++ is not a
good first language.

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


Re: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:

I don't know about vtables as needing to be in ANY programming course.
They're part of a "let's dive into the internals of C++" course. You
certainly don't need them to understand how things work in Python,
because they don't exist; and I'm doubtful that you need to explain
them even to C++ programmers.


Then how are you going to explain dynamic_cast?



Polymorphism... actually, I could explain that to a three year old.

"Eat your broccoli"

"Eat your dessert"

See? Polymorphism. The same operation being done to different things
and having different results.

ChrisA


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


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 3:31 PM, Bill  wrote:
> Chris Angelico wrote:
>>
>>
>> I don't know about vtables as needing to be in ANY programming course.
>> They're part of a "let's dive into the internals of C++" course. You
>> certainly don't need them to understand how things work in Python,
>> because they don't exist; and I'm doubtful that you need to explain
>> them even to C++ programmers.
>
>
> I guess "need to" is a relative thing. You can drive a car without know how
> one works. You can use functions with little knowledge of a run-time stack.
> You can avoid recursion if you are scared of it. And you can totally avoid
> functions if you are scared of them. And who needs documentation...seems
> like a big waste of time! Programmers don't need to know how to write, do
> they?  Ask some programmers that just taught themselves, and they will tell
> you!
>
> After reading, writing, and arithmetic, then perhaps programming.
>

I agree with some of that, but you then take it to absurdity. You most
certainly CAN drive a car without knowing how one works; in fact, with
this century's cars, I think that's very much the case. How many
people REALLY know what happens when you push the accelerator pedal,
and how that makes the car go faster? Originally, it would actually
open a valve and allow more fuel into the engine; now, it's all
managed by a computer. So how much can you really understand of how it
works?

You can certainly use functions without knowing details of the
run-time stack, though you'll need at least SOME comprehension of it.

Avoiding functions and documentation, though, now you're just being ridiculous.

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


Re: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:


I don't know about vtables as needing to be in ANY programming course.
They're part of a "let's dive into the internals of C++" course. You
certainly don't need them to understand how things work in Python,
because they don't exist; and I'm doubtful that you need to explain
them even to C++ programmers.


I guess "need to" is a relative thing. You can drive a car without know 
how one works. You can use functions with little knowledge of a run-time 
stack. You can avoid recursion if you are scared of it. And you can 
totally avoid functions if you are scared of them. And who needs 
documentation...seems like a big waste of time! Programmers don't need 
to know how to write, do they?  Ask some programmers that just taught 
themselves, and they will tell you!


After reading, writing, and arithmetic, then perhaps programming.




Polymorphism... actually, I could explain that to a three year old.

"Eat your broccoli"

"Eat your dessert"

See? Polymorphism. The same operation being done to different things
and having different results.

ChrisA


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


[issue32204] async/await performance is very low

2017-12-17 Thread Yury Selivanov

Yury Selivanov  added the comment:

NP.  I have another PR in the pipeline: 
https://github.com/python/cpython/pull/4913

Both optimizations make your benchmark run 30% faster on 3.7.  If you compile 
asyncio.gather() with Cython you will get it another 5-15% faster.  If you use 
uvloop - another 10-20%.

If it's still slower than asynq, then the issue must be in how asynq schedules 
its callbacks, it might be more optimal for some specific use cases than 
asyncio.

FWIW I don't expect asynq to be any faster than asyncio (or than uvloop) for 
network IO.  And there's definitely no problem with async/await performance -- 
we're optimizing asyncio here, not the interpreter.

--

___
Python tracker 

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



[issue32204] async/await performance is very low

2017-12-17 Thread Liran Nuna

Liran Nuna  added the comment:

Yury, thank you very much for circling back. I wish I could be more helpful in 
pursuing performance improvements.

--

___
Python tracker 

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



Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 3:09 PM, Bill  wrote:
> I tried pretty hard not to say that. I said they needed some "mathematical
> sophistication"--not actual mathematics.  My error was using that expression
> among an audience not so familiar with that terminology. That said, I think
> I would have a hard time explaining polymorphism and vtables to a student
> who had not grasped the distributive property of multiplication over
> addition.
> You can try, and let me know how it goes for you... I've been there.

I don't know about vtables as needing to be in ANY programming course.
They're part of a "let's dive into the internals of C++" course. You
certainly don't need them to understand how things work in Python,
because they don't exist; and I'm doubtful that you need to explain
them even to C++ programmers.

Polymorphism... actually, I could explain that to a three year old.

"Eat your broccoli"

"Eat your dessert"

See? Polymorphism. The same operation being done to different things
and having different results.

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


[issue30050] Please provide a way to disable the warning printed if the signal module's wakeup fd overflows

2017-12-17 Thread Yury Selivanov

Yury Selivanov  added the comment:

I think that what Nathaniel proposes is very reasonable.  The PR is LGTM and 
I've just merged it.  Closing the issue.

--
components: +Interpreter Core
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

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



Re: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:

On Mon, Dec 18, 2017 at 11:31 AM, Bill  wrote:

Larry Martell wrote:

So, your experience is that the style of learning you offer is

unsuitable to anyone who doesn't have some background in algebra.
That's fine. For your course, you set the prereqs. But that's not the
only way for someone to get into coding. You do NOT have to go to
college before you start creating software. That is also not an
opinion; it's a fact backed by a number of proven instances (myself
included).


You might benefit by a course in logic.  I never said that was the only way
to learn. I learned (BASIC) in 8th grade too.


You said earlier:


In my years of teaching experience, students who came to college without
the equivalent of "college algebra" were under-prepared for what was
expected of them. This is not just an opinion, it's a fact.

If you want to qualify that by saying that coming to college is not
the only way to learn programming, you'd better say so, because
otherwise, the tone of what you're saying says that students NEED
algebra prior to learning a programming language.


I tried pretty hard not to say that. I said they needed some 
"mathematical sophistication"--not actual mathematics.  My error was 
using that expression among an audience not so familiar with that 
terminology. That said, I think I would have a hard time explaining 
polymorphism and vtables to a student who had not grasped the 
distributive property of multiplication over addition.

You can try, and let me know how it goes for you... I've been there.

Bill




Logic isn't the problem here. Clarity of language is. Watch your
implications if you don't want to be misunderstood.

ChrisA


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


[issue30050] Please provide a way to disable the warning printed if the signal module's wakeup fd overflows

2017-12-17 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 902ab80b590e474bb2077b1fae8aac497b856d66 by Yury Selivanov 
(Nathaniel J. Smith) in branch 'master':
bpo-30050: Allow disabling full buffer warnings in signal.set_wakeup_fd (#4792)
https://github.com/python/cpython/commit/902ab80b590e474bb2077b1fae8aac497b856d66


--
nosy: +yselivanov

___
Python tracker 

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



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2017-12-17 Thread Martin Panter

Martin Panter  added the comment:

Not if the time is associated with a particular day. Imagine implementing 
datetime.fromisoformat by separately calling date.fromisoformat and 
time.fromisoformat. The date will be off by one day if you naively rounded 
2017-12-18 23:59 “up” to 2017-12-18 00:00.

--

___
Python tracker 

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



[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-17 Thread Yury Selivanov

New submission from Yury Selivanov :

As briefly discussed on https://github.com/python/asyncio/issues/488 and 
https://github.com/python/cpython/pull/528

--
messages: 308509
nosy: yselivanov
priority: normal
severity: normal
status: open
title: asyncio: Make transport.pause_reading()/resume_reading() idempotent; add 
transport.is_reading()

___
Python tracker 

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



[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-17 Thread Yury Selivanov

Change by Yury Selivanov :


--
keywords: +patch
pull_requests: +4808
stage:  -> patch review

___
Python tracker 

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



[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-17 Thread Yury Selivanov

Change by Yury Selivanov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue32355] Optimize asyncio.gather()

2017-12-17 Thread Yury Selivanov

Change by Yury Selivanov :


--
keywords: +patch
pull_requests: +4807
stage:  -> patch review

___
Python tracker 

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



[issue32355] Optimize asyncio.gather()

2017-12-17 Thread Yury Selivanov

New submission from Yury Selivanov :

asyncio.gather can be made faster if:

1. we don't use functools.partial
2. create less intermittent collections
3. drop unnecessary code (e.g. gather has some code that's duplicated in 
ensure_future that it uses etc)

The proposed PR makes asyncio.gather 10-15% faster on the attached benchmark.

--
assignee: yselivanov
components: asyncio
files: t.py
messages: 308508
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Optimize asyncio.gather()
type: performance
versions: Python 3.7
Added file: https://bugs.python.org/file47336/t.py

___
Python tracker 

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



Re: Automated distribution building tools to support SpamBayes

2017-12-17 Thread Skip Montanaro
Thanks. I've had a couple references to Appveyor, so will see if I can make
heads or tails of it during my Christmas-to-New Year's break.

Skip

On Dec 15, 2017 5:43 PM, "Ned Batchelder"  wrote:

> On 12/15/17 2:03 PM, Skip Montanaro wrote:
>
>> SpamBayes (http://www.spambayes.org/) has languished for quite awhile,
>> in part because nobody is around who can put together a Windows
>> installer. Unfortunately, most users are on Windows and have to work
>> around problems caused by the march of time and consequent beefing up
>> of Windows security.
>>
>> I don't do Windows, but I wonder... Can one of the various continuous
>> integration tools out there be enlisted to build Windows installers?
>> The SB code is written in Python, uses the Win32 extension, and is
>> hosted on GitHub (https://github.com/smontanaro/spambayes), so
>> something which plays nice with that environment would be a plus. I'm
>> slowly gaining familiarity at work with Bamboo (very, very slowly), so
>> the general idea of what CI tools can do is starting to sink in. Since
>> I'm a captive Atlassian customer at work, though, I don't know what
>> limitations I might encounter trying to use it in an open source
>> environment.
>>
>> Any feedback appreciated. As this is only Python-related in the sense
>> that SpamBayes is written in Python, feel free to reply off-list.
>>
>> Skip
>>
>
> I use AppVeyor CI to build Windows installers for coverage.py.  It's not
> straightforward though, there are Powershell scripts, etc. The config file
> is here: https://github.com/nedbat/coveragepy/blob/master/appveyor.yml
> with other necessities in the ci folder.
>
> Hope that helps,
>
> --Ned.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue15873] datetime: add ability to parse RFC 3339 dates and times

2017-12-17 Thread Paul Ganssle

Paul Ganssle  added the comment:

@martin.panter I don't see the problem here? Wouldn't 23:59.995 round up to 
00:00?

--

___
Python tracker 

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



[issue32347] System Integrity Protection breaks shutil.copystat()

2017-12-17 Thread Ryan Govostes

Change by Ryan Govostes :


--
keywords: +patch
pull_requests: +4806
stage:  -> patch review

___
Python tracker 

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



[issue32354] Unclear intention of deprecating Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER

2017-12-17 Thread Campbell Barton

New submission from Campbell Barton :

Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER are marked as deprecated in the docs.

https://docs.python.org/3/c-api/unicode.html?highlight=py_unicode_tolower#c.Py_UNICODE_TOLOWER

Someone submitted a patch to our project which uses these.

What is unclear, is if there is an intention to replace these (wrappers for 
'_PyUnicode_ToLowerFull' for eg).

Or if this will be removed without any alternative.

I assume the functionality will be kept somewhere since Python needs 
str.lower/upper.

Will there be a way to perform this in the future? Either way, could docs be 
updated to reflect this?

--
components: Unicode
messages: 308506
nosy: ezio.melotti, ideasman42, vstinner
priority: normal
severity: normal
status: open
title: Unclear intention of deprecating Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER
versions: Python 3.6

___
Python tracker 

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



Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 11:31 AM, Bill  wrote:
> Larry Martell wrote:
>>
>> So, your experience is that the style of learning you offer is
>>>
>>> unsuitable to anyone who doesn't have some background in algebra.
>>> That's fine. For your course, you set the prereqs. But that's not the
>>> only way for someone to get into coding. You do NOT have to go to
>>> college before you start creating software. That is also not an
>>> opinion; it's a fact backed by a number of proven instances (myself
>>> included).
>
>
> You might benefit by a course in logic.  I never said that was the only way
> to learn. I learned (BASIC) in 8th grade too.
>

You said earlier:

> In my years of teaching experience, students who came to college without
> the equivalent of "college algebra" were under-prepared for what was
> expected of them. This is not just an opinion, it's a fact.

If you want to qualify that by saying that coming to college is not
the only way to learn programming, you'd better say so, because
otherwise, the tone of what you're saying says that students NEED
algebra prior to learning a programming language.

Logic isn't the problem here. Clarity of language is. Watch your
implications if you don't want to be misunderstood.

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


[issue15873] datetime: add ability to parse RFC 3339 dates and times

2017-12-17 Thread Martin Panter

Martin Panter  added the comment:

Regarding Matthieu’s RFC 3339 parser, Victor wanted to use the 
round-half-to-even rule to get a whole number of microseconds. But considering 
the “time” class cannot represent 24:00, how do you round up in the extreme 
case past 23:59?

time.fromisoformat("23:59:59.995")

Perhaps it is better to always truncate to zero, only support 6 digits 
(rejecting fractions of a microsecond), or add Anders’s 
truncate_microseconds=True option.

--

___
Python tracker 

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



[issue32204] async/await performance is very low

2017-12-17 Thread Yury Selivanov

Yury Selivanov  added the comment:

Liran,  Task (C implementation) was optimized in issue 32348; your benchmark 
now runs 15% faster.

--

___
Python tracker 

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



[issue32348] Optimize asyncio.Future schedule/add/remove callback

2017-12-17 Thread Yury Selivanov

Change by Yury Selivanov :


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



[issue32348] Optimize asyncio.Future schedule/add/remove callback

2017-12-17 Thread Yury Selivanov

Yury Selivanov  added the comment:

The attached benchmark from https://bugs.python.org/issue32204 shows that the 
updated Task is 15% faster.

--
Added file: https://bugs.python.org/file47335/t.py

___
Python tracker 

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



[issue32348] Optimize asyncio.Future schedule/add/remove callback

2017-12-17 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 1b7c11ff0ee3efafbf5b38c3c6f37de5d63efb81 by Yury Selivanov in 
branch 'master':
bpo-32348: Optimize asyncio.Future schedule/add/remove callback. (#4907)
https://github.com/python/cpython/commit/1b7c11ff0ee3efafbf5b38c3c6f37de5d63efb81


--

___
Python tracker 

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



Re: Python Learning

2017-12-17 Thread Bill

Chris Angelico wrote:

On Mon, Dec 18, 2017 at 6:51 AM, Bill  wrote:

The point is that it takes a certain amount of what is referred to as
"mathematical maturity" (not mathematical knowledge) to digest a book
concerning computer programming.

Emphasis on *a book*.


In my years of teaching experience,
students who came to college without the equivalent of "college algebra"
were under-prepared for what was expected of them. This is not just an
opinion, it's a fact.

So, your experience is that the style of learning you offer is
unsuitable to anyone who doesn't have some background in algebra. That's fine. 
For your course, you set the prereqs.


I never said that they needed any knowledge of algebra.  But if they 
don't understand the logic behind an inequality, for instance, then may 
run into some trouble.

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


Re: Python Learning

2017-12-17 Thread Bill

Gregory Ewing wrote:

Bill wrote:
In my years of teaching experience, students who came to college 
without the equivalent of "college algebra" were under-prepared for 
what was expected of them.


This could be simply because it weeds out people who aren't
good at the required style of thinking. 


I think that's absolutely true.  If someone gets out of high school and 
doesn't understand college algebra (~8th grade math), they come into a 
programming class with an inherent disadvantage. They "can't understand" 
the book, just like they "couldn't" understand their math book.





If that's true,
anything that exercises mathematical thinking should have
the same effect. There just doesn't happen to be anything
else in the mainstream education curriculum that does that.



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


Re: Python Learning

2017-12-17 Thread Bill

Larry Martell wrote:

So, your experience is that the style of learning you offer is

unsuitable to anyone who doesn't have some background in algebra.
That's fine. For your course, you set the prereqs. But that's not the
only way for someone to get into coding. You do NOT have to go to
college before you start creating software. That is also not an
opinion; it's a fact backed by a number of proven instances (myself
included).


You might benefit by a course in logic.  I never said that was the only 
way to learn. I learned (BASIC) in 8th grade too.



I started coding when I was 16, in 1975. I wrote a downhill skiing
game in basic, which I had taught to myself. I went to collage when I
was 17, and I had taught myself FORTRAN and I tested out of the class.


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


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 9:33 AM, Marko Rauhamaa  wrote:
> Gregory Ewing :
>> Chris Angelico wrote:
>>> You do NOT have to go to college before you start creating software.
>>> That is also not an opinion; it's a fact backed by a number of proven
>>> instances (myself included).
>>
>> Me, too. I started programming (a tiny homebrew machine) when I was
>> about 12 or 13. I was just starting to get exposed to algebra at
>> school then.
>
> I thought I had programming covered when I entered college. I wondered
> if I'd be wasting my time and just collecting my diploma. However, after
> every year I realized I hadn't understood anything the year before.
> There was just such a wealth of understanding I never would have been
> able to come up with on my own.
>
> Then I graduated and joined the workforce. Since then, I have learned a
> thing or two, but I learned more during my first year in college than I
> have during the 25 since I left.
>
> What's more, everything I learned in college has been priceless in
> practical day-to-day work.
>

Interesting. I'm not surprised that you can learn more in college than
in the years *prior* to it (if you were just dabbling), but I would
have expected that you learn more actually on the job. Are you
seriously saying that you've been 25 years in the workforce and not
learned anything new?

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


[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2017-12-17 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

PR 4911 implements the importlib.resources API, along with tests and 
documentation.

@brett.cannon - I'm thinking we should do the native ResourceReader 
implementations for the built-in loaders as a separate branch.

--

___
Python tracker 

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



[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2017-12-17 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


--
pull_requests: +4805

___
Python tracker 

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



Re: Python Learning

2017-12-17 Thread Marko Rauhamaa
Gregory Ewing :
> Chris Angelico wrote:
>> You do NOT have to go to college before you start creating software.
>> That is also not an opinion; it's a fact backed by a number of proven
>> instances (myself included).
>
> Me, too. I started programming (a tiny homebrew machine) when I was
> about 12 or 13. I was just starting to get exposed to algebra at
> school then.

I thought I had programming covered when I entered college. I wondered
if I'd be wasting my time and just collecting my diploma. However, after
every year I realized I hadn't understood anything the year before.
There was just such a wealth of understanding I never would have been
able to come up with on my own.

Then I graduated and joined the workforce. Since then, I have learned a
thing or two, but I learned more during my first year in college than I
have during the 25 since I left.

What's more, everything I learned in college has been priceless in
practical day-to-day work.


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


Re: Python Learning

2017-12-17 Thread Gregory Ewing

Chris Angelico wrote:

You do NOT have to go to
college before you start creating software. That is also not an
opinion; it's a fact backed by a number of proven instances (myself
included).


Me, too. I started programming (a tiny homebrew machine) when
I was about 12 or 13. I was just starting to get exposed to
algebra at school then.

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


Re: Python Learning

2017-12-17 Thread Gregory Ewing

Bill wrote:
In my years of teaching experience, 
students who came to college without the equivalent of "college algebra" 
were under-prepared for what was expected of them.


This could be simply because it weeds out people who aren't
good at the required style of thinking. If that's true,
anything that exercises mathematical thinking should have
the same effect. There just doesn't happen to be anything
else in the mainstream education curriculum that does that.

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


Re: Python Learning

2017-12-17 Thread Larry Martell
On Sun, Dec 17, 2017 at 4:18 PM, Chris Angelico  wrote:
> On Mon, Dec 18, 2017 at 6:51 AM, Bill  wrote:
>> The point is that it takes a certain amount of what is referred to as
>> "mathematical maturity" (not mathematical knowledge) to digest a book
>> concerning computer programming.
>
> Emphasis on *a book*.
>
>> In my years of teaching experience,
>> students who came to college without the equivalent of "college algebra"
>> were under-prepared for what was expected of them. This is not just an
>> opinion, it's a fact.
>
> So, your experience is that the style of learning you offer is
> unsuitable to anyone who doesn't have some background in algebra.
> That's fine. For your course, you set the prereqs. But that's not the
> only way for someone to get into coding. You do NOT have to go to
> college before you start creating software. That is also not an
> opinion; it's a fact backed by a number of proven instances (myself
> included).

I started coding when I was 16, in 1975. I wrote a downhill skiing
game in basic, which I had taught to myself. I went to collage when I
was 17, and I had taught myself FORTRAN and I tested out of the class.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 6:28 AM, Piyush Verma <114piy...@gmail.com> wrote:
> Yes Dieter, I see that it is connecting with 443 port number and service is
> running. Is this related to python version or mac?

Can you confirm that it really is an HTTPS server, not just an HTTP
server that's running on port 443? Try accessing it using a web
browser or some other program.

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


Re: Python Learning

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 6:51 AM, Bill  wrote:
> The point is that it takes a certain amount of what is referred to as
> "mathematical maturity" (not mathematical knowledge) to digest a book
> concerning computer programming.

Emphasis on *a book*.

> In my years of teaching experience,
> students who came to college without the equivalent of "college algebra"
> were under-prepared for what was expected of them. This is not just an
> opinion, it's a fact.

So, your experience is that the style of learning you offer is
unsuitable to anyone who doesn't have some background in algebra.
That's fine. For your course, you set the prereqs. But that's not the
only way for someone to get into coding. You do NOT have to go to
college before you start creating software. That is also not an
opinion; it's a fact backed by a number of proven instances (myself
included).

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


Re: ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol

2017-12-17 Thread dieter
Piyush Verma <114piy...@gmail.com> writes:

> Yes Dieter, I see that it is connecting with 443 port number and service is
> running. Is this related to python version or mac?

It might be.

Python does not perform the SSL handling itself but delegates it to
an external SSL library ("OpenSSL" on a *nix like platform).
SSL can use different protocols, e.g. for the encryption.
The error message might mean that the server side uses a protocol
which is not supported by the client side. In this case, you would need
to use a more up-to-date SSL library.


I have had no problems to acces "https://www.facebook.com/piyushkv1;
with "urllib2.urlopen" of Python 2.7.12 (on Ubuntu 16.4).

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


Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Ben Finney
Peng Yu  writes:

> Hi,
>
> I would like to extract "a...@efg.hij.xyz". But it only shows ".hij".

Others have address this question. I'll answer a separate one:

> Does anybody see what is wrong with it? Thanks.

One thing that's wrong with it is that it is far too restrictive.

> email_regex = re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)')

This excludes a great many email addresses that are valid. Please don't
try to restrict a match for email addresses that will exclude actual
email addresses.

For an authoritative guide to matching email addresses, see RFC 3696 §3
.

A more correct match would boil down to:

* Match any printable Unicode characters (not just ASCII).

* Locate the *last* ‘@’ character. (An email address may contain more
  than one ‘@’ character; you should allow any printable ASCII character
  in the local part.)

* Match the domain part as the text after the last ‘@’ character. Match
  the local part as anything before that character. Reject an address
  that has either of these empty.

* Validate the domain by DNS request. Your program is not an authority
  for what domains are valid; the only authority for that is the DNS.

* Don't validate the local part at all. Your program is not an authority
  for what local parts are accepted to the destination host; the only
  authority for that is the destination mail host.

-- 
 \ “Jealousy: The theory that some other fellow has just as little |
  `\ taste.” —Henry L. Mencken |
_o__)  |
Ben Finney

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


[issue32352] `inspect.getfullargspec` doesn't work fine for some builtin callable objects

2017-12-17 Thread Meador Inge

Meador Inge  added the comment:

This is a documented limitation for CPython:

https://docs.python.org/3.7/library/inspect.html#inspect.signature

--
nosy: +meador.inge

___
Python tracker 

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



[issue32152] Add pid to .cover filename in lib/trace.py

2017-12-17 Thread Nikhil Hegde

Nikhil Hegde  added the comment:

Any ETA I can get on this?

--

___
Python tracker 

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



[issue32147] improve performance of binascii.unhexlify() by using conversion table

2017-12-17 Thread Meador Inge

Meador Inge  added the comment:

FWIW, I see a win on OS X 10.12.6:

λ:[master !?](~/Code/src/python/cpython)=> cc --version
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
λ:[master !?](~/Code/src/python/cpython)=> uname -a
Darwin ripley.attlocal.net 16.7.0 Darwin Kernel Version 16.7.0: Wed Oct  4 
00:17:00 PDT 2017; root:xnu-3789.71.6~1/RELEASE_X86_64 x86_64

- Before:
λ:[master ?](~/Code/src/python/cpython)=> ./python.exe -m timeit -s "from 
binascii import unhexlify; b = b'aa'*2**20" "unhexlify(b)"
20 loops, best of 5: 11.3 msec per loop

- After:
λ:[master !?](~/Code/src/python/cpython)=> ./python.exe -m timeit -s "from 
binascii import unhexlify; b = b'aa'*2**20" "unhexlify(b)"
50 loops, best of 5: 4.15 msec per loop

--
nosy: +meador.inge

___
Python tracker 

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



[issue32353] Add docs about Embedding with an frozen module limitation.

2017-12-17 Thread Decorater

New submission from Decorater :

It seems that 1 thing that bites me is that there is no section on the 
embedding docs about limitations to using frozen modules in them.

So lets say for example your program has this like in the main function on an 
embedded python:

```c
  PyRun_SimpleString("import mymodule");
```

And lets say ``mymodule`` is supposed to be an frozen module in that embedded 
interpreter named ``myprogram``

It would fail to work because it wont be able to find ``mymodule`` when it 
really should. This doc change should help fix that senerio and hopefully 
suggest an fix to that senerio as well.

--
assignee: docs@python
components: Documentation
messages: 308497
nosy: Decorater, docs@python
priority: normal
severity: normal
status: open
title: Add docs about Embedding with an frozen module limitation.
versions: 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



[issue32353] Add docs about Embedding with an frozen module limitation.

2017-12-17 Thread Decorater

Change by Decorater :


--
keywords: +patch
pull_requests: +4804
stage:  -> patch review

___
Python tracker 

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



[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected

2017-12-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Thanks, Serhiy, for the C implementation, and Eric for reviewing it.  I would 
add 'non-iterable', to get "cannot unpack non-iterable int object", to tell 
people what is needed instead.  I do think this worthwhile.

--

___
Python tracker 

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



Re: Python Learning

2017-12-17 Thread Bill

Rustom Mody wrote:

In response to


Rustom Mody wrote:

On Saturday, December 16, 2017 at 9:45:17 AM UTC+5:30, Bill wrote:

so it really doesn't make that much difference where one starts, just
"Do It!".  :  )

Really ¿?
https://en.wikipedia.org/wiki/Principles_of_learning#Primacy


On Sunday, December 17, 2017 Bill wrote:

You would give precedence to something written on a wikipedia page over
your experience?

Bill also wrote:

…in college, the prerequisite of "at least co-enrolled in pre-calc",
turned out to be the right one (based upon quite a lot of teaching
experience).

So… I dont understand where you are coming from:
Is there such a thing as a “learning curve” or not?


The point is that it takes a certain amount of what is referred to as 
"mathematical maturity" (not mathematical knowledge) to digest a book 
concerning computer programming. In my years of teaching experience, 
students who came to college without the equivalent of "college algebra" 
were under-prepared for what was expected of them. This is not just an 
opinion, it's a fact. Of course, you could argue that a student who 
arrives at college needing to take college algebra is of a certain 
category. In your words, they are not yet ready to face any sort of 
(steep) learning curve.


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


Re: ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol

2017-12-17 Thread Piyush Verma
Yes Dieter, I see that it is connecting with 443 port number and service is
running. Is this related to python version or mac?

Regards,
~Piyush
Facebook  Twitter


On Sat, Dec 16, 2017 at 1:59 PM, dieter  wrote:

> Piyush Verma <114piy...@gmail.com> writes:
>
> > Getting SSL error while connecting from httplib.HTTPSConnection.
> >
> > Any help would be appreciated.
> > ...
> > line 579, in __init__
> > self.do_handshake()
> >   File
> > "/System/Library/Frameworks/Python.framework/Versions/2.7/
> lib/python2.7/ssl.py",
> > line 808, in do_handshake
> > self._sslobj.do_handshake()
> > ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)
>
> Are you sure, you try to connect to an HTTPS port?
>
> The error message tells you that the "ssl" handshake failed because
> the protocol was unknown (likely because the message was not understood).
> The most natural reason is to try to connect to something which is not
> prepared for an "ssl" handshake.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2017-12-17 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

I have the tests and code ported, but there are still a few things to do, but 
here's a question:

We're using type annotations in importlib_resources, which of course is the 
right decision.  But I think we still have a moratorium on typing in the 
stdlib.  So do we want to remove the types from importlib.resources?

Doing so could make for more work as we continue to track importlib_resource, 
so I'm inclined not to remove them.

--

___
Python tracker 

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



[issue32264] move pygetopt.h into internal/

2017-12-17 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset 4c72bc4a38eced10a55ba7071e084b26a2b5ed4b by Benjamin Peterson in 
branch 'master':
add 'extern' to pygetopt.h symbols, so then don't end up in comdat (#4909)
https://github.com/python/cpython/commit/4c72bc4a38eced10a55ba7071e084b26a2b5ed4b


--

___
Python tracker 

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



Re: argparse.ArgumentParser formatter_class argument

2017-12-17 Thread Seb
On Sun, 17 Dec 2017 10:12:07 +0100,
Peter Otten <__pete...@web.de> wrote:

> Seb wrote:
>> As far as I can see it is currently impossible to apply more than one
>> class to an ArgumentParser.  For example, I'd like to use both
>> RawDescriptionHelpFormatter *and* ArgumentDefaultsHelpFormatter in an
>> ArgumentParser, but it seems that's impossible, as one can only
>> choose a single one.  Any suggestions?

> Try

> class MyHelpFormatter( argparse.RawDescriptionHelpFormatter,
> argparse.ArgumentDefaultsHelpFormatter ): pass

> parser = argparse.ArgumentParser(formatter_class=MyHelpFormatter)

Yes, that worked.

Thanks,
-- 
Seb

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


[issue32349] Add detailed return value information for set.intersection function

2017-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

To clarify, are you referring to this behaviour?

>>> a = {1, 2, 3}
>>> b = {1.0, 4.0}
>>> a.intersection(b)  # expect {1}
{1.0}

I'd personally expect this to be implementation-dependent: since for set 
operations you usually only care about objects up to equality, it would be a 
bit unusual to care whether you get {1} or {1.0} in the above situation, and 
I'd say the implementation should be free to do whatever's convenient. Making 
documented guarantees would unnecessarily constrain other implementations.

I suppose one could document the *lack* of a guarantee here ...

--
nosy: +mark.dickinson, rhettinger

___
Python tracker 

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



[issue32264] move pygetopt.h into internal/

2017-12-17 Thread Benjamin Peterson

Change by Benjamin Peterson :


--
pull_requests: +4803

___
Python tracker 

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



[issue32264] move pygetopt.h into internal/

2017-12-17 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Thanks the report and debugging. You're exactly right—I forgot to add extern.

--

___
Python tracker 

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



[issue32147] improve performance of binascii.unhexlify() by using conversion table

2017-12-17 Thread Sergey Fedoseev

Sergey Fedoseev  added the comment:

Is there anything I can do to push this forward?

BTW, Serhiy, what are your OS, compiler and CPU?

--

___
Python tracker 

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



Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Ned Batchelder

On 12/17/17 10:29 AM, Peng Yu wrote:

Hi,

I would like to extract "a...@efg.hij.xyz". But it only shows ".hij".
Does anybody see what is wrong with it? Thanks.

$ cat main.py
#!/usr/bin/env python
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:

import re
email_regex = re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)')
s = 'a...@efg.hij.xyz.'
for email in re.findall(email_regex, s):
 print email

$ ./main.py
.hij



There are two problems: you have a group at the end to match .something, 
but you need to make that 1-or-more of those, with a +. Second, 
re.findall will only return the matched groups, so you need to change 
your final group to be a non-capturing group, with (?:...)


    email_regex = 
re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+')


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


Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Chris Angelico
On Mon, Dec 18, 2017 at 2:29 AM, Peng Yu  wrote:
> Hi,
>
> I would like to extract "a...@efg.hij.xyz". But it only shows ".hij".
> Does anybody see what is wrong with it? Thanks.
>
> $ cat main.py
> #!/usr/bin/env python
> # vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 
> fileencoding=utf-8:
>
> import re
> email_regex = re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)')
> s = 'a...@efg.hij.xyz.'
> for email in re.findall(email_regex, s):
> print email
>
> $ ./main.py
> .hij

What is the goal of your email address extraction? There are two
goals, one of which cannot be done perfectly but doesn't need to, and
the other cannot be done perfectly and is thus virtually useless. If
you want to detect email addresses in text and turn them into mailto:
links, it's okay to miss out some edge cases, and for that, I would
recommend keeping your regex REALLY simple - something like you have
above, but maybe even simpler. (And I wouldn't have the parentheses in
there, which I think might be what you're getting tripped up on.) But
if you're trying to *validate* an email address - for instance, if you
receive a form submission and want to know if there was an email
address included - then my recommendation is simply DON'T. You can't
get all the edge cases right; it is actually impossible for a regex to
perfectly match every valid email address and no invalid addresses.
And that's only counting *syntactically* valid - it doesn't take into
account the fact that "b...@junk.example.com" is not going to get
anywhere. So if you're trying to do validation, basically just don't.

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


What is wrong with this regex for matching emails?

2017-12-17 Thread Peng Yu
Hi,

I would like to extract "a...@efg.hij.xyz". But it only shows ".hij".
Does anybody see what is wrong with it? Thanks.

$ cat main.py
#!/usr/bin/env python
# vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1 fileencoding=utf-8:

import re
email_regex = re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)')
s = 'a...@efg.hij.xyz.'
for email in re.findall(email_regex, s):
print email

$ ./main.py
.hij

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


[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected

2017-12-17 Thread Eric V. Smith

Eric V. Smith  added the comment:

The PR looks okay to me. I'm also not sure it's worth the change, though.

--

___
Python tracker 

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



[issue32351] Use fastpath in asyncio.sleep if delay<0

2017-12-17 Thread Andrew Svetlov

Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue32351] Use fastpath in asyncio.sleep if delay<0

2017-12-17 Thread Andrew Svetlov

Andrew Svetlov  added the comment:


New changeset 5382c05021026fe623def829d121f5f6af4909fb by Andrew Svetlov in 
branch 'master':
bpo-32351: Use fastpath in asyncio.sleep if delay<0 (#4908)
https://github.com/python/cpython/commit/5382c05021026fe623def829d121f5f6af4909fb


--

___
Python tracker 

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



Re: Repeated Names (Repeated Names)

2017-12-17 Thread Skip Montanaro
>> I've emailed the administrator of bbs.geek.nz, maybe he
>> will be able to stop it.
>
> Thanks, Greg. We're actually blocking via that and related headers at
> the gateway, which is why the mailing list is no longer seeing the
> duplicates. I'm not sure any of us thought to email the news server
> admin, though!

I did; the address is fake.


Worked for me. From the URL http://news.bbs.geek.nz/

*Welcome to Agency News - a Usenet News system located in Dunedin, New
Zealand.*
*...*
*Agency News is run as a not-for-profit hobby and offers free access to
text-only Usenet News*
*...*
*Contact - newsmaster {at} news.bbs.geek.nz  to
obtain a username / password.*

I just sent a note to that email address. No bounce yet.

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


Re: Repeated Names (Repeated Names)

2017-12-17 Thread Tim Golden



On 17/12/2017 13:22, Jon Ribbens wrote:

On 2017-12-17, Tim Golden  wrote:

On 17/12/17 00:10, Gregory Ewing wrote:

The duplicate posts all seem to have this header:

Injection-Info: news.bbs.geek.nz;
posting-host="M6YmRdZYyc42DJk0lNlt/X4dpP4dzvceBNabSmESN3E";
  logging-data="4415"; mail-complaints-to="ab...@news.bbs.geek.nz"

I've emailed the administrator of bbs.geek.nz, maybe he
will be able to stop it.

Thanks, Greg. We're actually blocking via that and related headers at
the gateway, which is why the mailing list is no longer seeing the
duplicates. I'm not sure any of us thought to email the news server
admin, though!

I did; the address is fake.
Thanks, Jon. Looks like there's nothing for us to do on the mailing list 
but keep blocking, then!


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


Re: Python Learning

2017-12-17 Thread Rustom Mody
On Saturday, December 16, 2017 at 6:11:31 PM UTC+5:30, Marko Rauhamaa wrote:
> Stefan Ram:
> 
> > Varun R writes:
> >>I'm new to programming, can anyone guide me, how to start
> >>learning python programming language
> >
> >   As a start, one should learn:
> >
> > 1.) how to install Python
> > (if not already installed)
> >
> > 2.) how to start the Python console
> > (if not already started)
> >
> > 3.) how to type characters into a line of the
> > console and how to submit the line (using
> > the Enter key) (if this is not already known)
> 
> A good list. Even more important, though, is the installation, use and
> understanding of a text editor. What is the difference of MS Word,
> Notepad and a Python-aware text editor? 

This is a useful 3-way classification
Just now dealing with a class in which students write python resolutely 
- using gedit
- on linux VMs
- on Windows hosts

So I wonder where on the spectrum
MS Word → notepad → Programmer’s editor
would you place gedit??
[If you know what that is ]


> What text editors are there?
Seriously?!?
Does that list ever end?

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


Re: Python Learning

2017-12-17 Thread Rustom Mody
In response to

> Rustom Mody wrote:
>> On Saturday, December 16, 2017 at 9:45:17 AM UTC+5:30, Bill wrote:
>>> so it really doesn't make that much difference where one starts, just
>>> "Do It!".  :  )
>> Really ¿?
>> https://en.wikipedia.org/wiki/Principles_of_learning#Primacy


On Sunday, December 17, 2017 Bill wrote:
> You would give precedence to something written on a wikipedia page over
> your experience?

Bill also wrote:
> …in college, the prerequisite of "at least co-enrolled in pre-calc",
> turned out to be the right one (based upon quite a lot of teaching
> experience).

So… I dont understand where you are coming from:
Is there such a thing as a “learning curve” or not?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning (Posting On Python-List Prohibited)

2017-12-17 Thread Rustom Mody
On Sunday, December 17, 2017 at 6:39:41 AM UTC+5:30, Lawrence D’Oliveiro wrote:
> On Sunday, December 17, 2017 at 2:26:43 AM UTC+13, Marko Rauhamaa wrote:
> 
> > Unfortunately, Python's indentation mechanism makes the REPL too
> > frustrating an environment to type in even the simplest of function
> > definitions, let alone a whole class.
> 
> Let me suggest using a Jupyter notebook as an introductory program editor.

Um… Well…
At first I did not take jupyter seriously
“browser is the universal OS” — Sounds like the usual empty fluff

But now seeing things like this:
http://www.leouieda.com/blog/scipy-on-android.html
I guess I am going to be force
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32352] `inspect.getfullargspec` doesn't work fine for some builtin callable objects

2017-12-17 Thread thautwarm

New submission from thautwarm :

It's quite confusing to me that `inspect.getfullargspec` crashed when it was 
applied on some builtin callable objects.

```
for each in __builtin__.__dict__:
try:
obj = getattr(__builtin__, each)
if not callable(obj): 
continue
inspect.getfullargspec(obj)
except Exception as e:
print(each, e)
```

Here are the results:

```
__build_class__ unsupported callable
__import__ unsupported callable
dir unsupported callable
getattr unsupported callable
iter unsupported callable
max unsupported callable
min unsupported callable
next unsupported callable
print unsupported callable
round unsupported callable
vars unsupported callable
bool unsupported callable
bytearray unsupported callable
bytes unsupported callable
classmethod unsupported callable
complex unsupported callable
dict unsupported callable
enumerate unsupported callable
filter unsupported callable
float unsupported callable
frozenset unsupported callable
property unsupported callable
int unsupported callable
list unsupported callable
map unsupported callable
range unsupported callable
reversed unsupported callable
set unsupported callable
slice unsupported callable
staticmethod unsupported callable
str unsupported callable
super unsupported callable
tuple unsupported callable
type unsupported callable
zip unsupported callable
BaseException unsupported callable
Exception unsupported callable
TypeError unsupported callable
StopAsyncIteration unsupported callable
StopIteration unsupported callable
GeneratorExit unsupported callable
SystemExit unsupported callable
KeyboardInterrupt unsupported callable
ImportError unsupported callable
ModuleNotFoundError unsupported callable
OSError unsupported callable
EnvironmentError unsupported callable
IOError unsupported callable
WindowsError unsupported callable
EOFError unsupported callable
RuntimeError unsupported callable
RecursionError unsupported callable
NotImplementedError unsupported callable
NameError unsupported callable
UnboundLocalError unsupported callable
AttributeError unsupported callable
SyntaxError unsupported callable
IndentationError unsupported callable
TabError unsupported callable
LookupError unsupported callable
IndexError unsupported callable
KeyError unsupported callable
ValueError unsupported callable
UnicodeError unsupported callable
UnicodeEncodeError unsupported callable
UnicodeDecodeError unsupported callable
UnicodeTranslateError unsupported callable
AssertionError unsupported callable
ArithmeticError unsupported callable
FloatingPointError unsupported callable
OverflowError unsupported callable
ZeroDivisionError unsupported callable
SystemError unsupported callable
ReferenceError unsupported callable
BufferError unsupported callable
MemoryError unsupported callable
Warning unsupported callable
UserWarning unsupported callable
DeprecationWarning unsupported callable
PendingDeprecationWarning unsupported callable
SyntaxWarning unsupported callable
RuntimeWarning unsupported callable
FutureWarning unsupported callable
ImportWarning unsupported callable
UnicodeWarning unsupported callable
BytesWarning unsupported callable
ResourceWarning unsupported callable
ConnectionError unsupported callable
BlockingIOError unsupported callable
BrokenPipeError unsupported callable
ChildProcessError unsupported callable
ConnectionAbortedError unsupported callable
ConnectionRefusedError unsupported callable
ConnectionResetError unsupported callable
FileExistsError unsupported callable
FileNotFoundError unsupported callable
IsADirectoryError unsupported callable
NotADirectoryError unsupported callable
InterruptedError unsupported callable
PermissionError unsupported callable
ProcessLookupError unsupported callable
TimeoutError unsupported callable
```

--
components: Library (Lib)
messages: 308488
nosy: thautwarm
priority: normal
severity: normal
status: open
title: `inspect.getfullargspec` doesn't work fine for some builtin callable 
objects
type: behavior
versions: Python 3.6

___
Python tracker 

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



Re: Repeated Names (Repeated Names)

2017-12-17 Thread Jon Ribbens
On 2017-12-17, Tim Golden  wrote:
> On 17/12/17 00:10, Gregory Ewing wrote:
>> The duplicate posts all seem to have this header:
>> 
>> Injection-Info: news.bbs.geek.nz; 
>> posting-host="M6YmRdZYyc42DJk0lNlt/X4dpP4dzvceBNabSmESN3E";
>>  logging-data="4415"; mail-complaints-to="ab...@news.bbs.geek.nz"
>> 
>> I've emailed the administrator of bbs.geek.nz, maybe he
>> will be able to stop it.
>
> Thanks, Greg. We're actually blocking via that and related headers at 
> the gateway, which is why the mailing list is no longer seeing the 
> duplicates. I'm not sure any of us thought to email the news server 
> admin, though!

I did; the address is fake.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32351] Use fastpath in asyncio.sleep if delay<0

2017-12-17 Thread Andrew Svetlov

Change by Andrew Svetlov :


--
keywords: +patch
pull_requests: +4802
stage:  -> patch review

___
Python tracker 

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



[issue32351] Use fastpath in asyncio.sleep if delay<0

2017-12-17 Thread Andrew Svetlov

New submission from Andrew Svetlov :

Currently asyncio.sleep schedules a callback execution by `loop.call_later()` 
call, which has the same behavior but 2x slower.

--
components: Library (Lib), asyncio
messages: 308487
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Use fastpath in asyncio.sleep if delay<0
versions: Python 3.7

___
Python tracker 

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



[issue32350] pip can't handle MSVC warnings containing special characters

2017-12-17 Thread Paul Moore

Paul Moore  added the comment:

This is a pip issue, not a Python issue. It's a known issue in the current 
version of pip, and should be fixed in the development version (via pull 
request https://github.com/pypa/pip/pull/4486).

If you like, you can try the development version of pip. At the moment there is 
no planned date for the next release of pip, but we're hoping to put together a 
release in the not too distant future.

--
assignee:  -> paul.moore
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



[issue32350] pip can't handle MSVC warnings containing special characters

2017-12-17 Thread Cutter

New submission from Cutter :

When trying to install pylint using pip on Windows 10, the installation of 
wrapt (a dependency of pylint) fails because a special character in an MSVC 
warning can't be decoded to utf-8.

Below is the relevant part of the console output:
---
Exception:
Traceback (most recent call last):
  File 
"C:\Users\(...)\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\compat\__init__.py",
 line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 51: 
invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"C:\Users\(...)\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\basecommand.py",
 line 215, in main
status = self.run(options, args)
  File 
"C:\Users\(...)\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\commands\install.py",
 line 342, in run
prefix=options.prefix_path,
  File 
"C:\Users\(...)\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\req\req_set.py",
 line 784, in install
**kwargs
  File 
"C:\Users\(...)\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\req\req_install.py",
 line 878, in install
spinner=spinner,
  File 
"C:\Users\(...)\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\utils\__init__.py",
 line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
  File 
"C:\Users\(...)\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\compat\__init__.py",
 line 75, in console_to_str
return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 51: 
invalid start byte
---

I changed line 73 in \pip\compat\__init__.py to: print("!! TEST !! : ", s). The 
full console output after that change is in the attachment. The relevant part 
is:

 !! TEST !! :  b'C:\\Program Files (x86)\\Microsoft Visual 
Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.11.25503\\bin\\HostX86\\x64\\cl.exe
 /c /nologo /Ox /W3 /GL /DNDEBUG /MD 
-IC:\\Users\\(...)\\AppData\\Local\\Programs\\Python\\Python36\\include 
-IC:\\Users\\(...)\\AppData\\Local\\Programs\\Python\\Python36\\include 
"-IC:\\Program Files (x86)\\Microsoft Visual 
Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.11.25503\\ATLMFC\\include" 
"-IC:\\Program Files (x86)\\Microsoft Visual 
Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.11.25503\\include" "-IC:\\Program 
Files (x86)\\Windows Kits\\10\\include\\10.0.16299.0\\ucrt" "-IC:\\Program 
Files (x86)\\Windows Kits\\10\\include\\10.0.16299.0\\shared" "-IC:\\Program 
Files (x86)\\Windows Kits\\10\\include\\10.0.16299.0\\um" "-IC:\\Program Files 
(x86)\\Windows Kits\\10\\include\\10.0.16299.0\\winrt" /Tcsrc/wrapt/_wrappers.c 
/Fobuild\\temp.win-amd64-3.6\\Release\\src/wrapt/_wrappers.obj\r\n'
 !! TEST !! :  b'_wrappers.c\r\n'
 !! TEST !! :  b"src/wrapt/_wrappers.c(195): warning C4244: 'return'\xff: 
conversion de 'Py_hash_t' en 'long', perte possible de donn\x82es\r\n"
 error
 Exception:
 Traceback (most recent call last):
   File 
"C:\Users\(...)\AppData\Local\Programs\Python\Python36\Lib\site-packages\pip\compat\__init__.py",
 line 74, in console_to_str
 return s.decode(sys.__stdout__.encoding)
 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 51: 
invalid start byte

As a workaround I've changed the original line 73 in \pip\compat\__init__.py :

return s.decode(sys.__stdout__.encoding)

to:

return s.decode(sys.__stdout__.encoding, "replace")

(thanks to dieter on comp.lang.python for his help). I don't have the knowledge 
to propose a patch.

--
components: Windows
files: console.txt
messages: 308485
nosy: Cutter, Marcus.Smith, dstufft, ncoghlan, paul.moore, steve.dower, 
tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: pip can't handle MSVC warnings containing special characters
type: crash
versions: Python 3.6
Added file: https://bugs.python.org/file47334/console.txt

___
Python tracker 

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



Re: Python Learning

2017-12-17 Thread alister via Python-list
On Sat, 16 Dec 2017 14:41:00 +1200, Marko Rauhamaa wrote:

> r...@zedat.fu-berlin.de (Stefan Ram):
> 
>> Varun R  writes:
>>>I'm new to programming, can anyone guide me, how to start learning
>>>python programming language
>>
>>   As a start, one should learn:
>>
>> 1.) how to install Python
>> (if not already installed)
>>
>> 2.) how to start the Python console
>> (if not already started)
>>
>> 3.) how to type characters into a line of the
>> console and how to submit the line (using the Enter key) (if
>> this is not already known)
> 
> A good list. Even more important, though, is the installation, use and
> understanding of a text editor. What is the difference of MS Word,
> Notepad and a Python-aware text editor? What text editors are there?
> What is a newline? What is whitespace? (Advanced: what is a TAB.) What
> is the difference between lower case and upper case? What is trailing
> whitespace? What is an underscore?
> What is the difference between a parenthesis, bracket and a brace?
> 
> What is a file? What is a filename? What is a directory/folder? What is
> a pathname? What is a terminal (emulator)? What is standard input? What
> is standard output?
> 
> How do I see the listing of files? How do I erase a file? How do I
> rename a file? What is the current working directory? How do I change it
> and why?
> 
> 
> Marko

you seem to be moving more into knowledge about the operating system 
rather than programming itself.

Still a good pre-requisite you cannot hope to successfully program a 
system you do no know how to use



-- 
Mr Young hadn't had to quiet a screaming baby for years. He'd never been
much good at it to start with. He'd always respected Sir Winston 
Churchill,
and patting small versions of him on the bottom had always seemed
ungracious.
-- (Terry Pratchett & Neil Gaiman, Good Omens)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: argparse.ArgumentParser formatter_class argument

2017-12-17 Thread Peter Otten
Seb wrote:

> As far as I can see it is currently impossible to apply more than one
> class to an ArgumentParser.  For example, I'd like to use both
> RawDescriptionHelpFormatter *and* ArgumentDefaultsHelpFormatter in an
> ArgumentParser, but it seems that's impossible, as one can only choose a
> single one.  Any suggestions?

Try 

class MyHelpFormatter(
argparse.RawDescriptionHelpFormatter,
argparse.ArgumentDefaultsHelpFormatter
):
pass

parser = argparse.ArgumentParser(formatter_class=MyHelpFormatter)

If there are any conflicts you have to write more code...

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


Re: Python Templating Language

2017-12-17 Thread Brian J. Oney via Python-list
I am not exactly sure what you mean, so I will guess. 

Jinja may be what you're looking for. It's an important component of flask & 
ansible, for example.

pyweave may also serve your purposes.

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