Re: value of pi and 22/7

2016-06-17 Thread Tim Harig
On 2016-06-18, Steven D'Aprano  wrote:
> On Sat, 18 Jun 2016 09:49 am, Ian Kelly wrote:
>
>> If I tell you that the speed of light is 300,000,000 m/s, do you think
>> that measurement has 9 significant digits? If you do, then you would be
>> wrong.
> What if the figure to nine significant digits *actually is* three followed
> by eight zeroes?

The you can either write it as 3. (notice the trailing decimal
indicating that all of the zeros are indeed significant) or write it it
scientific notation.

> For all that it is in widespread use, I think the concept of "significant
> figures" is inherently ambiguous.

Only for those who do not understand it.

The main problem I have with significant figures is that measurement
accuracy is often not constrained to a decimal system.  A scale that can
measure in 1/5 units is more accurate than a scale that can measure only
in whole units but it is not as accurate as a scale that can measure
all 1/10 units.  Therefore it effectively has a fractional number of
significant figures.

I could just cut my loses and express the lower number of significant
figures but, I usually express the error explicitly instead:

 +- 0.2 units

where +- looks like the  html entity.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27337] 3.6.0a2 tarball has weird paths

2016-06-17 Thread Ned Deily

Ned Deily added the comment:

OK, thanks for the info.  I'm going to close this issue as "won't fix" and try 
real hard not to do it again.

--
resolution:  -> wont fix
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: best text editor for programming Python on a Mac

2016-06-17 Thread support


use notepad++
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2016-06-17 Thread Ian Kelly
On Fri, Jun 17, 2016 at 10:30 PM, Lawrence D’Oliveiro
 wrote:
> On Saturday, June 18, 2016 at 3:48:43 PM UTC+12, Random832 wrote:
>>
>> On Fri, Jun 17, 2016, at 19:12, Lawrence D’Oliveiro wrote:
>>>
>>> I’m not sure how you can write “30” with one digit...
>>
>> One *significant* digit.
>
> Like some credulous past-Bronze-age tribespeople understood the concept of 
> “significant digits” ...

I don't see why they should need to in order to measure one thing as
"thirty cubits" and another thing as "ten cubits" and write those
numbers down. Remember, the cubit was based on the length of the
forearm, so it's not like it was a terribly precise measurement to
begin with; they might not have understood significant figures, but
they probably wouldn't have been overly concerned about the difference
between thirty and thirty-one.

Check out the rest of the chapter. Every single measurement in it
above seven is a multiple of ten.

> I wonder what the quality of their workmanship was like, if a measurement 
> accurate to one significant digit was considered sufficient ...

You realize there can be a difference between the quality to which
something is constructed and the precision of the measurements later
used to describe it? "Threescore cubits long"  is an impressive
figure. "61 and a half cubits" doesn't do the job of communicating the
scale any better, and ultimately amounts to wasted words in what was
originally an oral tradition.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue22908] ZipExtFile in zipfile can be seekable

2016-06-17 Thread Jürgen A . Erhard

Jürgen A. Erhard added the comment:

To add to this (without looking at the patch): I just to my astonishment 
learned that a ZipExtFile doesn't even support tell().  I can understand the 
seek being nontrivial... but the tell?  It's a bytestream, and there is (isn't 
there?) a clear definition of what next byte a read(1) would deliver.  It 
should be trivial to keep track of the (only ever increasing) file position.

--
nosy: +jae

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-17 Thread Martin Panter

Martin Panter added the comment:

There is also Issue 13224 proposing to change __str__() to just return the 
__name__ or __qualname__ if I remember correctly.

--
nosy: +martin.panter

___
Python tracker 

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



[issue27341] mock.patch decorating a generator returns a regular function.

2016-06-17 Thread Shoshana Berleant

Shoshana Berleant added the comment:

I attached a file with 4 tests and the output. nosetests reports that all four 
tests were executed. In reality, only two tests were executed.

--
Added file: http://bugs.python.org/file43443/silentfail.py

___
Python tracker 

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



Re: value of pi and 22/7

2016-06-17 Thread Lawrence D’Oliveiro
On Saturday, June 18, 2016 at 3:48:43 PM UTC+12, Random832 wrote:
>
> On Fri, Jun 17, 2016, at 19:12, Lawrence D’Oliveiro wrote:
>>
>> I’m not sure how you can write “30” with one digit...
> 
> One *significant* digit.

Like some credulous past-Bronze-age tribespeople understood the concept of 
“significant digits” ...

I wonder what the quality of their workmanship was like, if a measurement 
accurate to one significant digit was considered sufficient ...

I feel a new phrase coming on: “good enough for Bible work”!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27341] mock.patch decorating a generator returns a regular function.

2016-06-17 Thread Shoshana Berleant

Shoshana Berleant added the comment:

output

--
Added file: http://bugs.python.org/file43444/actual.out

___
Python tracker 

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



[issue25548] Show the address in the repr for class objects

2016-06-17 Thread Peter Eisentraut

Peter Eisentraut added the comment:

I understand the reasoning here, but I want to say booh to this change in 
3.6.0a2 because it breaks my tests.  It used to be that type(x) returned a 
predictable string, and that was an easy way to verify the result types of 
things.

Perhaps a __str__ implementation could be added that avoids the memory address?

--
nosy: +petere

___
Python tracker 

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



[issue27258] Exception in BytesGenerator.flatten

2016-06-17 Thread Pedro Lacerda

Pedro Lacerda added the comment:

Seems that ``token.has_fws`` evaluates to True in the following condition

if token.has_fws:

causing ``token._fold(self)`` where isn't needed and raising the exception. 
Hope it helps!

By the way, why the _header_value_parser.py was removed from the repository?
https://github.com/python/cpython/blob/master/Lib/email/_header_value_parser.py#L144

--

___
Python tracker 

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



[issue27341] mock.patch decorating a generator returns a regular function.

2016-06-17 Thread Robert Collins

Robert Collins added the comment:

There are two related things here.

Firstly, the generator's body will run without the patch (because the wrapping 
function has 

try:
   return decorated(..)
finally:
   unpwatch()

Secondly, the wrapping function is itself not a generator, and anything that 
introspects functions to see if they are generators will not detect the wrapped 
function as one - which is I suspect whats tripping nose up, but I haven't 
actually checked the nose code to see what its doing/expecting.

--
nosy: +rbcollins
title: mock.patch decorator fails silently on generators -> mock.patch 
decorating a generator returns a regular function.

___
Python tracker 

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



[issue27341] mock.patch decorating a generator returns a regular function.

2016-06-17 Thread Robert Collins

Robert Collins added the comment:

Once fixed in CPython, we'll put the backport in mock, for folk using older 
Python's.

--
versions:  -Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



Re: (repost) Advisory: HTTP Header Injection in Python urllib

2016-06-17 Thread Random832
On Fri, Jun 17, 2016, at 21:00, Steven D'Aprano wrote:
> The author doesn't go into details of what sort of attacks against
> localhost they're talking about. An unauthenticated service running on
> localhost implies, to me, a single-user setup, where presumably the
> single-user has admin access to localhost. So I'm not really sure what
> "risk" they have

The issue - especially clearly in this context, which demonstrates a
working exploit for this vulnerability - is cross-site request forgery.
Which doesn't technically require the victim service to be HTTP (I
remember a proof of concept a while back which would trick a browser
into connecting to an IRC server), so long as it can ignore HTTP
headers.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2016-06-17 Thread Random832
On Fri, Jun 17, 2016, at 19:12, Lawrence D’Oliveiro wrote:
> I’m not sure how you can write “30” with one digit...

One *significant* digit. Though, as it happens, some ancient number
systems, including Hebrew and Greek, have one set of digits for 1-9, one
for 10-90, and one for 100-900.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue7164] pickle test failure after test_imp/test_import (_make_stat_result is not the same object as os._make_stat_result)

2016-06-17 Thread Peter Williams

Peter Williams added the comment:

I'm experiencing a variation of this problem on a project where I'm trying to 
make an application that will work with both 2.7.x and 3.4.x
and am mostly successful.  The application uses a number of pickle files
and I want to make it so that it doesn't matter which version created the 
pickle files the other can read it.  By limiting the 3.4 version to
pickle protocol 2 I've succeeded in having 2.7.x read 3.4.x pickle files
but encountered a problem going the other way with the following
error message:

Traceback (most recent call last):
  File "/home/peter/SRC/GITHUB/epygibus.git/epygibus3", line 25, in 
sys.exit(ARGS.run_cmd(ARGS))
  File 
"/home/peter/SRC/GITHUB/epygibus.git/epygibus_pkg/cli/subcmd_restore.py", line 
70, in run_cmd
snapshot.restore_subdir(args.archive_name, os.sep, seln_fn=lambda l: 
l[-1-args.back])
  File "/home/peter/SRC/GITHUB/epygibus.git/epygibus_pkg/snapshot.py", line 
699, in restore_subdir
snapshot_fs = get_snapshot_fs(archive_name, 
seln_fn).get_subdir(abs_subdir_path)
  File "/home/peter/SRC/GITHUB/epygibus.git/epygibus_pkg/snapshot.py", line 
595, in get_snapshot_fs
snapshot = read_snapshot(os.path.join(archive.snapshot_dir_path, 
snapshot_name))
  File "/home/peter/SRC/GITHUB/epygibus.git/epygibus_pkg/snapshot.py", line 
236, in read_snapshot
return pickle.load(fobj)
AttributeError: Can't get attribute '_make_stat_result' on 

I'm pretty sure that this is a result of that pickle file containing
instances of the output from os.lstat() generated by 2.7.x which 3.4.x
is having trouble instantiating.

The source code for the application with the problem is available on
github as repo "epygibus" for user "pwil3058".

--
nosy: +Peter Williams

___
Python tracker 

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



[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2016-06-17 Thread Martin Panter

Martin Panter added the comment:

Sorry about impersonating your name as committer Victor. I have been fixing 
this problem in recent patches, but because I imported your patch a while ago I 
forgot about it.

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



Re: value of pi and 22/7

2016-06-17 Thread Ethan Furman

On 06/17/2016 06:19 PM, Steven D'Aprano wrote:

On Sat, 18 Jun 2016 09:49 am, Ian Kelly wrote:



If I tell you that the speed of light is 300,000,000 m/s, do you think
that measurement has 9 significant digits? If you do, then you would be
wrong.


Hmmm.

If I tell you that some physical phenomenon [let's call it the speed of
light] is 299,999,999 m/s, how many significant digits would I be using?


I know!  I know!  9!


What if I tell you that it's 300,000,001 m/s?


Oh!  9 again!


What if the figure to nine significant digits *actually is* three followed
by eight zeroes?


Hmmm... thinking thinking... oh yeah!  You put a bar over the last 
significant digit -- or you use scientific notation:


30e7 has two significant digits.


For all that it is in widespread use, I think the concept of "significant
figures" is inherently ambiguous.


Not at all -- just have to keep your notations correct*.

--
~Ethan~

* Mine might be 30 years out of date, but maybe not.
--
https://mail.python.org/mailman/listinfo/python-list


Re: best text editor for programming Python on a Mac

2016-06-17 Thread Steven D'Aprano
On Sat, 18 Jun 2016 11:50 am, Lawrence D’Oliveiro wrote:

> On Saturday, June 18, 2016 at 12:59:16 PM UTC+12, MRAB wrote:
> 
>> Did you specify the encoding as described in the PEP?
> 
> Python 3 defaults to UTF-8.

That doesn't mean that upgrading to Python 3 will fix the problem. It *may*,
but since the details of what the precise problem are quite vague, it is
difficult to be sure. We know its an encoding problem, because that's what
the error message tells us, but beyond that, the symptoms reported are
unclear.



-- 
Steven

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


Re: best text editor for programming Python on a Mac

2016-06-17 Thread Steven D'Aprano
On Sat, 18 Jun 2016 09:52 am, Chris wrote:

> I have been trying to write a simple Hello World script on my Mac at work
> with TextEdit.  However, I keep getting this error message:
> 
> SyntaxError: Non-ASCII character '\xe2' in hello_world.py on line 1, but
> no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Have you tried declaring an encoding? Put this in the first line of your
file:

# -*- coding: utf-8 -*-

This is a "magic cookie" that tells the interpreter you are using UTF-8.
It's only needed if you include non-ASCII text in the file, as you appear
to be doing for some reason.

That might be sufficient to solve the problem. In theory it will be, so try
that first, but just in case something more mysterious is going on, read
on.


> I am using TextEdit in plain text mode.  The document was saved in UTF-8,
> and I still get the error message.

Are you *sure* it was UTF-8? Because I can't see likely way to get the byte
\xE2 as the*first* non-ASCII byte in a UTF-8 document.

The way UTF-8 works is that ASCII characters are encoded as the same bytes
used by ASCII. But non-ASCII characters get encoded as multi-byte sequences
of non-ASCII bytes. The first time Python sees a non-ASCII byte, it will
complain. So if it is complaining about byte \xE2 in UTF-8, you must have a
code point between U+1 and U+10, which seems unlikely unless you're
writing in Chinese, ancient Phoenician, or similar.

Unless... are you using an emoji? That might do it.

It's best if you show us your code. We may be able to diagnose the problem
more easily once we see that.


If it is possible that you're *not* using UTF-8 like you thought, then
perhaps you have Smart Quotes turned on? If you type ' ' or " ", do you see
curly quotes instead of foot/inch marks?

The character the Python interpreter is complaining about appears to be a
fancy quote of some sort. If I assume you're actually using the old default
Macintosh encoding, I get a kind of curly quote:

py> import unicodedata
py> unicodedata.name(b'\xe2'.decode('MacRoman'))
'SINGLE LOW-9 QUOTATION MARK'

which hints that when you type:

print 'Hello World'

in your file, you're seeing:

print ‚Hello World’

or similar. Or possibly you're actually using a Western European encoding,
like Latin-1, in which case you're probably using â.

py> unicodedata.name(b'\xe2'.decode('Latin-1'))
'LATIN SMALL LETTER A WITH CIRCUMFLEX'


But that contradicts the error message that the editor gives you:

> I tried switching to Western ASCII 
> encoding, but once I start typing, I get a message stating that the
> document can no longer be saved using its original Western (ASCII)
> encoding.
> 
> Any suggestions for a good open source text editor for the Mac out there? 
> For now, I am going to stick with vim.

I can only stress that if adding the magic encoding cookie to the file
doesn't fix it, we'll need to see the source code to diagnose the problem.


-- 
Steven

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


[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2016-06-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a09ae70f3489 by Victor Stinner in branch '2.7':
Issue #22636: Avoid using a shell in the ctypes.util module
https://hg.python.org/cpython/rev/a09ae70f3489

--

___
Python tracker 

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



Re: best text editor for programming Python on a Mac

2016-06-17 Thread Zachary Ware
On Jun 17, 2016 6:56 PM, "Chris via Python-list" 
wrote:
>
> I have been trying to write a simple Hello World script on my Mac at work
with TextEdit.

TextEdit is not just a simple text editor, it defaults to rich text mode.
You can either attempt to get TextEdit out of rich text mode and into plain
text mode, or use a different editor, like nano or vim (I'm pretty sure
both are available by default).

--
Zach
(On a phone)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: best text editor for programming Python on a Mac

2016-06-17 Thread Lawrence D’Oliveiro
On Saturday, June 18, 2016 at 12:59:16 PM UTC+12, MRAB wrote:

> Did you specify the encoding as described in the PEP?

Python 3 defaults to UTF-8.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27337] 3.6.0a2 tarball has weird paths

2016-06-17 Thread Peter Eisentraut

Peter Eisentraut added the comment:

The affected tar is indeed a BSD-ish tar (OS X).  With GNU tar I can proceed.  
It says "gtar: Removing leading `../' from member names".

So with that I agree that it's not worth rerolling this release.

--

___
Python tracker 

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



Re: value of pi and 22/7

2016-06-17 Thread Steven D'Aprano
On Sat, 18 Jun 2016 09:49 am, Ian Kelly wrote:

> If I tell you that the speed of light is 300,000,000 m/s, do you think
> that measurement has 9 significant digits? If you do, then you would be
> wrong.

Hmmm.

If I tell you that some physical phenomenon [let's call it the speed of
light] is 299,999,999 m/s, how many significant digits would I be using?

What if I tell you that it's 300,000,001 m/s?

What if the figure to nine significant digits *actually is* three followed
by eight zeroes?

For all that it is in widespread use, I think the concept of "significant
figures" is inherently ambiguous.



-- 
Steven

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


[issue27292] Warn users that os.urandom() can return insecure values

2016-06-17 Thread Martin Panter

Martin Panter added the comment:

Restored “On Linux” for the changed in 3.5.2 notice. I do think it is better to 
be general and future-proof, but that is a separate, less important issue to 
the main purpose of the patch. (I don’t know if Solaris’s version can block or 
not.)

--
stage: needs patch -> patch review
Added file: http://bugs.python.org/file43442/urandom-doc.v2.patch

___
Python tracker 

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



[issue27312] test_setupapp (idlelib.idle_test.test_macosx.SetupTest) fails on OS X

2016-06-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 61bd6974405f by Berker Peksag in branch 'default':
Issue #27312: Fix TypeError in test_setupapp
https://hg.python.org/cpython/rev/61bd6974405f

--

___
Python tracker 

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



Re: (repost) Advisory: HTTP Header Injection in Python urllib

2016-06-17 Thread Steven D'Aprano
On Sat, 18 Jun 2016 04:49 am, Paul Rubin wrote:

> The blog post below is from a couple days ago:
> 
>
http://blog.blindspotsecurity.com/2016/06/advisory-http-header-injection-in.html

> The blog post criticizes Redis and Memcached for not using any
> authentication (since "safe" internal networks are often not safe) and
> makes the interesting claim that even services on localhost should use
> authentication these days.


That's not quite what they say. They say that the problem is that "trusted
internal networks" are often no safer than the Internet and shouldn't be
trusted. It does also say:

"Even an unauthenticated service listening on localhost is risky these
days."

but fall short of *explicitly* recommending that they should be
authenticated. Although they do *implicitly* do so, by saying that "it
wouldn't be hard" for such services to include a password.

The author doesn't go into details of what sort of attacks against localhost
they're talking about. An unauthenticated service running on localhost
implies, to me, a single-user setup, where presumably the single-user has
admin access to localhost. So I'm not really sure what "risk" they have --
e.g. I'm sure that I could do all sorts of bad things to localhost by
exploiting http services. Or I could just go "sudo rm -rf /" [don't do this
at home]. Or whatever evil thing I had in mind.

But perhaps they mean a scenario where I'm running a service on localhost
and offering it to other users on a local network. In which case it makes
sense: trusted internal networks perhaps shouldn't be trusted.


-- 
Steven

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


Re: best text editor for programming Python on a Mac

2016-06-17 Thread MRAB

On 2016-06-18 00:52, Chris via Python-list wrote:

I have been trying to write a simple Hello World script on my Mac at work with 
TextEdit.  However, I keep getting this error message:

SyntaxError: Non-ASCII character '\xe2' in hello_world.py on line 1, but no 
encoding declared; see http://python.org/dev/peps/pep-0263/ for details

I am using TextEdit in plain text mode.  The document was saved in UTF-8, and I 
still get the error message.  I tried switching to Western ASCII encoding, but 
once I start typing, I get a message stating that the document can no longer be 
saved using its original Western (ASCII) encoding.

Any suggestions for a good open source text editor for the Mac out there?  For 
now, I am going to stick with vim.


Did you specify the encoding as described in the PEP?

It should be something like:

# -*- coding: utf-8 -*-

as the first or second line.

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


Re: best text editor for programming Python on a Mac

2016-06-17 Thread Ned Batchelder
On Friday, June 17, 2016 at 8:19:46 PM UTC-4, Lawrence D’Oliveiro wrote:
> On Saturday, June 18, 2016 at 11:52:35 AM UTC+12, Chris wrote:
> 
> > SyntaxError: Non-ASCII character '\xe2' in hello_world.py on line 1, but no
> > encoding declared; see http://python.org/dev/peps/pep-0263/ for details
> 
> The problem is the version of Python that comes with your Mac is obsolete.

That is not the problem.  Python 2 can handle non-ASCII characters just fine.

Chris: if you could show us the code in hello_world.py, we can help you
get it working.

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


[issue27344] zipfile *does* support utf-8 filenames

2016-06-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

There is a difference between 'official' and 'supported', and I don't quite 
know what you mean by the latter.

--
nosy: +terry.reedy

___
Python tracker 

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



Re: best text editor for programming Python on a Mac

2016-06-17 Thread Lawrence D’Oliveiro
On Saturday, June 18, 2016 at 11:52:35 AM UTC+12, Chris wrote:

> SyntaxError: Non-ASCII character '\xe2' in hello_world.py on line 1, but no
> encoding declared; see http://python.org/dev/peps/pep-0263/ for details

The problem is the version of Python that comes with your Mac is obsolete.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Method Chaining

2016-06-17 Thread Ned Batchelder
On Friday, June 17, 2016 at 6:23:12 PM UTC-4, Lawrence D’Oliveiro wrote:
> On Friday, June 17, 2016 at 8:13:50 PM UTC+12, Ned Batchelder wrote:
> 
> > But the unchained version is more explicit, and avoids
> > the awkward parenthesis.
> 
> You think of parentheses as “awkward”? Because elsewhere I see people 
> recommending you put them in even if you don’t need them, for “clarity”.

Parentheses are used for a number of different purposes. It won't be
possible to make a sweeping statement about them everywhere.

I use "extra" parentheses to make operator application order clearer
where it isn't obvious to me, for example.

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


[issue27341] mock.patch decorator fails silently on generators

2016-06-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

3.2 to 3.4 only get security fixes

please provide a simple test that fails now and that you think should pass or 
at least warn.

--
nosy: +michael.foord, terry.reedy
stage:  -> test needed

___
Python tracker 

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



[issue27312] test_setupapp (idlelib.idle_test.test_macosx.SetupTest) fails on OS X

2016-06-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

My suggested mock was for the wrong function.  Please let me know what happens 
next time you pull and run test_idle whether alone or with the suite.

--

___
Python tracker 

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



best text editor for programming Python on a Mac

2016-06-17 Thread Chris via Python-list
I have been trying to write a simple Hello World script on my Mac at work with 
TextEdit.  However, I keep getting this error message:

SyntaxError: Non-ASCII character '\xe2' in hello_world.py on line 1, but no 
encoding declared; see http://python.org/dev/peps/pep-0263/ for details

I am using TextEdit in plain text mode.  The document was saved in UTF-8, and I 
still get the error message.  I tried switching to Western ASCII encoding, but 
once I start typing, I get a message stating that the document can no longer be 
saved using its original Western (ASCII) encoding.

Any suggestions for a good open source text editor for the Mac out there?  For 
now, I am going to stick with vim.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27312] test_setupapp (idlelib.idle_test.test_macosx.SetupTest) fails on OS X

2016-06-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 90fd1c17214b by Terry Jan Reedy in branch 'default':
Issue #27312: mock out function that fails when called from setupApp during
https://hg.python.org/cpython/rev/90fd1c17214b

--
nosy: +python-dev

___
Python tracker 

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



Re: value of pi and 22/7

2016-06-17 Thread Ian Kelly
On Jun 17, 2016 5:44 PM, "Lawrence D’Oliveiro" 
wrote:
>
> On Saturday, March 19, 2011 at 3:16:41 AM UTC+13, Grant Edwards wrote:
> >
> > On 2011-03-18, peter wrote:
> >
> >> The Old Testament (1 Kings 7,23) says ... "And he made a molten sea,
> >> ten cubits from the one brim to the other: it was round all about, and
> >> his height was five cubits: and a line of thirty cubits did compass it
> >> round about. ".  So pi=3.  End Of.
> >
> > There's nothing wrong with that value.  The measurements were given
> > with one significant digit, so the ratio of the two measurements
> > should only have one significant digit.
>
> I’m not sure how you can write “30” with one digit...

If I tell you that the speed of light is 300,000,000 m/s, do you think that
measurement has 9 significant digits? If you do, then you would be wrong.

By the way, you're also replying to posts that are more than 5 years old.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2016-06-17 Thread Lawrence D’Oliveiro
On Saturday, March 19, 2011 at 3:16:41 AM UTC+13, Grant Edwards wrote:
>
> On 2011-03-18, peter wrote:
> 
>> The Old Testament (1 Kings 7,23) says ... "And he made a molten sea,
>> ten cubits from the one brim to the other: it was round all about, and
>> his height was five cubits: and a line of thirty cubits did compass it
>> round about. ".  So pi=3.  End Of.
> 
> There's nothing wrong with that value.  The measurements were given
> with one significant digit, so the ratio of the two measurements
> should only have one significant digit.

I’m not sure how you can write “30” with one digit...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: value of pi and 22/7

2016-06-17 Thread Lawrence D’Oliveiro
On Friday, March 18, 2011 at 8:21:36 AM UTC+13, Rotwang wrote:

> sum_{j = 1}^\infty 10^{-j!} 

You forgot a “\” in front of “sum”.

(Of course I had to try it in IPython...)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27309] Visual Styles support to tk/tkinter file and message dialogs

2016-06-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

tkinter.messagebox is based on tkinter.commondialog, first written in 1997. 
Since it works as originally designed, it does not seem to have been 
significantly altered since before themed widgets. Upgrading would be an 
enhancement for future versions, not a bugfix for all versions.

The SO answer is correct that tkinter does not build the messagebox, but indeed 
calls into tk with, for message boxes, the command "tk_messageBox", to get the 
builtin box.

Since I am converting IDLE on 3.6 to use ttk where appropriate, I would very 
mush like to be able to get the better looking versions of the builtin dialogs 
-- and in 3.6 -- and on all 3 majore systems, not just Windows.  Since tkinter 
still supports 8.4 (should this change?) and ttk requires 8.5, this needs to be 
an option or at least version dependent.

I report this issue in a comment on 'patthoyts' answer.

--
components: +Tkinter
nosy: +serhiy.storchaka, terry.reedy
stage:  -> test needed
title: Visual Styles support -> Visual Styles support to tk/tkinter file and 
message dialogs
type: behavior -> enhancement
versions: +Python 3.6 -Python 3.4, Python 3.5

___
Python tracker 

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



Re: What is structured programming (was for/while else doesn't make sense)

2016-06-17 Thread Lawrence D’Oliveiro
On Saturday, June 18, 2016 at 4:32:26 AM UTC+12, Rustom Mody wrote:

> I wonder whether "red herring" is your red herring 

I wasn’t the one trying to draw a completely spurious equivalence between 
structured programming and gotos.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue19756] test_nntplib: sporadic failures, network isses? server down?

2016-06-17 Thread Martin Panter

Martin Panter added the comment:

Thanks Berker. In this case the previous tests using the same NNTP connection 
object were skipped. First run:

test_unknown_command (test.test_nntplib.NetworkedNNTPTests) ... ok
test_welcome (test.test_nntplib.NetworkedNNTPTests) ... ok
test_with_statement (test.test_nntplib.NetworkedNNTPTests) ... skipped 
"Resource 'news.trigofacile.com' is not available"
test_xhdr (test.test_nntplib.NetworkedNNTPTests) ... skipped "Resource 
'news.trigofacile.com' is not available"
test_xover (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_zlogin (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_zzquit (test.test_nntplib.NetworkedNNTPTests) ... ERROR

Subsequent retry:

test_xover (test.test_nntplib.NNTPv2Tests) ... ok
test_article_head_body (test.test_nntplib.NetworkedNNTPTests) ... skipped 
"Resource 'news.trigofacile.com' is not available"
test_capabilities (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_date (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_description (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_descriptions (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_group (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_help (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_list (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_list_active (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_newgroups (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_over (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_unknown_command (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_welcome (test.test_nntplib.NetworkedNNTPTests) ... ok
test_with_statement (test.test_nntplib.NetworkedNNTPTests) ... ok
test_xhdr (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_xover (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_zlogin (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_zzquit (test.test_nntplib.NetworkedNNTPTests) ... ERROR

Test_with_statement() is a special case because it starts a fresh NNTP 
connection, rather than reusing self.server. Test_welcome() is also different 
because it does not send any new commands to the server. But I presume the 
other tests all try to reuse the old timed-out self.server object. The skipped 
messages are evidence of this.

The easy solution which I mentioned above would be to change setUpClass() to 
setUp(), although this might slow the tests down a bit, reconnecting to the 
remote server for each test method.

The solution that I prefer would be as Antoine suggested, to run our own 
server. I think expanding the server I created in Issue 25859 with more 
commands would be good enough.

--

___
Python tracker 

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



Re: Method Chaining

2016-06-17 Thread Michael Selik
On Fri, Jun 17, 2016, 6:44 PM Michael Selik  wrote:

>
>
> On Fri, Jun 17, 2016, 6:42 PM Lawrence D’Oliveiro 
> wrote:
>
>> On Saturday, June 18, 2016 at 1:35:06 AM UTC+12, Michael Selik wrote:
>>
>> > The chained version looks like each method is returning a modified
>> > copy.
>>
>> As opposed to a modified original?
>>
>
> Correct. Read the rationale for list.sort returning None. It's in the
> Python design FAQ.
>

Sorry, I should have included the link.

https://docs.python.org/2/faq/design.html#why-doesn-t-list-sort-return-the-sorted-list

Even if we're talking about a non-mutation side-effect, I think the same
rationale applies.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Method Chaining

2016-06-17 Thread Michael Selik
On Fri, Jun 17, 2016, 6:42 PM Lawrence D’Oliveiro 
wrote:

> On Saturday, June 18, 2016 at 1:35:06 AM UTC+12, Michael Selik wrote:
>
> > The chained version looks like each method is returning a modified
> > copy.
>
> As opposed to a modified original?
>

Correct. Read the rationale for list.sort returning None. It's in the
Python design FAQ.

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


Re: Method Chaining

2016-06-17 Thread Lawrence D’Oliveiro
On Saturday, June 18, 2016 at 1:35:06 AM UTC+12, Michael Selik wrote:

> The chained version looks like each method is returning a modified
> copy.

As opposed to a modified original?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27342] Clean up some Py_XDECREFs in rangeobject.c and bltinmodule.c

2016-06-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

v2 looks correct.

--
nosy: +rhettinger

___
Python tracker 

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



Re: Method Chaining

2016-06-17 Thread Lawrence D’Oliveiro
On Saturday, June 18, 2016 at 4:48:30 AM UTC+12, Rustom Mody wrote:

> One thing about python OOP that irritates me is the 'self.' clutter.
> With a Pascal/VB style with-statement its naturally taken care of

I used to use “with”-statements back in my Pascal days. Then I had this nasty 
bug where a piece of code I wrote didn’t mean what I thought it meant (which 
wasn’t supposed to happen in Pascal). For months I blamed the bug on the app 
API (HyperCard)...

Once I realized my mistake, I went off “with”-statements completely.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Method Chaining

2016-06-17 Thread Lawrence D’Oliveiro
On Friday, June 17, 2016 at 8:13:50 PM UTC+12, Ned Batchelder wrote:

> But the unchained version is more explicit, and avoids
> the awkward parenthesis.

You think of parentheses as “awkward”? Because elsewhere I see people 
recommending you put them in even if you don’t need them, for “clarity”.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26923] asyncio.gather drops cancellation

2016-06-17 Thread Guido van Rossum

Guido van Rossum added the comment:

Thanks! I had eventually pieced together the same explanation. So yes, I
think your fix is right, though I would write it like this:

ret = False
for child in self._children:
ret |= child.cancel()
return ret  # True if at least one child.cancel() call returned True

It would also be nice if there was a test for this behavior.

I keep worrying a bit -- a similar bug could exist in other pieces of the
code, or in other libraries. But I guess we can't do much about that.

--

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2016-06-17 Thread Berker Peksag

Berker Peksag added the comment:

I just saw the same test failures at 
http://buildbot.python.org/all/builders/AMD64%20Debian%20root%203.5/builds/998/steps/test/logs/stdio

I'm attaching the test logs for future reference.

--
nosy: +berker.peksag
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.5, Python 3.6 -Python 3.3, Python 3.4
Added file: http://bugs.python.org/file43441/test_nntplib_logs.txt

___
Python tracker 

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



ANN: Wing IDE 5.1.12 released

2016-06-17 Thread Wingware

Hi,

Wingware has released version 5.1.12 of Wing IDE, our cross-platform 
integrated development environment for the Python programming language.


Wing IDE features a professional code editor with vi, emacs, visual 
studio, and other key bindings, auto-completion, call tips, 
context-sensitive auto-editing, goto-definition, find uses, refactoring, 
a powerful debugger, version control, unit testing, search, project 
management, and many other features.


This release includes the following minor improvements:

Updated German localization (thanks to Christoph Heitkamp)
Fixed Configure Project for Django to work if Start Django Project 
was not used first
Don't show deprecation warnings for inspect.getargspec for debug 
processes and Python Shell running with Python 3.5

Fixed failure to analyze files in the background
8 other minor bug fixes

For details see http://wingware.com/news/2016-06-17 and 
http://wingware.com/pub/wingide/5.1.12/CHANGELOG.txt


What's New in Wing 5.1:

Wing IDE 5.1 adds multi-process and child process debugging, syntax 
highlighting in the shells, support for pytest, Find Symbol in Project, 
persistent time-stamped unit test results, auto-conversion of indents on 
paste, an XCode keyboard personality, support for Flask, Django 1.7 to 
1.9, Python 3.5, and recent Google App Engine versions, improved 
auto-completion for PyQt, recursive snippet invocation, and many other 
minor features and improvements.


Free trial: http://wingware.com/wingide/trial
Downloads: http://wingware.com/downloads
Feature list: http://wingware.com/wingide/features
Sales: http://wingware.com/store/purchase
Upgrades: https://wingware.com/store/upgrade

Questions?  Don't hesitate to email us at supp...@wingware.com.

Thanks,

--

Stephan Deibel
Wingware | Python IDE

The Intelligent Development Environment for Python Programmers

wingware.com

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


[issue24424] xml.dom.minidom: performance issue with Node.insertBefore()

2016-06-17 Thread Robert Haschke

Robert Haschke added the comment:

I don't see how to further minimize the checks - all of them are required. I 
think, the most common uses cases to create a document are appendChild(), which 
is not affected, and insertBefore() using the same refChild for a while. In 
that case, the patch gives a tremendous speedup.

If you as maintainers don't want to share this improvement with the community, 
it's your choice and I will be fine with that.

--

___
Python tracker 

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



[issue27305] Crash with "pip list --outdated" on Windows 10 with Python 2.7.12rc1

2016-06-17 Thread James Paget

James Paget added the comment:

The 2.7.12rc1+ build resolves the issue for me.

--

___
Python tracker 

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



[issue26536] Add the SIO_LOOPBACK_FAST_PATH option to socket.ioctl

2016-06-17 Thread Steve Dower

Steve Dower added the comment:

All looked good to me, and as far as I could see all of Berker's feedback was 
addressed, so consider it in!

--
assignee:  -> steve.dower
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



[issue26536] Add the SIO_LOOPBACK_FAST_PATH option to socket.ioctl

2016-06-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f8957c755c7a by Steve Dower in branch 'default':
Issue #26536: socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by Daniel 
Stokes.
https://hg.python.org/cpython/rev/f8957c755c7a

--
nosy: +python-dev

___
Python tracker 

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



[issue27048] distutils._msvccompiler._get_vc_env() fails with UnicodeDecodeError if an env var is not encodable

2016-06-17 Thread Eryk Sun

Eryk Sun added the comment:

vcvarsall.bat is mostly `set` and `echo` statements, which print using UTF-16LE 
with "/u". It also runs reg.exe, but with stdout and stderr redirected to nul, 
so that's no problem. The final `set` command prints cmd's UTF-16LE 
environment. Using errors='replace' shouldn't be necessary. It doesn't hurt, 
however.

--

___
Python tracker 

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



[issue27344] zipfile *does* support utf-8 filenames

2016-06-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
stage:  -> needs patch
versions: +Python 3.5

___
Python tracker 

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



[issue24424] xml.dom.minidom: performance issue with Node.insertBefore()

2016-06-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This slow down is not such small -- up to 25% for every insertBefore(). If most 
calls of insertBefore() are not with the same refChild, the benefit from the 
optimization of one special case can be dwarfed. Try to minimize the overhead 
of the optimization. If you succeed the chances of acceptance of the patch will 
increase.

I think that the availability of alternatives (upgrading to Python 3 or using 
ElementTree) plays against the acception of this optimization. Since it looks 
more as new feature to me, you have to convince the maintainer of 2.7 to take 
the patch in 2.7.

--
nosy: +benjamin.peterson

___
Python tracker 

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



(repost) Advisory: HTTP Header Injection in Python urllib

2016-06-17 Thread Paul Rubin
The blog post below is from a couple days ago:

http://blog.blindspotsecurity.com/2016/06/advisory-http-header-injection-in.html

It reports that it's possible to inject fake http headers into requests
sent by urllib2(python2) and urllib(python3), by getting the library to
retrieve a url concocted to have a newline followed by other headers.  A
malicious site can do this by redirecting from a normal url to a
concocted one.  It gives examples of some exploits possible with this
trick, against Redis and Memcached.

There's a small HN thread here:
   https://news.ycombinator.com/item?id=11921568

Someone there mentions "Python 3.5.0+, 3.4.4+ and 2.7.9+ are not
vulnerable" since there's been a patch, but some Linux distros still use
older versions.

I don't know the situation with python2 urllib or with the request
library.

The blog post criticizes Redis and Memcached for not using any
authentication (since "safe" internal networks are often not safe) and
makes the interesting claim that even services on localhost should use
authentication these days.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27305] Crash with "pip list --outdated" on Windows 10 with Python 2.7.12rc1

2016-06-17 Thread Steve Dower

Steve Dower added the comment:

Just made another "release" build from the latest source (with OpenSSL 1.0.2h) 
and can no longer repro this issue, so I'm closing it.

If anyone wants to try with the same build, it will be up at 
https://ptvs.blob.core.windows.net/temp/python-2.7.12.amd64.msi for a little 
while. It's not the final 2.7.12, despite the filename, so please only use it 
for reproducing this issue and then fully uninstall it (otherwise you'll likely 
encounter issues in the future):

>>> sys.version
'2.7.12rc1+ (2.7:dd2cc11bc170, Jun 17 2016, 16:14:27) [MSC v.1500 64 bit 
(AMD64)]'

--
assignee:  -> steve.dower
resolution:  -> fixed
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



[issue24294] DeprecationWarnings should be visible by default in the interactive REPL

2016-06-17 Thread Aaron Meurer

Changes by Aaron Meurer :


--
nosy: +Aaron.Meurer

___
Python tracker 

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



Re: value of pi and 22/7

2016-06-17 Thread MRAB

On 2016-06-17 17:51, hed...@hedgui.com wrote:

Pi simply is not 3.14159

Time to go to remedial school everyone.

If I do something on one side of the equation, I have to do the same on the 
other side of the equation.

With Pi, we are TAKING the diameter, so subtract the width of diameter from the 
circumference of the circle and you have an ellipse, now there is thousands of 
diameters. ⭕o

I suggest that Pi is = D*-7

Don't forget to put the diameter back.


You're replying to a post from March 2011.

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


Re: value of pi and 22/7

2016-06-17 Thread hedgui
Pi simply is not 3.14159

Time to go to remedial school everyone.

If I do something on one side of the equation, I have to do the same on the 
other side of the equation.

With Pi, we are TAKING the diameter, so subtract the width of diameter from the 
circumference of the circle and you have an ellipse, now there is thousands of 
diameters. ⭕o 

I suggest that Pi is = D*-7

Don't forget to put the diameter back.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Method Chaining

2016-06-17 Thread Rustom Mody
On Friday, June 17, 2016 at 2:58:19 PM UTC+5:30, Steven D'Aprano wrote:
> On Fri, 17 Jun 2016 06:13 pm, Ned Batchelder wrote:
> 
> > To me, it's a toss-up.  The chained version is nice in that it removes the
> > repetition of "g".  But the unchained version is more explicit, and avoids
> > the awkward parenthesis.
> > 
> > I think I would lean toward the unchained version.  Clearly tastes can
> > differ.
> 
> Indeed. For what it's worth, I'm ever-so-slightly leaning towards Lawrence's
> taste here.

More than 'slightly' out here!
One thing about python OOP that irritates me is the 'self.' clutter.
With a Pascal/VB style with-statement its naturally taken care of

Yeah I know there is this FAQ:
https://docs.python.org/2/faq/design.html#why-doesn-t-python-have-a-with-statement-for-attribute-assignments

I consider it bogus if we allow with to mean something like:
https://msdn.microsoft.com/en-us/library/wc500chb.aspx
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27048] distutils._msvccompiler._get_vc_env() fails with UnicodeDecodeError if an env var is not encodable

2016-06-17 Thread Steve Dower

Steve Dower added the comment:

Oh, and before anyone asks, I used "errors='replace'" because we get all the 
env variables but don't use most of them. If we do end up needing one that 
can't be decoded, this should make it obvious, but there's no point failing 
early because of a variable that we're not going to use.

--

___
Python tracker 

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



Re: What is structured programming (was for/while else doesn't make sense)

2016-06-17 Thread Rustom Mody
On Friday, June 17, 2016 at 7:23:27 AM UTC+5:30, Lawrence D’Oliveiro wrote:
> On Thursday, June 16, 2016 at 11:13:14 PM UTC+12, Rustom Mody wrote:
> 
> > Please see https://en.wikipedia.org/wiki/Nassi%E2%80%93Shneiderman_diagram
> > 
> > | Nassi–Shneiderman diagrams are (almost) isomorphic with
> > | flowcharts. Everything you can represent with a Nassi–Shneiderman
> > | diagram you can also represent with a flowchart.
> > 
> > which is in line with what I am saying, viz that break/continue/goto are 
> > same
> > in the sense of being 'unstructured' and therefore do not fit into a
> > structured framework like NSDs
> 
> This is just a restatement of the “structure theorem”, which proves that 
> structured control statements are mathematically equivalent to gotos, and 
> anything that can be expressed one way can be expressed the other way.
> 
> True, but a complete red herring.

I wonder whether "red herring" is your red herring 


You talk of THE structure theorem.  Is there one?
Wikipedia's https://en.wikipedia.org/wiki/Structured_program_theorem has a 
references section with some two dozen links.

Many of these pull in significantly opposite direction with small changes in
conditions/clauses/definitions etc.

Here is a selection. Which is for you "THE theorem"?

[WHILE means language of structured programs -- think prototypical Pascal

FLOW is language of flowcharts]
===

Böhm and Jacopini show that that WHILE is equivalent to FLOW by showing
how to translate every program in FLOW into WHILE.  [Reverse translation is 
trivial] However...
Ashcroft and Manna [Translation of Goto to while]
Can every flowchart program be translated into an equivalent while
program without adding extra variables? (i.e., using only the original
state vector). NO!

[They go on]
Bohm and Jacopini have shown that every FLOW program can
be effectively translated into an equivalent WHILE program (WITH ONE WHILE
statement) hence the topology of the program is changed...
We (Ashcroft and Manna) show how to transform flowchart into while *preserving* 
topology.


Knuth and Floyd: [Notes on avoiding goto statements]
prove the existence of programs whose go to
statements cannot be eliminated without introducing procedure calls.

Kosaraju proved that it's possible to avoid adding additional variables in 
structured programming, as long as arbitrary-depth, multi-level breaks from 
loops are allowed.[1][14] Furthermore, Kosaraju proved that a strict hierarchy 
of programs exists, nowadays called the Kosaraju hierarchy, in that for every 
integer n, there exists a program containing a multi-level break of depth n 
that cannot be rewritten as program with multi-level breaks of depth less than 
n (without introducing additional variables)


=
IOW when you say "mathematically equivalent" you can mean whatever you like!!
Unless you clarify in what sense 'equivalent'
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27048] distutils._msvccompiler._get_vc_env() fails with UnicodeDecodeError if an env var is not encodable

2016-06-17 Thread Steve Dower

Steve Dower added the comment:

I went ahead and updated the subprocess call just in _msvccompiler to use cmd 
/u, as I like that fix.

Not so keen on doing it for all subprocess(shell=True) calls, since we can't 
reliably predict whether the output will actually respect the option.

--
assignee:  -> steve.dower
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



[issue27048] distutils._msvccompiler._get_vc_env() fails with UnicodeDecodeError if an env var is not encodable

2016-06-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 15900c612ca7 by Steve Dower in branch '3.5':
Issue #27048: Prevents distutils failing on Windows when environment variables 
contain non-ASCII characters
https://hg.python.org/cpython/rev/15900c612ca7

New changeset bb22ae1e1bcd by Steve Dower in branch 'default':
Issue #27048: Prevents distutils failing on Windows when environment variables 
contain non-ASCII characters
https://hg.python.org/cpython/rev/bb22ae1e1bcd

--
nosy: +python-dev

___
Python tracker 

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



[issue24424] xml.dom.minidom: performance issue with Node.insertBefore()

2016-06-17 Thread Robert Haschke

Robert Haschke added the comment:

Indeed there is a small slow down for insertion at the beginning.
However, this is simply due to the extra function _index() and thus linear in 
the number of insertion operations.

My patch essentially boosts insertions before /any fixed/ node.
If this reference node changes between insertions (as in your "before first" 
example), there is no gain anymore.

Of course, this optimization comes at the cost of an additional integer per 
node. There is no free lunch!

I know, that there are other parsers (e.g. etree) available. However
changing my existing code base from minidom to etree will be a heavy change, 
which isn't easily accepted as well.

I think, my minidom patch is a clean and simple fix to a common performance 
issue. As it mostly effects 2.7, it should primarily go there ;-)

--

___
Python tracker 

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



[issue27305] Crash with "pip list --outdated" on Windows 10 with Python 2.7.12rc1

2016-06-17 Thread Steve Dower

Steve Dower added the comment:

A build issue like that is fairly likely - I don't touch 2.7 apart from 
releases and so all I did was restart my build VM, pull and hit rebuild. There 
may be another clean step required when the OpenSSL version changes.

We're getting another update before the final release, so I'll clean up the 
build VM now in preparation.

--

___
Python tracker 

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



[issue27342] Clean up some Py_XDECREFs in rangeobject.c and bltinmodule.c

2016-06-17 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for review. Eliminate the wrongs ones.

--
Added file: http://bugs.python.org/file43440/cleanup_some_xdecrefs_v2.patch

___
Python tracker 

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



[issue27333] validate_step in rangeobject.c, incorrect code logic but right result

2016-06-17 Thread Xiang Zhang

Xiang Zhang added the comment:

This looks fine. But maybe code like this looks more clear:

if (step && _PyLong_Sign(step) == 0) {
PyErr_SetString(PyExc_ValueError,
"range() arg 3 must not be zero");
Py_CLEAR(step);
}

I think assert(PyLong_Check(step)) can be left out since _PyLong_Sign also 
checks it.

--

___
Python tracker 

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



[issue27344] zipfile *does* support utf-8 filenames

2016-06-17 Thread Daniel Holth

New submission from Daniel Holth:

The zipfile documentation says "There is no official file name encoding for ZIP 
files." However ZIP and zipfile supports utf-8 filenames; this has been true 
for a long time, at least since Python 2.7.

--
assignee: docs@python
components: Documentation
messages: 268727
nosy: dholth, docs@python
priority: normal
severity: normal
status: open
title: zipfile *does* support utf-8 filenames
versions: Python 2.7, Python 3.6

___
Python tracker 

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



[issue24424] xml.dom.minidom: performance issue with Node.insertBefore()

2016-06-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file43439/etree_example.py

___
Python tracker 

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



[issue24424] xml.dom.minidom: performance issue with Node.insertBefore()

2016-06-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your example Robert.

If modify your example for inserting new nodes before the first one, it shows 
the slowdown with your patch.

$ ./python minidom_example2.py old new
oldtime for 5000 iterations: 0.189058
newtime for 5000 iterations: 0.254402

The question is whether your case is enough common to compensate the slowdown 
of other cases.

Yest one disadvantage of your patch is increasing memory consumption (this can 
be partly compensated by adding '_index_cache' to slots).

Have you considered the option of using Python 3? In Python 3 your example is 
much faster even without your patch (but still has quadratic complexity).

Python 2.7:
oldtime for 5000 iterations: 68.485284
newtime for 5000 iterations: 0.237943

Python 3.6:
oldtime for 5000 iterations: 0.695023
newtime for 5000 iterations: 0.212854

And the best option is using ElementTree. It accepts an index instead of a 
subelement for insertion.

$ ./python etree_example.py
Python 2.7:
time for 5000 iterations: 0.037805

Python 3.6:
time for 5000 iterations: 0.015566

--
Added file: http://bugs.python.org/file43438/minidom_example2.py

___
Python tracker 

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



[issue18373] let code force str(bytes) to raise an exception

2016-06-17 Thread Daniel Holth

Daniel Holth added the comment:

What if we changed it so that Python code could only disable str_bytes() 
process-wide, editing the original flag? Would that be fatal to debuggers and 
the repl?

--

___
Python tracker 

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



Re: Method Chaining

2016-06-17 Thread Michael Selik
On Fri, Jun 17, 2016 at 5:31 AM Steven D'Aprano  wrote:

> (g.move_to((p1 + p2a) / 2)
>   .line_to(p1 + (p2 - p1) * frac)
>   .line_to((p1 + p1a) / 2)
>   .stroke()
>   )
>
> the parens and indentation more clearly mark this chunk of code as a
> unit.


I prefer reserving indentation for where they're required ("for", "while",
"if", etc.). In this case, I'd use an extra blank line before and after.
Or, better, I'd move the chunk of code into a function by itself.

On the other hand, I like the fact that methods which are
> conceptually procedures that operate by side-effect return None.
>

Exactly. The chained version looks like each method is returning a modified
copy. The Pandas library isn't perfect, but it has a good consistency for
methods returning copies unless explicitly "inplace=True", in which case
the method returns None.

Paraphrasing Jakob's law of user experience [0], it doesn't matter if your
design is better. People are more familiar with the design of other
libraries and will expect yours to behave the same way: impure methods
return None, unless named "pop" or a similar standard.

[0] https://www.nngroup.com/articles/end-of-web-design/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27342] Clean up some Py_XDECREFs in rangeobject.c and bltinmodule.c

2016-06-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Mostly good except longrangeiter_dealloc().

--
components: +Interpreter Core
nosy: +mark.dickinson
stage:  -> patch review
type:  -> enhancement
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



[issue27333] validate_step in rangeobject.c, incorrect code logic but right result

2016-06-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Current code is valid, since neither PY_SSIZE_MAX nor PY_SSIZE_MIN equal to 0.

But testing on 0 can be simpler. Following patch simplifies the code.

--
nosy: +mark.dickinson
stage:  -> patch review
type: behavior -> enhancement
versions:  -Python 2.7, Python 3.5
Added file: http://bugs.python.org/file43437/range_validate_step.patch

___
Python tracker 

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



[issue24424] xml.dom.minidom: performance issue with Node.insertBefore()

2016-06-17 Thread Robert Haschke

Robert Haschke added the comment:

I uploaded a simple example to illustrate the tremendous performance boost. 
Obviously, the example exploits the caching improvement as much as possible: 
The code assembles a XML document by inserting new nodes before the last one...
These are the timing results:
$ python minidom_example.py old new
oldtime for 5000 iterations: 18.422152
newtime for 5000 iterations: 0.129384

$ python minidom_example.py old new
oldtime for 1 iterations: 68.305351
newtime for 1 iterations: 0.142071

You see the quadratic increase of time...
IMHO, this is clearly a (performance) bug and really many people in the ROS 
community are affected. Hence, I hope that this patch will find its way into 
some python versions currently used by standard Linux distributions.

--
Added file: http://bugs.python.org/file43436/minidom_example.py

___
Python tracker 

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



[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-17 Thread Oren Milman

Changes by Oren Milman :


Added file: http://bugs.python.org/file43435/proposedPatches.diff

___
Python tracker 

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



[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-17 Thread Oren Milman

Changes by Oren Milman :


Added file: http://bugs.python.org/file43434/badMicroBenchProposedPatches.diff

___
Python tracker 

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



[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-17 Thread Oren Milman

Oren Milman added the comment:

I did some micro-benchmarking, and it looks like bad news for my patch.

I wrote a simple C extension in order to call PyLong_AsUnsignedLongMask and 
PyLong_AsUnsignedLongLongMask from Python code (attached).
Then I ran the following micro-benchmarks using both the default CPython branch 
and my patched CPython:
1. small ints:
python.exe -m timeit -s "import capiWrapper" "print('bug') if any(i != 
capiWrapper.asUnsignedLongMaskWrapper(i) for i in range(10 ** 6)) else None"
python.exe -m timeit -s "import capiWrapper" "print('bug') if any(i != 
capiWrapper.asUnsignedLongLongMaskWrapper(i) for i in range(10 ** 6)) else None"
with the following results:
asUnsignedLongMaskWrapper:
default: 312 msec, patched: 353 msec
asUnsignedLongLongMaskWrapper:
default: 319 msec, patched: 356 msec

2. big ints:
python.exe -m timeit -s "import capiWrapper; bigInt = 10 ** 1000" "print('bug') 
if any((i & 0x) != capiWrapper.asUnsignedLongMaskWrapper(i) for i in 
range(bigInt, bigInt + 1)) else None"
python.exe -m timeit -s "import capiWrapper; bigInt = 10 ** 1000" "print('bug') 
if any((i & 0x) != capiWrapper.asUnsignedLongLongMaskWrapper(i) 
for i in range(bigInt, bigInt + 1)) else None"
with the following results:
when bigInt = 10 ** 1000:
asUnsignedLongMaskWrapper:
default: 23.1 msec, patched: 21.5 msec
asUnsignedLongLongMaskWrapper:
default: 24.1 msec, patched: 21.7 msec

when bigInt = 10 ** 150:
asUnsignedLongMaskWrapper:
default: 7.72 msec, patched: 7.82 msec
asUnsignedLongLongMaskWrapper:
default: 8.03 msec, patched: 7.99 msec


To sum it up, my patch degrades performance for ints smaller than 
(approximately) 10 ** 150, and improves performance for bigger ints. 

Seems to me like it doesn't worth it. 
I attached the patches diff file anyway, for the sake of documentation.

==

That leaves us with the proposed changes in Modules/_testcapimodule.c.
The diff file for these (hopefully my final diff file for this issue) is also 
attached.

--
Added file: http://bugs.python.org/file43433/capiWrapperModule.c

___
Python tracker 

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



[issue27213] Rework CALL_FUNCTION* opcodes

2016-06-17 Thread Demur Rumed

Demur Rumed added the comment:

I've been working on this, may have the ceval portion mostly worked out but 
can't test until I finish the compile portion. Haven't had time this week, will 
have time to focus this weekend

--

___
Python tracker 

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



[issue15243] Misleading documentation for __prepare__

2016-06-17 Thread Jaysinh shukla

Jaysinh shukla added the comment:

Submitting patch according to this 
(http://bugs.python.org/issue15243#msg268356) message. Thanks!

--
keywords: +patch
nosy: +jaysinh.shukla
Added file: 
http://bugs.python.org/file43432/issue15243_diff_python3.5_3.6_v1.diff

___
Python tracker 

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



[issue23360] Content-Type when sending data with urlopen()

2016-06-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +orsenthil, r.david.murray

___
Python tracker 

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



[issue27336] --without-threads build fails due to undeclared _PyGILState_check_enabled

2016-06-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cbe977fd306f by Victor Stinner in branch 'default':
Issue #27336: Fix compilation on Windows
https://hg.python.org/cpython/rev/cbe977fd306f

--

___
Python tracker 

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



[issue27336] --without-threads build fails due to undeclared _PyGILState_check_enabled

2016-06-17 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report.

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



[issue27343] Incorrect error message for conflicting initializers of ctypes structure

2016-06-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: 
http://bugs.python.org/file43431/ctypes_conflictin_initializers_error_message.patch

___
Python tracker 

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



[issue27336] --without-threads build fails due to undeclared _PyGILState_check_enabled

2016-06-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2baaf7e31b13 by Berker Peksag in branch 'default':
Issue #27336: Fix compilation failures --without-threads
https://hg.python.org/cpython/rev/2baaf7e31b13

--
nosy: +python-dev

___
Python tracker 

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



[issue27343] Incorrect error message for conflicting initializers of ctypes structure

2016-06-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Removed file: 
http://bugs.python.org/file43430/ctypes_conflictin_initializers_error_message.patch

___
Python tracker 

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



[issue27307] string.Formatter does not support key/attribute access on unnumbered fields

2016-06-17 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +eric.smith
stage:  -> patch review
versions:  -Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue12319] [http.client] HTTPConnection.request not support "chunked" Transfer-Encoding to send data

2016-06-17 Thread Martin Panter

Martin Panter added the comment:

FYI instead of changing the helper into a static method, I think you could have 
just called http.client._get_content_length().

I don’t understand why we need the new encode_chunked=True flag. Can’t 
urllib.request leave the Transfer-Encoding field up to http.client? Yes it does 
set Content-Length in the Request object, but it does not set Accept-Encoding 
nor Connection. Also, it looks like you can still get chunked encoding if you 
set encode_chunked=False, which is confusing.

I left some review comments, and I think some of my earlier comments still 
apply. I still find it confusing the variety of objects accepted, and the 
different levels that the APIs work on. Hopefully it will become less confusing 
if we can figure out all the corner cases. I do think unifying the data types 
accepted by urlopen() and HTTPConnection is good, though I am not sure allowing 
text in urlopen() is 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: Method Chaining

2016-06-17 Thread Steven D'Aprano
On Fri, 17 Jun 2016 06:13 pm, Ned Batchelder wrote:

> To me, it's a toss-up.  The chained version is nice in that it removes the
> repetition of "g".  But the unchained version is more explicit, and avoids
> the awkward parenthesis.
> 
> I think I would lean toward the unchained version.  Clearly tastes can
> differ.

Indeed. For what it's worth, I'm ever-so-slightly leaning towards Lawrence's
taste here. What Michael Selik earlier described as advantages of the
explicit version:

g.move_to((p1 + p2a) / 2)
g.line_to(p1 + (p2 - p1) * frac)
g.line_to((p1 + p1a) / 2)
g.stroke()


namely, "no extra indentation, and no extraneous parentheses", is to me a
negative, not a positive. Since all these commands belong together in some
sense, I like the chained version:

(g.move_to((p1 + p2a) / 2)
  .line_to(p1 + (p2 - p1) * frac)
  .line_to((p1 + p1a) / 2)
  .stroke()
  )


as the parens and indentation more clearly mark this chunk of code as a
unit. On the other hand, I like the fact that methods which are
conceptually procedures that operate by side-effect return None. So it's
hard to decide precisely which behaviour is better. Its very much a matter
of taste.



-- 
Steven

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


[issue27343] Incorrect error message for conflicting initializers of ctypes structure

2016-06-17 Thread Berker Peksag

Changes by Berker Peksag :


--
stage: patch review -> commit review

___
Python tracker 

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



[issue27273] subprocess.run(cmd, input='text') should pass universal_newlines=True to Popen

2016-06-17 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +gregory.p.smith
stage:  -> patch review

___
Python tracker 

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



Re: Method Chaining

2016-06-17 Thread Lawrence D’Oliveiro
On Friday, June 17, 2016 at 8:13:50 PM UTC+12, Ned Batchelder wrote:
> But the unchained version is more explicit, and avoids
> the awkward parenthesis.

What if it had been

the_context.move_to((p1 + p2a) / 2)
the_context.line_to(p1 + (p2 - p1) * frac)
the_context.line_to((p1 + p1a) / 2)
the_context.stroke()
the_context.move_to((p2 + p2a) / 2)
the_context.line_to(p2 + (p1 - p2) * frac)
the_context.line_to((p2 + p1a) / 2)
the_context.stroke()

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


[issue18751] A manager's server never joins its threads

2016-06-17 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +davin

___
Python tracker 

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



Re: Method Chaining

2016-06-17 Thread Jussi Piitulainen
Lawrence D’Oliveiro writes:

> On Friday, June 17, 2016 at 8:13:50 PM UTC+12, Ned Batchelder wrote:
>> But the unchained version is more explicit, and avoids
>> the awkward parenthesis.
>
> What if it had been
>
> the_context.move_to((p1 + p2a) / 2)
> the_context.line_to(p1 + (p2 - p1) * frac)
> the_context.line_to((p1 + p1a) / 2)
> the_context.stroke()
> the_context.move_to((p2 + p2a) / 2)
> the_context.line_to(p2 + (p1 - p2) * frac)
> the_context.line_to((p2 + p1a) / 2)
> the_context.stroke()
>
> ?

g = the_context
g.move_to((p1 + p2a) / 2)
g.line_to(p1 + (p2 - p1) * frac)
g.line_to((p1 + p1a) / 2)
g.stroke()
g.move_to((p2 + p2a) / 2)
g.line_to(p2 + (p1 - p2) * frac)
g.line_to((p2 + p1a) / 2)
g.stroke()
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >