Re: How does a dictionary work exactly?

2015-07-17 Thread Ned Batchelder
On Thursday, July 16, 2015 at 2:59:02 PM UTC-4, Skip Montanaro wrote:
 On Thu, Jul 16, 2015 at 1:36 PM, yoursurrogate...@gmail.com
 yoursurrogate...@gmail.com wrote:
  If I understand correctly, lookup would not be a constant, yes?
 
 On the contrary, that's what you desire, nearly constant time
 execution. To the greatest extent possible, you want the linked lists
 to be of length zero or one. Part of the magic is in figuring out good
 places to expand the size of the hash array. You don't want it to grow
 too big, but you still want most linked lists to be very short. The
 resize operation isn't done too often because it itself is expensive.
 I believe Python dicts start out with an overly large initial hash
 array (again, dredging up old memories of threads on python-dev) as an
 optimization to avoid lots of early resize operations.
 
 Skip

Maybe people are reading a different implementation than I am.  Python's
dict object doesn't use linked lists to deal with hash collisions, it probes
other slots instead.

Brandon Rhodes did a great talk about how dicts work:
http://pyvideo.org/video/276/the-mighty-dictionary-55

BTW: The Python 3 implementation is more complicated than in Python 2, I
think to deal with sharing keys among dictionaries that have the same set
of keys.

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


[issue24654] PEP 492 - example benchmark doesn't work (TypeError)

2015-07-17 Thread Marcin Szewczyk

New submission from Marcin Szewczyk:

Using benchmark from the section 
https://www.python.org/dev/peps/pep-0492/#async-await raises:
Traceback (most recent call last):
  File ./bench.py, line 28, in module
timeit(abinary, 19, 30)
  File ./bench.py, line 23, in timeit
list(gen(depth))
TypeError: 'coroutine' object is not iterable

Am I missing something or is a correction needed in code or documentation?

BTW, PEP 492 uses the term plain generator, but unlike generator-based 
coroutine or native coroutine it's not defined in section 
https://www.python.org/dev/peps/pep-0492/#glossary. I think adding a definition 
would be beneficial.

--
assignee: docs@python
components: Documentation, asyncio
messages: 246856
nosy: docs@python, gvanrossum, haypo, wodny, yselivanov
priority: normal
severity: normal
status: open
title: PEP 492 - example benchmark doesn't work (TypeError)
type: enhancement
versions: Python 3.5

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



Re: ANN: eGenix PyRun - One file Python Runtime 2.1.0

2015-07-17 Thread M.-A. Lemburg
Hi Alex,

On 17.07.2015 00:58, Alex wrote:
 Do you have Python 2.7 64bit versions available for Solaris (10/11)
 x86/SPARC, AIX, and HP-UX IA/RISC? I've had the displeasure of having to
 install 64bit Python on Solaris and AIX and it's an experience I would not
 recommend even though OpenCSW and Perzl have done much of the legwork
 already. I'd also just be happy with any pointers to building PyRun or
 regular Python on such systems if such currently there exist no such builds.

We don't currently have direct access to these types of systems, so
cannot provide regular builds for these platforms.

For AIX and Solaris x86 we do provide custom paid support to get
our software ported, if you're interested in this.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jul 17 2015)
 Python Projects, Coaching and Consulting ...  http://www.egenix.com/
 mxODBC Plone/Zope Database Adapter ...   http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2015-07-20: EuroPython 2015, Bilbao, Spain ...  3 days to go
2015-07-29: Python Meeting Duesseldorf ... 12 days to go

: Try our mxODBC.Connect Python Database Interface for free ! ::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/


 On Wed, May 13, 2015 at 10:34 AM, Cristiano Cortezia 
 cristiano.corte...@gmail.com wrote:
 
 In one of the next releases we'll probably add a tool to bundle
 complete applications together with pyrun, perhaps even by
 recompiling it to include the application byte code files
 right in the binary like we do for the stdlib.


 Well, that would be simply awesome. Looking forward to it.

 PS: you guys should definitely advertise this work on the embedded
 software community.


 2015-05-13 11:29 GMT-03:00 M.-A. Lemburg m...@egenix.com:

 On 13.05.2015 16:09, Cristiano Cortezia wrote:
 Well I gave it a try, and it seems my assumptions were *somehow* true.
 Here is what I got when running one of my apps in single shot mode
 (load,
 run, terminate):

 *default python distribution*
 total time 9.022s
 ENOENT's count 7377

 *pyrun*
 total time 8.455s
 ENOENT's count 3064

 So, it indeed failed much less to open files, but I guess this didn't
 make
 that much difference after all (500ms).

 PyRun has the advantage of being able to read the byte code
 directly from the binary (using memory mapping). However,
 it still needs to run the same startup machinery as Python
 itself.

 Note that startup time for Python was a lot worse before
 Python used the same approach as PyRun to compile in the
 parsed sysconfig data.

 Perhaps it is because this app has some external dependencies (22 to be
 precise) not bundled on pyrun that had to be scanned by the interpreter
 anyway. If by any means we could bundle them all the same way, than it
 could bring a much higher performance gain. But I guess it is not really
 safe-feasible.

 It's certainly possible to use the pyrun build system to create
 bundles with more packages and tools included.

 The one we're shipping has most of the stdlib included,
 but leaves all the application code to reside on the
 sys.path or in a ZIP archive.

 In one of the next releases we'll probably add a tool to bundle
 complete applications together with pyrun, perhaps even by
 recompiling it to include the application byte code files
 right in the binary like we do for the stdlib.

 --
 Marc-Andre Lemburg
 eGenix.com

 Professional Python Services directly from the Source  (#1, May 13 2015)
 Python Projects, Coaching and Consulting ...  http://www.egenix.com/
 mxODBC Plone/Zope Database Adapter ...   http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/
 
 2015-05-13: Released mxODBC Connect 2.1.3 ... http://egenix.com/go75
 2015-05-11 http://egenix.com/go752015-05-11: Released eGenix PyRun
 2.1.0 ...   http://egenix.com/go74
 2015-05-25 http://egenix.com/go742015-05-25: PyWaw Summit 2015,
 Warsaw, Poland ...  12 days to go

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/



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


 

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


Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-17 Thread Chris Angelico
On Fri, Jul 17, 2015 at 9:43 PM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
 On 07/17/2015 01:05 PM, Chris Angelico wrote:
 On Fri, Jul 17, 2015 at 8:48 PM, Antoon Pardon
 antoon.par...@rece.vub.ac.be wrote:
 Just wondering, are traceback records of generators available? They are
 if an exception is raised in the generator itself, but what if an exception
 is raised in the loop that is driven by a generator. They don't appear in
 the standard stack trace.
 Not sure what you mean here. Something like this?

 def gen():
 yield stuff
 yield more stuff

 for stuff in gen():
 bomb with exception

 The error didn't happen in the generator, so I wouldn't expect to see
 it in the traceback.

 Yes something like that. And I wouldn't expect it either but if it
 is not present, is it because nobody thought about it or because it
 is a bad idea or an idea difficult to implement?

 There's still room for the cause of an error to
 not be in the traceback; imagine, for instance, a function that
 populates a concrete list, and then you iterate over the list. If that
 function sticks a None into the list and the subsequent processing is
 expecting all strings, that's going to bomb, but then you have to
 figure out where the None came from. If the traceback could include
 that, it'd be great, but some things aren't possible.

 Sure, but in this case, the generator is still active. The Runtime
 would be able to jump to and somehow activates it's stack record
 for the next value. So why would we expect it to be impossible to
 include this trace back record in a stack trace?

Python could also give you stack traces for any other threads that are
concurrently running, on the off-chance that one of them affected it.
But the only influence the generator has on the loop is to yield a
value or signal termination; if an exception is thrown in the loop
itself, the local name 'stuff' should have all the information about
that cause. Python isn't a mind-reader, no matter how much it may look
like one, and it can't know that this function's return value should
be shown as part of a completely different function's stack trace.

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


Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-17 Thread Antoon Pardon
On 07/17/2015 01:05 PM, Chris Angelico wrote:
 On Fri, Jul 17, 2015 at 8:48 PM, Antoon Pardon
 antoon.par...@rece.vub.ac.be wrote:
 Just wondering, are traceback records of generators available? They are
 if an exception is raised in the generator itself, but what if an exception
 is raised in the loop that is driven by a generator. They don't appear in
 the standard stack trace.
 Not sure what you mean here. Something like this?

 def gen():
 yield stuff
 yield more stuff

 for stuff in gen():
 bomb with exception

 The error didn't happen in the generator, so I wouldn't expect to see
 it in the traceback.

Yes something like that. And I wouldn't expect it either but if it
is not present, is it because nobody thought about it or because it
is a bad idea or an idea difficult to implement?

 There's still room for the cause of an error to
 not be in the traceback; imagine, for instance, a function that
 populates a concrete list, and then you iterate over the list. If that
 function sticks a None into the list and the subsequent processing is
 expecting all strings, that's going to bomb, but then you have to
 figure out where the None came from. If the traceback could include
 that, it'd be great, but some things aren't possible.

Sure, but in this case, the generator is still active. The Runtime
would be able to jump to and somehow activates it's stack record
for the next value. So why would we expect it to be impossible to
include this trace back record in a stack trace?

  Doesn't mean
 we're happy to sacrifice other functionality.

Indeed, this is an independend problem. Whatever the answer here doesn't
need to affect how one feels about losing trace back record because of
TCO.


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


Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-17 Thread Antoon Pardon
On 07/17/2015 01:49 PM, Chris Angelico wrote:
 On Fri, Jul 17, 2015 at 9:43 PM, Antoon Pardon
 antoon.par...@rece.vub.ac.be wrote:


 Sure, but in this case, the generator is still active. The Runtime
 would be able to jump to and somehow activates it's stack record
 for the next value. So why would we expect it to be impossible to
 include this trace back record in a stack trace?
 Python could also give you stack traces for any other threads that are
 concurrently running, on the off-chance that one of them affected it.
 But the only influence the generator has on the loop is to yield a
 value or signal termination; if an exception is thrown in the loop
 itself, the local name 'stuff' should have all the information about
 that cause.

But the local name 'stuff' may only have the information for the immediate
cause. The underlying cause may be available in the generator. Suppose
you have a generator that should only generate positive numbers that you
use to divide some other number by. Your loop crashes because of a 
DivideByZeroError
Sure the local name shows the dividor to be zero, but you have no
information on why your generator produced a zero, but there may be a
clue in the trace back record of the generator.

  Python isn't a mind-reader, no matter how much it may look
 like one, and it can't know that this function's return value should
 be shown as part of a completely different function's stack trace.

It is not a matter of mindreading. And it is not a completely different
functions stack trace. It is the trace back record of a generator that
is used by the process/thread that crashed. And AFAIK an active generator
belongs to one specific thread. You can't have it yield a value to a different
thread and you can't send it a value from an other thread. So I really
see no reason to exclude the trace back records of active generators
from a stack trace of a crashed thread.

-- 
Antoon Pardon

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


Re: ANN: eGenix PyRun - One file Python Runtime 2.1.0

2015-07-17 Thread Alex
They don't offer any free versions for those systems and their licenses are
quite expensive.

On Fri, Jul 17, 2015 at 2:26 AM, Laura Creighton l...@openend.se wrote:

 I think Activestate makes a Python 2.y for Solaris.
 http://www.activestate.com/activepython

 I've never used it.

 Laura

 In a message of Thu, 16 Jul 2015 18:58:37 -0400, Alex writes:
 Do you have Python 2.7 64bit versions available for Solaris (10/11)
 x86/SPARC, AIX, and HP-UX IA/RISC? I've had the displeasure of having to
 install 64bit Python on Solaris and AIX and it's an experience I would not
 recommend even though OpenCSW and Perzl have done much of the legwork
 already. I'd also just be happy with any pointers to building PyRun or
 regular Python on such systems if such currently there exist no such
 builds.
 
 On Wed, May 13, 2015 at 10:34 AM, Cristiano Cortezia 
 cristiano.corte...@gmail.com wrote:
 
  In one of the next releases we'll probably add a tool to bundle
  complete applications together with pyrun, perhaps even by
  recompiling it to include the application byte code files
  right in the binary like we do for the stdlib.
 
 
  Well, that would be simply awesome. Looking forward to it.
 
  PS: you guys should definitely advertise this work on the embedded
  software community.
 
 
  2015-05-13 11:29 GMT-03:00 M.-A. Lemburg m...@egenix.com:
 
  On 13.05.2015 16:09, Cristiano Cortezia wrote:
   Well I gave it a try, and it seems my assumptions were *somehow*
 true.
   Here is what I got when running one of my apps in single shot mode
  (load,
   run, terminate):
  
   *default python distribution*
   total time 9.022s
   ENOENT's count 7377
  
   *pyrun*
   total time 8.455s
   ENOENT's count 3064
  
   So, it indeed failed much less to open files, but I guess this didn't
  make
   that much difference after all (500ms).
 
  PyRun has the advantage of being able to read the byte code
  directly from the binary (using memory mapping). However,
  it still needs to run the same startup machinery as Python
  itself.
 
  Note that startup time for Python was a lot worse before
  Python used the same approach as PyRun to compile in the
  parsed sysconfig data.
 
   Perhaps it is because this app has some external dependencies (22 to
 be
   precise) not bundled on pyrun that had to be scanned by the
 interpreter
   anyway. If by any means we could bundle them all the same way, than
 it
   could bring a much higher performance gain. But I guess it is not
 really
   safe-feasible.
 
  It's certainly possible to use the pyrun build system to create
  bundles with more packages and tools included.
 
  The one we're shipping has most of the stdlib included,
  but leaves all the application code to reside on the
  sys.path or in a ZIP archive.
 
  In one of the next releases we'll probably add a tool to bundle
  complete applications together with pyrun, perhaps even by
  recompiling it to include the application byte code files
  right in the binary like we do for the stdlib.
 
  --
  Marc-Andre Lemburg
  eGenix.com
 
  Professional Python Services directly from the Source  (#1, May 13
 2015)
   Python Projects, Coaching and Consulting ...
 http://www.egenix.com/
   mxODBC Plone/Zope Database Adapter ...
 http://zope.egenix.com/
   mxODBC, mxDateTime, mxTextTools ...
 http://python.egenix.com/
 
 
  2015-05-13: Released mxODBC Connect 2.1.3 ...
 http://egenix.com/go75
  2015-05-11 http://egenix.com/go752015-05-11: Released eGenix PyRun
  2.1.0 ...   http://egenix.com/go74
  2015-05-25 http://egenix.com/go742015-05-25: PyWaw Summit 2015,
  Warsaw, Poland ...  12 days to go
 
 eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
  D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
 Registered at Amtsgericht Duesseldorf: HRB 46611
 http://www.egenix.com/company/contact/
 
 
 
  --
  https://mail.python.org/mailman/listinfo/python-list
 
 
 
 --
 https://mail.python.org/mailman/listinfo/python-list
 

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


[issue24644] --help for runnable stdlib modules

2015-07-17 Thread Ezio Melotti

Ezio Melotti added the comment:

 writing tests for the CLI are a pain too

It shouldn't be particularly difficult to do it using 
script_helper.assert_python_{ok|failure}(), even though you could also check 
the argument /parsing/ separately without having to launch a subprocess.

--
nosy: +ezio.melotti

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



[issue24635] test_typing is flaky

2015-07-17 Thread Guido van Rossum

Guido van Rossum added the comment:

You can list me as the expert for typing.py, since I wrote it. :-)  (However, 
until mid August I have limited availability since I'm on vacation.)

This looks indeed like a test order dependency.  The three failures are all 
basic failures where an empty set, dict or list is expected to be an instance 
of the corresponding ABC (AbstractSet, Mapping, Sequence) defined in typing.py. 
Those ABCs in turn derive (in a slightly sneaky way) from the corresponding 
ABCs in collections.abc.

My hunch is that some other test messes with the ABC registration cache and 
doesn't restore it -- or typing.py's sneaky way of deriving from 
collections.abc has a subtle bug in it.  Maybe something is calling 
reload(collections.abc)?

I haven't done any research to confirm or deny this theory.  It shouldn't be 
too hard to find the (probably only a handful of) tests that mess with the 
registration cache.

--
nosy: +gvanrossum

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



[issue24644] --help for runnable stdlib modules

2015-07-17 Thread R. David Murray

R. David Murray added the comment:

Yes, that's pretty much why things are in the state they are in ;)

Still, opening individual issues for help problems with individual modules is 
the way to go, as you did (thank you).

--

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



[issue23792] help crash leaves terminal in echo off mode

2015-07-17 Thread R. David Murray

R. David Murray added the comment:

Well, not exactly.  While the title was inaccurate, the real problem was the 
management of the subprocess, not what mode the terminal was in.

--

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



Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-17 Thread Chris Angelico
On Fri, Jul 17, 2015 at 10:54 PM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
 On 07/17/2015 01:49 PM, Chris Angelico wrote:
 On Fri, Jul 17, 2015 at 9:43 PM, Antoon Pardon
 antoon.par...@rece.vub.ac.be wrote:


 Sure, but in this case, the generator is still active. The Runtime
 would be able to jump to and somehow activates it's stack record
 for the next value. So why would we expect it to be impossible to
 include this trace back record in a stack trace?
 Python could also give you stack traces for any other threads that are
 concurrently running, on the off-chance that one of them affected it.
 But the only influence the generator has on the loop is to yield a
 value or signal termination; if an exception is thrown in the loop
 itself, the local name 'stuff' should have all the information about
 that cause.

 But the local name 'stuff' may only have the information for the immediate
 cause. The underlying cause may be available in the generator. Suppose
 you have a generator that should only generate positive numbers that you
 use to divide some other number by. Your loop crashes because of a 
 DivideByZeroError
 Sure the local name shows the dividor to be zero, but you have no
 information on why your generator produced a zero, but there may be a
 clue in the trace back record of the generator.

Indeed, but there's nothing special about generators here. The same
sequence could have been a concrete list, or it could have been some
other kind of iterator (any object with __iter__ and __next__), which
won't have a stack frame. Special cases aren't special enough to warp
exception handling around.

  Python isn't a mind-reader, no matter how much it may look
 like one, and it can't know that this function's return value should
 be shown as part of a completely different function's stack trace.

 It is not a matter of mindreading. And it is not a completely different
 functions stack trace. It is the trace back record of a generator that
 is used by the process/thread that crashed. And AFAIK an active generator
 belongs to one specific thread. You can't have it yield a value to a different
 thread and you can't send it a value from an other thread. So I really
 see no reason to exclude the trace back records of active generators
 from a stack trace of a crashed thread.

No, generators are fine across threads:

rosuav@sikorsky:~$ python3 threadgen.py
Starting!
First yielded value
Continuing!
Second yielded value
Terminating.
Traceback (most recent call last):
  File threadgen.py, line 20, in module
print(next(gen))
StopIteration
rosuav@sikorsky:~$ cat threadgen.py
import threading
import time

def thread():
time.sleep(0.5)
print(next(gen))

threading.Thread(target=thread).start()

def generator():rosuav@sikorsky:~$

print(Starting!)
yield First yielded value
print(Continuing!)
yield Second yielded value
print(Terminating.)

gen = generator()
print(next(gen))
time.sleep(1)
print(next(gen))
rosuav@sikorsky:~$

In fact, a generator doesn't have a stack unless it's currently
executing, so all you could get is whatever's actually inside it (that
is, if there's a deep tree of 'yield from's, you could dig up that
part of the stack). I'm not sure this would really help you very much.

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


[issue24621] zipfile.BadZipFile: File is not a zip file

2015-07-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

not_working.zip has 85972 extra null bytes at the end. This doesn't look as 
common ZIP file, and adding support such files can be considered as new feature 
(if it is worth to do at all). How did you get this file Yasar?

--
type: behavior - enhancement
versions: +Python 3.6 -Python 2.7, Python 3.4

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



Re: Fwd: PROBLEM IN importing PIL

2015-07-17 Thread Laura Creighton
In a message of Fri, 17 Jul 2015 09:18:46 +0530, rahul tiwari writes:
I want to import PIL package but every time this is showing error  no PIL
 module find .

plz suggest me  how  i can fix this problem.

Get Pillow.

Instructions on how to install it here:
https://pillow.readthedocs.org/installation.html#basic-installation

Laura

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


Re: ANN: eGenix PyRun - One file Python Runtime 2.1.0

2015-07-17 Thread Laura Creighton
I think Activestate makes a Python 2.y for Solaris.
http://www.activestate.com/activepython

I've never used it.

Laura

In a message of Thu, 16 Jul 2015 18:58:37 -0400, Alex writes:
Do you have Python 2.7 64bit versions available for Solaris (10/11)
x86/SPARC, AIX, and HP-UX IA/RISC? I've had the displeasure of having to
install 64bit Python on Solaris and AIX and it's an experience I would not
recommend even though OpenCSW and Perzl have done much of the legwork
already. I'd also just be happy with any pointers to building PyRun or
regular Python on such systems if such currently there exist no such builds.

On Wed, May 13, 2015 at 10:34 AM, Cristiano Cortezia 
cristiano.corte...@gmail.com wrote:

 In one of the next releases we'll probably add a tool to bundle
 complete applications together with pyrun, perhaps even by
 recompiling it to include the application byte code files
 right in the binary like we do for the stdlib.


 Well, that would be simply awesome. Looking forward to it.

 PS: you guys should definitely advertise this work on the embedded
 software community.


 2015-05-13 11:29 GMT-03:00 M.-A. Lemburg m...@egenix.com:

 On 13.05.2015 16:09, Cristiano Cortezia wrote:
  Well I gave it a try, and it seems my assumptions were *somehow* true.
  Here is what I got when running one of my apps in single shot mode
 (load,
  run, terminate):
 
  *default python distribution*
  total time 9.022s
  ENOENT's count 7377
 
  *pyrun*
  total time 8.455s
  ENOENT's count 3064
 
  So, it indeed failed much less to open files, but I guess this didn't
 make
  that much difference after all (500ms).

 PyRun has the advantage of being able to read the byte code
 directly from the binary (using memory mapping). However,
 it still needs to run the same startup machinery as Python
 itself.

 Note that startup time for Python was a lot worse before
 Python used the same approach as PyRun to compile in the
 parsed sysconfig data.

  Perhaps it is because this app has some external dependencies (22 to be
  precise) not bundled on pyrun that had to be scanned by the interpreter
  anyway. If by any means we could bundle them all the same way, than it
  could bring a much higher performance gain. But I guess it is not really
  safe-feasible.

 It's certainly possible to use the pyrun build system to create
 bundles with more packages and tools included.

 The one we're shipping has most of the stdlib included,
 but leaves all the application code to reside on the
 sys.path or in a ZIP archive.

 In one of the next releases we'll probably add a tool to bundle
 complete applications together with pyrun, perhaps even by
 recompiling it to include the application byte code files
 right in the binary like we do for the stdlib.

 --
 Marc-Andre Lemburg
 eGenix.com

 Professional Python Services directly from the Source  (#1, May 13 2015)
  Python Projects, Coaching and Consulting ...  http://www.egenix.com/
  mxODBC Plone/Zope Database Adapter ...   http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/
 
 2015-05-13: Released mxODBC Connect 2.1.3 ... http://egenix.com/go75
 2015-05-11 http://egenix.com/go752015-05-11: Released eGenix PyRun
 2.1.0 ...   http://egenix.com/go74
 2015-05-25 http://egenix.com/go742015-05-25: PyWaw Summit 2015,
 Warsaw, Poland ...  12 days to go

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/



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



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

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


Re: Noob in Python. Problem with fairly simple test case

2015-07-17 Thread Steven D'Aprano
On Fri, 17 Jul 2015 01:01 pm, Chris Angelico wrote:

 On Fri, Jul 17, 2015 at 12:44 PM, Steven D'Aprano st...@pearwood.info
 wrote:
 My take from all this is that overall, Python 3 take-up is probably
 around 10% of all Python users...
 
 Really? That low? Wow. 

Well, that's based on a guess that for every Python programmer you see
talking on the Internet, on Stackoverflow, Usenet, etc. there are probably
ten or so who are invisible to us. They work a nominally 9 to 5 government
or corporate job programming in Python, are forbidden to install packages
which aren't approved by IT, and don't even have access to Stackoverflow
let alone have time to chew the fat here. Those folks, I expect, are almost
all using Python 2.6 or 2.7, with a small minority on even older versions.

Some small percentage of them will still be using Python 2 in 20 years time,
just as there are a small minority of people still using Python 1.5 today.


 Jessie's default should be 2.7, at least. Wheezy shipped 2.7, too;
 it's only Squeeze (now out of support) that didn't ship any 2.7.x
 Python. Are you sure you can't at least upgrade to 2.7?

I'm not sure, I'm not actively involved in that specific project. All I know
is that the guys are always complaining about Jessie, and that they're
using 2.6.



-- 
Steven

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


[issue24652] C-API Pure Embedding enhancement

2015-07-17 Thread Justin Huang

New submission from Justin Huang:

From the example in here:

https://docs.python.org/2/extending/embedding.html#pure-embedding

when directly using the example (compiling and trying with external file etc.) 
it doesn't work right away. Instead an extra line:

PySys_SetArgv(argc, argv);

must be added to get it to work.

--
messages: 246847
nosy: Justin Huang
priority: normal
severity: normal
status: open
title: C-API Pure Embedding enhancement
type: enhancement
versions: Python 2.7

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



[issue21750] mock_open data is visible only once for the life of the class

2015-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 41d55ac50dea by Robert Collins in branch '3.4':
Issue #21750: mock_open.read_data can now be read from each instance, as it
https://hg.python.org/cpython/rev/41d55ac50dea

New changeset 0da764c58322 by Robert Collins in branch '3.5':
Issue #21750: mock_open.read_data can now be read from each instance, as it
https://hg.python.org/cpython/rev/0da764c58322

New changeset 92a90e469424 by Robert Collins in branch 'default':
Issue #21750: mock_open.read_data can now be read from each instance, as it
https://hg.python.org/cpython/rev/92a90e469424

--
nosy: +python-dev

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



Re: A new module for performing tail-call elimination

2015-07-17 Thread Antoon Pardon
On 07/16/2015 08:58 PM, Steven D'Aprano wrote:
 Nice of you to illustrate how being pedantic about something, can
 make a response useless with regard to the intended original question.
 Just because your intention in giving that code was X, doesn't mean that
 others cannot use that code to also do Y.

 Your example of a mutually recursive pair of functions is perfectly fine as
 a toy example to demonstrate a point. But the fact that people can only
 come up with toy examples to demonstrate the uses of unbounded recursion is
 telling. That's *my* point. It's orthogonal to your point.

We know your point. You have repeated it often enough. There is no need
to keep bringing it up and certainly not where your point is irrelevant.

People are allowed to not care about your point. People may think it is
not worth the trouble trying to convince people who are skeptical and
may choose to discuss possible directions with people who are likewise 
intressed.

So why do you find it necessary to appear here and repeat your point,
that is already known, but is not cared about much and irrelevant here.


 I'm not here to satisfy your or anyone else's curiosity. 
 Fair enough.

 What are you here for? When you complain that Python doesn't have TCO, is
 your intent to persuade people that it should, with the ultimate aim to
 changing Python so that it gains TCO? If not, then what?

I don't complain that Python doesn't have TCO. I am intressed in the subject
and I'm willing to discuss the pro and cons, how it could be simulated, and
how good some arguments for or against it are. But I don't think any outcome
here will have much weight in getting it implemented and although I would
prefer having it, I can perfectly live without. So don't translate my
interest in the subject into a complaint about python not having it.

I'm also not interrested in convincing people who show a dislike for it.
If the toy examples here, don't ignite a spark of imagination about how
in some circumstance this could be useful for you, then I am not interessed
in showing you.

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


Re: Noob in Python. Problem with fairly simple test case

2015-07-17 Thread Steven D'Aprano
On Fri, 17 Jul 2015 02:15 pm, Rick Johnson wrote:

 On Thursday, July 16, 2015 at 9:44:56 PM UTC-5, Steven D'Aprano wrote:
 [...] My take from all this is that overall, Python 3
 take-up is probably  around 10% of all Python users,
 
 All that rambling just to agree with me? My educated guess
 is a minimum of 75% still using Python2.x. But i'll take
 your 90% because it makes my argument stronger! O:-D

75% or 90% is not a vast majority. Vast majority implies more than 99%.

But regardless of the precise meaning of vast, if you want to dismiss one
in four people (25%) or one in ten (10%) as inconsequential, then you've
got some serious issues.


[...]
 Well i'm not actively hostile to py3 by any means, i just
 can't risk the upgrade at this time.

You can't risk the upgrade?

What precisely are you afraid of?


 The take-up rate of Python 3 is about where we would
 expect after less than seven years:
 
 Well, that's one way of coping with it. I know a lot of
 folks worked hard to get Python3 up and running, but they
 need to realize that these sort of transitions take time.

Rick, you're being patronising.

Before even a single line of code was written for Python 3, Guido and the
core developers knew that there would be a long migration path from 2 to 3.
Hence the parallel versions, and the long transition plan:

* Python 2.6 and Python 3.0 came out more or less together, and 2.6 was
explicitly designed as a transitional version with a number of Python 3
features available via __future___ imports;

* Python 2.7 has an extended maintenance period; instead of the usual 2-3
years, 2.7 will be maintained for 10 years (until 2020);

* there will also be at least three more years of commercial third-party
maintenance available from companies like Red Hat.

The core developers don't need to be told that these sort of transitions
take time. They predicted almost from the beginning that it would take 10
years for the transition. They didn't commit to a long period of parallel
versions because they *like* having twice as much work to do.


 Heck, there is always the possibility that Python3 never
 gets any real traction. Until it's usage reaches 50%, it's
 only spinning tires in the mud, digging a deeper hole.

That's nonsense. Spinning tires implies no forward motion. Python 3 usage is
*certainly* moving forward: we've gone from the situation in 2008 of nobody
using it, to the current situation where there's lots of activity around
it: students learning on Python 3, books about it, the avant-garde and
early adopters have already moved to Python 3, and the majority of
libraries also support Python 3.

The chances of that forward motion coming to a stop are very slim. The work
being done on async and concurrency for Python 3.5 is getting lots of
people excited, and Red Hat and Debian have committed to migrating to
Python 3. Where they go, Centos, Fedora, Mint and (probably) Ubuntu are
sure to follow, and quite quickly too.

My guess is, the rate of Python 3 adoption is going to hit the tipping point
in 2 or 3 years, after which time it will be *very* rapid.


 Not to mention the elephant in the room: We have been moving
 towards mobile and cloud ubiquity, and this trend is not
 going to stop. If Python wants to survive it had better
 start adapting, and adapting fast. If not, it shall become
 just another forgotten language relegated to obscurity
 within the dark corners of academia.

Yeah, right. Like academic computer scientists use Python.

Whatever way you look at it, Python is one of the top 10 programming
languages. It's at no risk of becoming forgotten any time soon.

http://import-that.dreamwidth.org/1388.html




-- 
Steven

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


[issue24650] Error in yield expression documentation

2015-07-17 Thread swanson

New submission from swanson:

https://docs.python.org/3/reference/expressions.html

in
6.2.9. Yield expressions

end of 1st paragraph:

Using a yield expression in a function’s body causes that function to be a 
generator.

NO!

As the very next sentence explains, a generator is what's returned by such a 
function, not the function itself.

Basically, it should be sufficient to add the word function to the end of 
that sentence: ... generator function.  However, this error does NOT exist in 
3.0 to 3.2 - just in 3.3 to 3.6, so I suggest just using the same wording as 
3.0 to 3.2:

Using a yield expression in a function definition is sufficient to cause that 
definition to create a generator function instead of a normal function.

--
assignee: docs@python
components: Documentation
messages: 246841
nosy: docs@python, swanson
priority: normal
severity: normal
status: open
title: Error in yield expression documentation
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6

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



[issue21750] mock_open data is visible only once for the life of the class

2015-07-17 Thread Berker Peksag

Berker Peksag added the comment:

 There are already explicit tests for that

Great, then the test is fine :) Thanks for writing the patch.

--

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



[issue21750] mock_open data is visible only once for the life of the class

2015-07-17 Thread Robert Collins

Robert Collins added the comment:

Ok, so - good to commit to 3.4 and up?

--

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



[issue24651] Mock.assert* API is in user namespace

2015-07-17 Thread Robert Collins

New submission from Robert Collins:

We had a discussion on the list sparked by the assret checking, and in it I 
proposed that the API would be cleaner if the asserts were module functions.

e.g. rather than::

 a_mock.assert_called_with(Foo)


 assert_called_with(a_mock, Foo)

Michael has objected to this saying that the current structure is part of 
mock's success - but I'm filing this since a number of other core devs seemed 
to really like the idea. We can discuss here and if the consensus is that it 
wouldn't be an improvement - thats fine. OTOH if the consensus is that it is an 
improvement, this can serve as a memo to someone to implement the new API.

--
components: Library (Lib)
messages: 246846
nosy: rbcollins
priority: normal
severity: normal
status: open
title: Mock.assert* API is in user namespace
type: enhancement
versions: Python 3.6

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



[issue24651] Mock.assert* API is in user namespace

2015-07-17 Thread Robert Collins

Changes by Robert Collins robe...@robertcollins.net:


--
nosy: +berker.peksag, kushal.das, michael.foord

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



[issue23792] help crash leaves terminal in echo off mode

2015-07-17 Thread swanson

swanson added the comment:

Changing the title in case anyone else is looking for this bug.

This is not raw mode.  It's just that echo is turned off.

It is sufficient to type (invisibly, of course):
stty echo
to resume normal use of the terminal.

--
nosy: +swanson
title: help crash leaves terminal in raw mode - help crash leaves terminal in 
echo off mode

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



Re: A new module for performing tail-call elimination

2015-07-17 Thread Robin Becker

On 16/07/2015 17:17, Ian Kelly wrote:

On Thu, Jul 16, 2015 at 3:28 AM, Robin Becker ro...@reportlab.com wrote:

.



I believe the classic answer is Ackermann's function

http://demonstrations.wolfram.com/RecursionInTheAckermannFunction/

which is said to be not primitive recursive ie cannot be unwound into
loops; not sure whether that implies it has to be recursively defined or can
perhaps be broken down some other way.



that should have said simple loops



My recollection -- and it's been awhile since I've studied
computability theory so I may be distorting things here -- is that
primitive recursive functions can be computed using for loops, i.e.
loops where the number of iterations is bounded in advance, whereas
non-primitive recursive functions require while loops.

I'm guessing, but is the implication that for loops can be specified finitely in 
advance, but while loops need some processing in the calculation to determine 
termination? I'm an engineer :(

--
Robin Becker

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


Re: A new module for performing tail-call elimination

2015-07-17 Thread Antoon Pardon
On 07/16/2015 09:34 PM, Terry Reedy wrote:
 On 7/16/2015 3:45 AM, Antoon Pardon wrote:
 On 07/15/2015 11:19 PM, Terry Reedy wrote:

 I believe that this pattern should work with any set of mutually
 recursive functions that always call each other in cyclic order.  A
 more elaborate version does not have this limitation.


 Nice of you to illustrate the warping involved.  ;-)

 Glad you appreciate it. To me, the warping is no more than, and
 perhaps less than, and certainly less obnoxious than,the warping
 required when using Baruchel's tco module.  (Opinions can vary,
 of course.)  The result will definitely run faster than with B's tco.

I don't care about the speed that much. Clarity of code is more important.
And I agree how Baruchel's tco module needs to be used, doesn't seem
very helpful in that respect. I wouldn't call it obnoxious, cause I
can appreciate the mathematical elegance behind it, but my impression is
that understanding what is going on, requires a back ground knowledge
that is generally not expected. So using this would probably be good for
job security but wouldn't be fair to my colleagues.

-- 
Antoon Pardon

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


[issue21750] mock_open data is visible only once for the life of the class

2015-07-17 Thread Robert Collins

Robert Collins added the comment:

There are already explicit tests for that, do you want another one?

--

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



Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Antoon Pardon
On 07/17/2015 01:46 AM, Chris Angelico wrote:
 Open for bikeshedding: What should the keyword be? We can't use
 exec, which would match Unix and shell usage, because it's already
 used in a rather different sense in Python. Current candidates:
 transfer, goto, recurse, and anything else you suggest.

I propose the combination return from. I think it is similar enough
with yield from to justify this and it also won't need an extra
keyword, so no programs will be broken because they used transfer,
goto or whatever other new keyword as an identifier.

Should there be someone who is willing to spend time on this, I wish
him all luck and strength he can find. I think it would be best if
it was done by someone who is interrested in using this in his own
programs. Because it is all very fine talking about the pro and
cons here and I certainly would use it, the question is, how wide
spread would the use become and is it worth the time and effort to
introduce it. If future use turns out to be disappointing such a
coder can at least think of it as something that was useful for
himself.

-- 
Antoon.


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


[issue24646] Python accepts SSL certificate that should be rejected on OSX

2015-07-17 Thread Ronald Oussoren

Ronald Oussoren added the comment:

The fork of OpenSSL that Apple ships also looks at the CA list in the Keychain. 
IIRC that cannot be disabled. 

BTW. Annoyingly this fork uses a private API to access the keychain, which 
means we couldn't optionally use this behavior when not using Apple's binaries. 

--
On the road, hence brief. 

Op 17 jul. 2015 om 17:55 heeft Antoine Pitrou rep...@bugs.python.org het 
volgende geschreven:

 
 Antoine Pitrou added the comment:
 
 Do we know exactly why OS X's OpenSSL accepts it?
 
 --
 nosy: +ned.deily, pitrou, ronaldoussoren
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue24646
 ___

--

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



[issue24621] zipfile.BadZipFile: File is not a zip file

2015-07-17 Thread Alexei Romanov

Alexei Romanov added the comment:

7z archiver could extract this ZIP archive without any problems:
~/tmp $ 7z x not_working.zip 

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.utf8,Utf16=on,HugeFiles=on,4 CPUs)

Processing archive: not_working.zip

Extracting  CoordinateData.AmplitudesDataType
Extracting  CoordinateData.Amplitudes
Extracting  CoordinateData.VolumesDataType
Extracting  CoordinateData.Volumes

Everything is Ok

Files: 4
Size:   103746
Compressed: 176384

--
nosy: +alexei.romanov

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



[issue24646] Python accepts SSL certificate that should be rejected on OSX

2015-07-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Do we know exactly why OS X's OpenSSL accepts it?

--
nosy: +ned.deily, pitrou, ronaldoussoren

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



Re: How does a dictionary work exactly?

2015-07-17 Thread Skip Montanaro
On Fri, Jul 17, 2015 at 9:32 AM, Ned Batchelder n...@nedbatchelder.com wrote:
 Maybe people are reading a different implementation than I am.  Python's
 dict object doesn't use linked lists to deal with hash collisions, it probes
 other slots instead.

No, I was working a) from memory, and b) not looking at the
implementation, which I last did a long, long time ago...

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


Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Chris Angelico
On Fri, Jul 17, 2015 at 5:17 PM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
 On 07/17/2015 01:46 AM, Chris Angelico wrote:
 Open for bikeshedding: What should the keyword be? We can't use
 exec, which would match Unix and shell usage, because it's already
 used in a rather different sense in Python. Current candidates:
 transfer, goto, recurse, and anything else you suggest.

 I propose the combination return from. I think it is similar enough
 with yield from to justify this and it also won't need an extra
 keyword, so no programs will be broken because they used transfer,
 goto or whatever other new keyword as an identifier.


Oooh I like this. The parallel makes sense, and as you say, no new
keyword. Yes, return from is my new preferred command!

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


Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-17 Thread Chris Angelico
On Fri, Jul 17, 2015 at 8:48 PM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
 Just wondering, are traceback records of generators available? They are
 if an exception is raised in the generator itself, but what if an exception
 is raised in the loop that is driven by a generator. They don't appear in
 the standard stack trace.

Not sure what you mean here. Something like this?

def gen():
yield stuff
yield more stuff

for stuff in gen():
bomb with exception

The error didn't happen in the generator, so I wouldn't expect to see
it in the traceback. There's still room for the cause of an error to
not be in the traceback; imagine, for instance, a function that
populates a concrete list, and then you iterate over the list. If that
function sticks a None into the list and the subsequent processing is
expecting all strings, that's going to bomb, but then you have to
figure out where the None came from. If the traceback could include
that, it'd be great, but some things aren't possible. Doesn't mean
we're happy to sacrifice other functionality.

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


Re: Noob in Python. Problem with fairly simple test case

2015-07-17 Thread Jean-Michel Pichavant
- Original Message -
 From: Steven D'Aprano st...@pearwood.info
 75% or 90% is not a vast majority. Vast majority implies more than
 99%.

You could not be more wrong.

More than 99% is a stupendous majority, while within 95 to 99% is a tremendous 
majority.
From the official Majority rating 2015 edition, a vast majority would be 
between 87 and 87.6%.

Of course this is only valid in the northern hemisphere (my apologies for 
stating the obvious).

JM



-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24653] Mock.assert_has_calls([]) incorrectly passes

2015-07-17 Thread Robert Collins

Robert Collins added the comment:

This might go back further, haven't checked 3.3, but IIRC we're only doing 
fixes on 3.4 up anyhow.

--
nosy: +berker.peksag, kushal.das, michael.foord
versions: +Python 3.4, Python 3.5, Python 3.6

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



[issue24653] Mock.assert_has_calls([]) incorrectly passes

2015-07-17 Thread Robert Collins

New submission from Robert Collins:

From https://github.com/testing-cabal/mock/issues/243

from unittest import mock
mmock = mock.MagicMock()
mmock.foobar(baz)
mmock.assert_has_calls([])  # No exception raised. 
Why?mmock.assert_has_calls(['x'])  # Exception raised as expected.

---

Traceback (most recent call last):
  File tt.py, line 7, in module
mmock.assert_has_calls(['x'])  # Exception raised as expected.
  File /home/robertc/work/cpython/Lib/unittest/mock.py, line 824, in 
assert_has_calls
) from cause
AssertionError: Calls not found.
Expected: ['x']
Actual: [call.foobar('baz')]

--
messages: 246849
nosy: rbcollins
priority: normal
severity: normal
status: open
title: Mock.assert_has_calls([]) incorrectly passes

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



Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-17 Thread Antoon Pardon
On 07/16/2015 06:43 PM, Chris Angelico wrote:
 On Fri, Jul 17, 2015 at 12:32 AM, Antoon Pardon
 antoon.par...@rece.vub.ac.be wrote:

 What is unclear about as it is generally produced on stderr? That you
 can do a whole lot of stuff, doesn't mean that this whole lot of stuff is
 part of what generally happens. When people on this list ask a person
 to include the stacktrace with the description of the problem, they
 don't mean something that includes the values of the variables.
 True. That said, though, it's not a justification for dropping stack
 frames; even in the form that's printed to stderr, there is immense
 value in them. It may be possible to explicitly drop frames that a
 programmer believes won't be useful, but a general and automated
 dropping of tail-call information will do more harm than good. The
 fact that some frameworks can show _even more_ helpful information out
 of a traceback only makes this stronger.

Just wondering, are traceback records of generators available? They are
if an exception is raised in the generator itself, but what if an exception
is raised in the loop that is driven by a generator. They don't appear in
the standard stack trace. 

It seems a bit strange that with the immense value that is given to 
stack frames, that these wouldn't be available somehow.

-- 
Antoon Pardon

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


[issue24642] Will there be an MSI installer?

2015-07-17 Thread Alex Walters

Alex Walters added the comment:

Having now worked with the new installer, there is nothing wrong with it, and 
provides sufficient scritpability, if that is a word.  I only have two (and a 
half) thoughts on it:

1. This should be more prominently documented.  The addition of the new web 
installer is listed in What's New, but not that the change to the new 
installer, and lack of the old msi installer.  This is noteworthy for anyone 
who does scripted installs of python.

2. passing /? should list the available kay-value arguments.

2.5. The help should really be to stdout... If you are running /? on an 
installer executable, you are in the command prompt - no one creates a shortcut 
to an installer exe then modifies that shortcut to add the /? argument.

--

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



eGenix at the EuroPython Conference 2015

2015-07-17 Thread eGenix Team: M.-A. Lemburg


eGenix.com at the EuroPython Conference 2015

 July 20-26 2015
  Bilbao, Spain


  Meet up with eGenix at this year's EuroPython Conference in Bilbao.
  We have free project, consulting and coaching capacities.



The EuroPython Conference (https://ep2015.europython.eu/) is the one
of the premier conferences for Python users and developers in
Europe. It is the second largest gathering of Python enthusiast around
the world. This year it is being held from July 20-26 in Bilbao,
Spain.

This announcement is also available on our web-site for online reading:
http://www.egenix.com/company/news/EuroPython-Conference-2015.html



Meet up with eGenix at EuroPython

eGenix was one of the founding members of the EuroPython conference
team and played a major role in organizing the first EuroPython
conference in the year 2002.

Since then we have attended every EuroPython conference to meet up
face-to-face with the many people we know from the Python community
and the many people that we don't yet know from the community -- if
you are interested in meeting with us, please drop us a note so that
we can arrange a meeting at i...@egenix.com.



eGenix Talks at EuroPython

At this year's EuroPython, Marc-André Lemburg, CEO of eGenix, will be
giving a talk providing some guidance for programmers new to Python:

Python idioms to help you write good code
-

*Avoid gotchas, write faster, more readable and maintainable code*

Python focuses a lot on writing readable code and also tries to
make solutions obvious, but this doesn’t necessarily mean that you
cannot write unreadable code or design your code in ways which
makes it hard to extend or maintain.

This talk will show some useful idioms to apply when writing
Python code, how to structure your modules and also goes into
details on which techniques to use and which to think about twice,
based on 20 years of experience writing Python.

Tuesday 21 July at 15:15 CEST, Google Room


https://ep2015.europython.eu/conference/talks/python-idioms-to-help-you-write-good-code



Free project, consulting and coaching capacities

eGenix currently has free custom Python project, consulting and
coaching capacities.

If you are interested in having eGenix implement your great ideas in
Python, or want to have your teams benefit from our long Python coding
experience, please contact us at i...@egenix.com.

If you happen to attend EuroPython, you can also talk to our CEO
Marc-André Lemburg directly. Please email him to arrange a meeting:
m...@egenix.com.

Enjoy,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jul 17 2015)
 Python Projects, Coaching and Consulting ...  http://www.egenix.com/
 mxODBC Plone/Zope Database Adapter ...   http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2015-07-20: EuroPython 2015, Bilbao, Spain ...  3 days to go
2015-07-29: Python Meeting Duesseldorf ... 12 days to go

: Try our mxODBC.Connect Python Database Interface for free ! ::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Terry Reedy

On 7/17/2015 3:17 AM, Antoon Pardon wrote:

On 07/17/2015 01:46 AM, Chris Angelico wrote:

Open for bikeshedding: What should the keyword be? We can't use
exec, which would match Unix and shell usage, because it's already
used in a rather different sense in Python. Current candidates:
transfer, goto, recurse, and anything else you suggest.


I propose the combination return from.


Much better.  I believe 'yield from' actually cuts out the middle frame
containing yield from.


--
Terry Jan Reedy

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


Re: Noob in Python. Problem with fairly simple test case

2015-07-17 Thread Chris Angelico
On Fri, Jul 17, 2015 at 4:47 PM, Steven D'Aprano st...@pearwood.info wrote:
 Jessie's default should be 2.7, at least. Wheezy shipped 2.7, too;
 it's only Squeeze (now out of support) that didn't ship any 2.7.x
 Python. Are you sure you can't at least upgrade to 2.7?

 I'm not sure, I'm not actively involved in that specific project. All I know
 is that the guys are always complaining about Jessie, and that they're
 using 2.6.

Huh. Then maybe it's the other way: Jessie no longer ships or supports
2.6, so if 2.7 breaks the code, then so will Jessie. But I'm looking
over the 2.7 What's New page, and it honestly doesn't jump out at me
screaming Your code will break!. Strange.

Anyway, the specifics don't matter. What matters is that there *are*
people who are using the system-provided Python, and that (so far)
that's Py2 for the majority of Linux distros. But that's definitely
changing; Ubuntu and Debian are both aiming toward a state of ship
Python 3 by default, but if you want 2.7, you'll have to download it,
which implies that all system scripts will be ported to 3.x. Once that
happens, I expect that all Debian-derived distros will follow pretty
quickly (it's easy to transition if someone else has already done the
vast majority of the work, by which I clearly mean about 87.4%), and
non-Debian distros can probably take advantage of the prior work too,
to some extent. That'll shift the balance on Linux from mostly Py2
to mostly Py3, and that'll have knock-on effects on Windows and Mac
OS too, as third-party script developers will find it advisable [1] to
write their code to match the predominantly available version.

 My guess is, the rate of Python 3 adoption is going to hit the tipping point
 in 2 or 3 years, after which time it will be *very* rapid.

Yep, I'd agree with that estimate. Debian Stretch (9) may or may not
switch; I'd be very surprised if Debian Buster (10) didn't have Py3 by
default.

ChrisA

[1] The question is, what did the archbishop find?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24621] zipfile.BadZipFile: File is not a zip file

2015-07-17 Thread Yasar L. Ahmed

Yasar L. Ahmed added the comment:

@Serhiy These files are inside another Zip-bundle exported from a commercial 
control software for chromatography (UNICORN 6+ by GE Healthcare). Some of the 
other Zip-Files in the bundle work fine but some (like this one) don't.

I'm writing a script to extract/decode the deta so I'd be happy to get them 
extracted via python in some way (without requiring external dependencies).

Would it help to remove the offending bytes and then feed the bytes-object to 
ZipFile?

--

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



Re: Need assistance

2015-07-17 Thread Igor Korot
 Hi, Rob,

On Fri, Jul 17, 2015 at 12:40 PM, Rob Gaddi
rgaddi@technologyhighland.invalid wrote:
 On Thu, 16 Jul 2015 19:15:38 -0700, craig.sirna wrote:

 I need help writing a homework program.

 I'll write it, but I can't figure out how to incorporate what I have
 read in the book to work in code.

 The assignment wants us to take a users first, middle and last name in a
 single input ( name=('enter your full name: )).

 Then we must display the full name rearranged in Last, First Middle
 order.

 I tried to use the search function in Python to locate any spaces in the
 input. It spot back the index 5 (I used Craig Daniel Sirna)

 That is correct for the first space, but I can't figure out how to get
 it to continue to the next space.

 The indexing process is also a bit confusingto me.

 I get that I can use len(fullName) to set the length of the index, and
 how the index is counted, but after that I'm lost.

 I have emailed my professor a few times, but haven't gotten a
 response.(online course)

 Any help would be greatly appreciated.

 1) Use the interactive console.  Set x = 'Craig Daniel Sirna' and play
 with indexing and slicing it until you really internalize what they
 mean.  x[3], x[-3], x[0:10], x[0:-1].  It's not actually relevant to the
 problem at hand, but right now is the time in your education to get
 indexing down cold; skimp on it now and you'll pay for it forever.
 Should take you about 5 minutes.

 2) https://docs.python.org/3/library/stdtypes.html#string-methods
 You can do what you're trying to do, but you're swinging a hammer with a
 powered nailgun at your feet.  Search is an inefficient way to try to
 split a string into parts based on a delimiter.

Most likely it's not him. They will learn it later during the course. ;-)


 --
 Rob Gaddi, Highland Technology -- www.highlandtechnology.com
 Email address domain is currently out of order.  See above to fix.
 --
 https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how do you play python because i have gone on the website but i haven't managed to code?

2015-07-17 Thread sohcahtoa82
On Thursday, July 16, 2015 at 12:31:04 PM UTC-7, Aron Barsam wrote:
 how do you play python because i have gone on the website but i haven't 
 managed to code?

http://i.imgur.com/x2KwTbw.jpg
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proposed keyword to transfer control to another function

2015-07-17 Thread sohcahtoa82
On Friday, July 17, 2015 at 12:17:55 AM UTC-7, Antoon Pardon wrote:
 On 07/17/2015 01:46 AM, Chris Angelico wrote:
  Open for bikeshedding: What should the keyword be? We can't use
  exec, which would match Unix and shell usage, because it's already
  used in a rather different sense in Python. Current candidates:
  transfer, goto, recurse, and anything else you suggest.
 
 I propose the combination return from. I think it is similar enough
 with yield from to justify this and it also won't need an extra
 keyword, so no programs will be broken because they used transfer,
 goto or whatever other new keyword as an identifier.
 
 Should there be someone who is willing to spend time on this, I wish
 him all luck and strength he can find. I think it would be best if
 it was done by someone who is interrested in using this in his own
 programs. Because it is all very fine talking about the pro and
 cons here and I certainly would use it, the question is, how wide
 spread would the use become and is it worth the time and effort to
 introduce it. If future use turns out to be disappointing such a
 coder can at least think of it as something that was useful for
 himself.
 
 -- 
 Antoon.

return from or yield from looks too much like a COMEFROM 
instruction/statement.

https://en.wikipedia.org/wiki/COMEFROM
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need assistance

2015-07-17 Thread Rob Gaddi
On Thu, 16 Jul 2015 19:15:38 -0700, craig.sirna wrote:

 I need help writing a homework program.
 
 I'll write it, but I can't figure out how to incorporate what I have
 read in the book to work in code.
 
 The assignment wants us to take a users first, middle and last name in a
 single input ( name=('enter your full name: )).
 
 Then we must display the full name rearranged in Last, First Middle
 order.
 
 I tried to use the search function in Python to locate any spaces in the
 input. It spot back the index 5 (I used Craig Daniel Sirna)
 
 That is correct for the first space, but I can't figure out how to get
 it to continue to the next space.
 
 The indexing process is also a bit confusingto me.
 
 I get that I can use len(fullName) to set the length of the index, and
 how the index is counted, but after that I'm lost.
 
 I have emailed my professor a few times, but haven't gotten a
 response.(online course)
 
 Any help would be greatly appreciated.

1) Use the interactive console.  Set x = 'Craig Daniel Sirna' and play 
with indexing and slicing it until you really internalize what they 
mean.  x[3], x[-3], x[0:10], x[0:-1].  It's not actually relevant to the 
problem at hand, but right now is the time in your education to get 
indexing down cold; skimp on it now and you'll pay for it forever.  
Should take you about 5 minutes.

2) https://docs.python.org/3/library/stdtypes.html#string-methods
You can do what you're trying to do, but you're swinging a hammer with a 
powered nailgun at your feet.  Search is an inefficient way to try to 
split a string into parts based on a delimiter.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Ethan Furman

On 07/17/2015 12:17 AM, Antoon Pardon wrote:

On 07/17/2015 01:46 AM, Chris Angelico wrote:

Open for bikeshedding: What should the keyword be? We can't use
exec, which would match Unix and shell usage, because it's already
used in a rather different sense in Python. Current candidates:
transfer, goto, recurse, and anything else you suggest.


I propose the combination return from.


+1

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


tkinter resize question

2015-07-17 Thread nickgeovanis
Resizing a tkinter window which contains a frame which contains a button 
widget, will not change the current size of the window, frame or button as 
recorded in their height and width attributes (at least not if they are 
resizable). What is the correct way to detect their current size?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need assistance

2015-07-17 Thread Mark Lawrence

On 17/07/2015 17:40, Rob Gaddi wrote:

On Thu, 16 Jul 2015 19:15:38 -0700, craig.sirna wrote:


I need help writing a homework program.

I'll write it, but I can't figure out how to incorporate what I have
read in the book to work in code.

The assignment wants us to take a users first, middle and last name in a
single input ( name=('enter your full name: )).

Then we must display the full name rearranged in Last, First Middle
order.

I tried to use the search function in Python to locate any spaces in the
input. It spot back the index 5 (I used Craig Daniel Sirna)

That is correct for the first space, but I can't figure out how to get
it to continue to the next space.

The indexing process is also a bit confusingto me.

I get that I can use len(fullName) to set the length of the index, and
how the index is counted, but after that I'm lost.

I have emailed my professor a few times, but haven't gotten a
response.(online course)

Any help would be greatly appreciated.


1) Use the interactive console.  Set x = 'Craig Daniel Sirna' and play
with indexing and slicing it until you really internalize what they
mean.  x[3], x[-3], x[0:10], x[0:-1].  It's not actually relevant to the
problem at hand, but right now is the time in your education to get
indexing down cold; skimp on it now and you'll pay for it forever.
Should take you about 5 minutes.


I'll throw in something to emphasize a major difference between indexing 
and slicing.


 x = 'Craig Daniel Sirna'
 x[100]
Traceback (most recent call last):
  File stdin, line 1, in module
IndexError: string index out of range
 x[100:]
''
 x[:100]
'Craig Daniel Sirna'



2) https://docs.python.org/3/library/stdtypes.html#string-methods
You can do what you're trying to do, but you're swinging a hammer with a
powered nailgun at your feet.  Search is an inefficient way to try to
split a string into parts based on a delimiter.



Inefficient I don't know about, and mostly don't care about either, but 
certainly not the cleanest way to code, at least IMHO.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


[issue24641] Log type of unserializable value when raising JSON TypeError

2015-07-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think it would be better to change error message to mention the type only. 
Yet one argument is that the repr of affected object can be very large, while 
the type name usually is short enough. repr() even can raise an exception (e.g. 
MemoryError).

--
nosy: +bob.ippolito, pitrou, serhiy.storchaka

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



Re: tkinter resize question

2015-07-17 Thread nickgeovanis
On Friday, July 17, 2015 at 1:53:19 PM UTC-5, nickge...@gmail.com wrote:
 Resizing a tkinter window which contains a frame which contains a button 
 widget, will not change the current size of the window, frame or button as 
 recorded in their height and width attributes (at least not if they are 
 resizable). What is the correct way to detect their current size?

Ok, partially answering my own question:
The geometry of the window will change (win.geometry()), but the changes do not 
appear to propagate to the retrieved width/height of the child widgets, 
frames, etc. Or am I incorrect with this?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24649] python -mtrace --help is wrong

2015-07-17 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +belopolsky

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



Re: Need Help w. Getting the Eclipse Python Add-On.

2015-07-17 Thread Emile van Sebille

On 7/17/2015 11:22 AM, Steve Burrus wrote:

I Need immediate Help w. Getting the Eclipse Python Add-On. I looked all around 
the Eclipse website to try to get this but didn't see the add-on for this. Can 
someone please help me to find it? Thanx.


Googling 'python ecplise' certainly yields a lot of apparently valid 
links -- you might have better luck starting with a tutorial -- see 
perhaps http://www.vogella.com/tutorials/Python/article.html gets you 
further down the road.


Emile






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


Re: Noob in Python. Problem with fairly simple test case

2015-07-17 Thread Rick Johnson
On Friday, July 17, 2015 at 1:38:52 AM UTC-5, Steven D'Aprano wrote:
 75% or 90% is not a vast majority. Vast majority implies more than 99%.
 
 But regardless of the precise meaning of vast, if you want to dismiss one
 in four people (25%) or one in ten (10%) as inconsequential, then you've
 got some serious issues.

My estimate was *CONSERVATIVE* Steven. Read my words:
EDUCATED GUESS. Unlike you, I'm not going to falsify the
numbers just to win an argument. I feel very strongly about
the 75%, even though i know the percentage is much higher.

 You can't risk the upgrade? What precisely are you afraid of?

Simple. I don't want to waste even a second of time
debugging old code that has been bug free for years. I would
rather spend that time writing new code. Productivity is
important to some of us Steven!

And don't drag out that old cliche about how running 2to3 is
the path to lands of milk and honey. I call BS! With the
nonrestrictive typing of Python a bug can be hidden from even
the best testing methodology. Why would i risk exception hell
just to please you? I don't make my decisions based on your,
or the BDFL's, opinions of what is best for me. Heck, i
don't make my decisions based on what might be good for
the Python community. MY CODE! My RULES! GOT IT?

 That's nonsense. Spinning tires implies no forward motion.
 Python 3 usage is *certainly* moving forward: we've gone
 from the situation in 2008 of nobody using it, to the
 current situation where there's lots of activity around
 it:

How much of that is purely hype? Remember the explosion of
Python usage *BEFORE* Python3? However, there
has been a steady decline of Python usage since.

 students learning on Python 3, 

You act as if *EVERY* student that ever uses Python will
continue using Python forever, and *ONLY* Python! When in
fact, Python is mostly a stepping stone for CS-101 students
on their path to real languages like C, Java, DHTML, and the
APIs of the various mobile platforms. *THIS* is where code is
written to solve real life problems. *THIS* is where code
directly interacts with the *VAST MAJORITY* (yeah i said it!)
of humans on this planet to get stuff done! But where's Python? 

Oh, i know, it's stuck on my desktop. @_@

PYTHON IS A ONE TRICK PONY!

 My guess is, the rate of Python 3 adoption is going to hit
 the tipping point in 2 or 3 years, after which time it
 will be *very* rapid.

THE INTERNET WILL REMEMBER YOUR PREDICTION!

A lot can happen in 2-3 years that may render Python
obsolete (and your blabbing about 2020, really?).  My
prediction is that Python will never recover from this
backward compatibility issue. And sadly, Python2 had been
gaining stong momentum before Python3 arrived.

The code break was the first blow, and the evolving
technologies will be the final blow. Desktops computers are
becoming obsolete, and mobile platforms are the future. This
train has long since departed the station.

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


[issue24641] Log type of unserializable value when raising JSON TypeError

2015-07-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

A typical TypeError message use the following pattern:
  TypeError: 'int' object is not callable
as it is the class, not the value, that is the problem.

If the same is always true for the JSON TypeError, at the point of failure, 
then the dumps message could follow the same pattern.

However, I don't know if the message *is* value independent.  The SO question 
asked about

TypeError: {'album': [uRooney's Lost Album], 'title': [u'The Kids
After Sunset'], 'artist': [u'Rooney']} is not JSON serializable

and the OP claimed in a comment to the accepted answer that the problem was 
that the value objects represented as lists were not list() objects, just as 
'5' here is not an int() object.

The JSON error code, in 3.5 at

  File C:\Programs\Python35\lib\json\encoder.py, line 180, in default
raise TypeError(repr(o) +  is not JSON serializable)

could be expanded to check whether the string representation starts with the 
class name and if it does not, add 'classname' object at the front. This 
would solve Madison's posted issue, but not the SO problem.
(It would, however, have made it clear that the {}s represented a real dict() 
object and directed attention inward.)

For testing, compile('','','exec') returns an object that cannot be dumped.

To me, this looks more like an enhancement than bugfix, so a change might be 
limited to future releases.

--
nosy: +ezio.melotti, rhettinger, terry.reedy
stage:  - test needed
type:  - enhancement
versions: +Python 3.5, Python 3.6

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



[issue24654] PEP 492 - example benchmark doesn't work (TypeError)

2015-07-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

timeit(binary, 5, 3)
timeit(abinary, 5, 3)
gives me the same error running on Win 7 from Idle

--
nosy: +terry.reedy
stage:  - needs patch
type: enhancement - behavior

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



Need Help w. Getting the Eclipse Python Add-On.

2015-07-17 Thread Steve Burrus
I Need immediate Help w. Getting the Eclipse Python Add-On. I looked all around 
the Eclipse website to try to get this but didn't see the add-on for this. Can 
someone please help me to find it? Thanx.

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


[issue24621] zipfile.BadZipFile: File is not a zip file

2015-07-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Would it help to remove the offending bytes and then feed the bytes-object to 
 ZipFile?

Yes, it will.

import zipfile, struct, io
with open('not_working.zip', 'rb') as f:
data = f.read()

i = data.rindex(b'PK\5\6') + 22
i += struct.unpack('H', data[i-2: i])[0]
if data[i:].strip(b'\0') == b'':
data = data[:i]

zf = zipfile.ZipFile(io.BytesIO(data))

--

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



Re: Need Help w. Getting the Eclipse Python Add-On.

2015-07-17 Thread Jerry Hill
On Fri, Jul 17, 2015 at 2:22 PM, Steve Burrus steveburru...@gmail.com wrote:
 I Need immediate Help w. Getting the Eclipse Python Add-On. I looked all 
 around the Eclipse website to try to get this but didn't see the add-on for 
 this. Can someone please help me to find it? Thanx.

I think you're looking for PyDev: http://www.pydev.org/

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


[issue24654] PEP 492 - example benchmark doesn't work (TypeError)

2015-07-17 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue21750] mock_open data is visible only once for the life of the class

2015-07-17 Thread Robert Collins

Robert Collins added the comment:

The fix for this uncovered more testing / scenarios that folk use mock_open for 
that were not accounted for. I'm reverting it from mock, and am going to 
roll-forward for Python: I should have a fix in a day or two and we can fix it 
more completely then. 

https://github.com/testing-cabal/mock/issues/288

--
stage: commit review - needs patch

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



Re: A new module for performing tail-call elimination

2015-07-17 Thread Terry Reedy

On 7/16/2015 3:45 PM, Marko Rauhamaa wrote:


Nobody seemed to notice that I just posted a fairly typical tail call
function:


Because non-recursive tail calls are completely normal. Example:
return len(self.children)

Even tail operations like
return a + b
are tail calls if rewritten as
return a.__add__(b)
(usually but not always equivalent) or rewritten as
return operator.add(a, b)
(always equivalent) or compiled by an implementation as an equivalent 
internal function call.


It happens to be that CPython implements calls to symbol operator 
functions by putting the bodies of such functions into a C switch inside 
a while loop.  It this compiles operator symbols into bytecodes that 
cause a jump to the corresponding code.


--
Terry Jan Reedy

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


[issue24642] Will there be an MSI installer?

2015-07-17 Thread Steve Dower

Steve Dower added the comment:

 1. This should be more prominently documented.

Very true. I'll get a link to the updated docs page in there.

 2. passing /? should list the available kay-value arguments.

Should be doable. I've mostly been holding off until I stop changing the 
arguments. At the very least, I can add a link to the doc page from here as 
well.

 2.5. The help should really be to stdout...

Unfortunately, I don't think this one is possible as the installer is 
SUBSYSTEM:WINDOWS not CONSOLE. stdout is unbound by default, and the only way 
to bind it is to open a new console window, which doesn't really help here. 
Switching to SUBSYSTEM:CONSOLE is going to open a new console window every time 
you run it (and running by double-clicking or from a browser will be the vast 
majority).

I can probably add a link from the front page of the installer to bring up the 
help page, but I wouldn't want it to be too obtrusive (maybe from the Customize 
Options page?) - the aim is to reduce the number of decisions for most users by 
having a very clean front page.

There was a suggestion a while ago to generate a full command line based on the 
options selected in the UI, which is doable, but maybe not useful enough to 
justify the time and effort. I'd expect anyone capable of this sort of 
deployment to be able to figure out the command line for themselves though, 
given access to the list of possible options.

--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python

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



Re: tkinter resize question

2015-07-17 Thread Terry Reedy

On 7/17/2015 2:53 PM, nickgeova...@gmail.com wrote:

Resizing a tkinter window which contains a frame which contains a
button widget, will not change the current size of the window, frame
or button as recorded in their height and width attributes (at least
not if they are resizable).


Post the code and experiments performed that leads you to believe the above.

 What is the correct way to detect their current size?

It is hard to fix code not posted.

--
Terry Jan Reedy

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


[issue24658] open().write() fails on 4 GB+ data (OS X)

2015-07-17 Thread Eric O. LEBIGOT

New submission from Eric O. LEBIGOT:

On OS X, the Homebrew and MacPorts versions of Python 3.4.3 raise an exception 
when writing a 4 GB bytearray:

 open('/dev/null', 'wb').write(bytearray(2**31-1))
2147483647

 open('/dev/null', 'wb').write(bytearray(2**31))
Traceback (most recent call last):
  File stdin, line 1, in module
OSError: [Errno 22] Invalid argument

This has an impact on pickle, in particular 
(http://stackoverflow.com/questions/31468117/python-3-can-pickle-handle-byte-objects-larger-than-4gb).

--
components: Interpreter Core
messages: 246878
nosy: lebigot
priority: normal
severity: normal
status: open
title: open().write() fails on 4 GB+ data (OS X)
type: behavior
versions: Python 3.4, Python 3.5

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



Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Paul Rubin
Chris Angelico ros...@gmail.com writes:
 # derived from Paul Rubin's example
 def quicksort(array, start, end):
  midp = partition(array, start, end)

Heh, forgot to include the base case, as someone pointed out.  Oh well,
it's pseudocode, or something.

 transfer quicksort(array, midp+1, end)

Overall I like the idea but though it doesn't seem terribly important in
the scheme of things.  

I think the syntax has converged to return from which seems good to me.

 Note that this is incompatible with 'try' and 'with' blocks, and is

Maybe something can be done about that.

 Is there anything that I've missed out in speccing this up? I've a
 suspicion that this might turn out to be as complicated as 'yield
 from' in all its handling of edge cases.

Seems worthy of more thought.

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


Re: A new module for performing tail-call elimination

2015-07-17 Thread Paul Rubin
Chris Angelico ros...@gmail.com writes:
 My point was that I have yet to see anything that demands TCO and
 can't be algorithmically improved.

I don't think anyone claimed you can't simulate TCO with updateable
variables and a while loop.  TCO just sometimes lets you write some
things in a cleaner (in proponnets' view) style.

 The best so far has been a quicksort that uses TCO to guarantee a
 maximum on stack usage.

I actually thought the state machine example was more convincing.  Doing
that without TCO would have required some kind of explicit control loop
and a messy dispatch mechanism instead of direct chaining from one state
to the next.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24655] _ssl.c: Missing do for do {} while(0) idiom

2015-07-17 Thread Brian Cain

Brian Cain added the comment:

Whoops, that's not right.  Corrected.

--
Added file: http://bugs.python.org/file39942/ssl_convert_3rd.patch

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



[issue24655] _ssl.c: Missing do for do {} while(0) idiom

2015-07-17 Thread Brian Cain

Brian Cain added the comment:

New patch.

--
Added file: http://bugs.python.org/file39941/ssl_convert_2nd.patch

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



[issue24563] Encoding declaration: doc supported encodings

2015-07-17 Thread Martin Panter

Martin Panter added the comment:

You can remove the “.. XXX” line; I understand it is just like a TODO comment, 
and with this fixed it would no longer be relevant. I suggest putting the links 
next to the sentence that ends “. . . the encoding name must be recognized by 
Python.”

The links should be internal links, rather than hard-coded Internet links to 
another version of the documentation. See 
https://docs.python.org/devguide/documenting.html#cross-linking-markup. The 
Standard Encodings section already has a label already set up for you to use :)

--
nosy: +vadmium
stage: needs patch - patch review

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



[issue24646] Python accepts SSL certificate that should be rejected on OSX

2015-07-17 Thread Ned Deily

Ned Deily added the comment:

And the tradeoff for supplying private copies of newer OpenSSL libs with the 
Pythons installed by python.org OS X installers is that we would then need to 
solve the CA management problem for all users of those Pythons.  So far there 
hasn't been a good solution to that problem so we have elected to continue to 
use the least unattractive solution of continuing to use the Apple-supplied 
libs with the 10.6+ installer variants (Issue17128).  Eventually, we will have 
to bite the bullet and come up with s better solution as Apple will likely 
eventually stop shipping OpenSSL libs altogether.

--

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



[issue24646] Python accepts SSL certificate that should be rejected on OSX

2015-07-17 Thread Donald Stufft

Donald Stufft added the comment:

For what it's worth, the El Capitan Beta's apparently don't ship with OpenSSL 
headers anymore though they do still ship with the dylibs.

--

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



[issue24563] Encoding declaration: doc supported encodings

2015-07-17 Thread Martin Panter

Martin Panter added the comment:

PEP 263 doesn’t say exactly what encodings are supported. It mentions Shift JIS 
is supported, but UTF-16 is not. Only UTF-8 is allowed if the file starts with 
a UTF-8 BOM. I guess many of the Python-specific text encodings from the second 
section may be supported. Probably any text encoding in general, as long as the 
first one or two lines can “rougly” be parsed in ASCII.

--

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



[issue24536] os.pipe() should return a structsequence (or namedtuple.)

2015-07-17 Thread Martin Panter

Martin Panter added the comment:

The original Python-ideas thread: https://www.marc.info/?t=14355895454

If you want shorter field names, how about just r and w (as they are currently 
documented)?

os.write(our_pipe.w, bdata)
os.read(our_pipe.r, 1024)

“Input” and “output” would also work for me (though I am also happy with read, 
read_fd, etc). However it does seem a bit novel; in my experience people tend 
to say pipes have read and write ends, not inputs and outputs.

os.write(our_pipe.input, bdata)
os.read(our_pipe.output, 1024)

--
nosy: +vadmium
type:  - enhancement

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



[issue24642] Will there be an MSI installer?

2015-07-17 Thread Alex Walters

Alex Walters added the comment:

on 2.5, I figured the answer would be along those lines.

for 2, Linking to the documentation at least would be helpful (or otherwise 
indicating that there are arguments that are not listed and are in the docs) if 
the arguments cant be listed reasonably easily.

--

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



[issue24657] CGIHTTPServer module discard continuous '/' letters from params given by GET method.

2015-07-17 Thread takayuki

New submission from takayuki:

I executed CGIHTTPServer and requested the following URI,
http://localhost:8000/cgi-bin/test.py?k=aa%2F%2Fbb;
to pass aa//bb as argument k,
but test.py received aa/bb.

I looked in CGIHTTPServer.py and found _url_collapse_path function
discards continuous slash letters even they are in the given parameters.

--
components: Library (Lib)
messages: 246877
nosy: takayuki
priority: normal
severity: normal
status: open
title: CGIHTTPServer module discard continuous '/' letters from params given by 
GET method.
versions: Python 2.7

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



[issue24658] open().write() fails on 2 GB+ data (OS X)

2015-07-17 Thread Eric O. LEBIGOT

Eric O. LEBIGOT added the comment:

PS: I should have written 2 GB bytearray (so this looks like a signed 32 bit 
integer issue).

--
title: open().write() fails on 4 GB+ data (OS X) - open().write() fails on 2 
GB+ data (OS X)

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



Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Serhiy Storchaka

On 17.07.15 02:46, Chris Angelico wrote:

Out of the lengthy thread on tail call optimization has come one broad
theory that might be of interest, so I'm spinning it off into its own
thread.

The concept is like the Unix exec[vlpe] family of functions: replace
the current stack frame with a new one. This can be used for explicit
tail recursion without repeated stack frames, or for a pre-check that
then disappears out of the stack. Like any other feature, it can be
misused to make debugging difficult, but among consenting adults,
hopefully it can be used sensibly.


I think there is no chance that this proposition will be accepted by 
Guido, because it makes debugging harder.



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


[issue5945] PyMapping_Check returns 1 for lists

2015-07-17 Thread Christian Barcenas

Changes by Christian Barcenas christ...@cbarcenas.com:


--
versions: +Python 3.6

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



Re: tkinter resize question

2015-07-17 Thread Terry Reedy

On 7/17/2015 9:31 PM, nickgeova...@gmail.com wrote:

On Friday, July 17, 2015 at 5:55:19 PM UTC-5, Terry Reedy wrote:

On 7/17/2015 2:53 PM, nickgeova...@gmail.com wrote:

Resizing a tkinter window which contains a frame which contains a
button widget, will not change the current size of the window, frame
or button as recorded in their height and width attributes (at least
not if they are resizable).


Post the code and experiments performed that leads you to believe the above.


It's really boring but here you are:

[ngeo@localhost src]$ python3
Python 3.4.2 (default, Dec 20 2014, 13:53:33)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux
Type help, copyright, credits or license for more information.

import tkinter
win=tkinter.Tk()
frame=tkinter.Frame(win, bg=blue, width=200, height=200)
butt1=tkinter.Button(fg=green, bg=black)
frame.grid()
butt1.grid()
butt1[width]

0

butt1[height]

0

win[width]

0

win[height]

0


I believe these configuration settings should be interpreted a 'initial 
size' (if not default) or 'desired size' or possibly min or max size, 
depending on the grid or pack settings.


--
Terry Jan Reedy

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


[issue24658] open().write() fails on 2 GB+ data (OS X)

2015-07-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
components: +Extension Modules, IO -Interpreter Core
nosy: +haypo, ned.deily, ronaldoussoren

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



[issue24646] Python accepts SSL certificate that should be rejected on OSX

2015-07-17 Thread Ned Deily

Ned Deily added the comment:

 For what it's worth, the El Capitan Beta's apparently don't ship with
 OpenSSL headers anymore though they do still ship with the dylibs.

Hmm, I had tested installing existing python.org binary releases with the first 
DPs of 10.11 and I *thought* I had tested building from source, as well.  But, 
yes, it appears that the headers are no longer there, at least on the most 
recent DP I have installed.  I'm traveling and essentially off-the-net for 
another week but I will take a closer look at the situation then.

--

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



Re: tkinter resize question

2015-07-17 Thread Russell Owen

On 7/17/15 12:17 PM, nickgeova...@gmail.com wrote:

On Friday, July 17, 2015 at 1:53:19 PM UTC-5, nickge...@gmail.com wrote:

Resizing a tkinter window which contains a frame which contains a button 
widget, will not change the current size of the window, frame or button as 
recorded in their height and width attributes (at least not if they are 
resizable). What is the correct way to detect their current size?


Ok, partially answering my own question:
The geometry of the window will change (win.geometry()), but the changes do not appear to 
propagate to the retrieved width/height of the child widgets, frames, etc. Or 
am I incorrect with this?


I'm not seeing it. If I try the following script I see that resizing the 
widget does update frame.winfo_width() and winfo_height. (I also see 
that the requested width and height are ignored; you can omit those).


-- Russell


#!/usr/bin/env python
import Tkinter
root = Tkinter.Tk()

frame = Tkinter.Frame(root, width=100, height=50)
frame.pack(expand=True, fill=both)
def doReport(*args):
print frame actualwidth=%s, height=%s % (frame.winfo_width(), 
frame.winfo_height())
print frame requested width=%s, height=%s % 
(frame.winfo_reqwidth(), frame.winfo_reqheight())

button = Tkinter.Button(frame, text=Report, command=doReport)
button.pack()

root.mainloop()


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


[issue21258] Add __iter__ support for mock_open

2015-07-17 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag
versions: +Python 3.6

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



Re: tkinter resize question

2015-07-17 Thread Rick Johnson
On Friday, July 17, 2015 at 2:52:56 PM UTC-5, Russell Owen wrote:

 I'm not seeing it. If I try the following script I see
 that resizing the widget does update frame.winfo_width()
 and winfo_height. (I also see that the requested width and
 height are ignored; you can omit those).

I wonder if the OP is trying to query the sizes from inside
an event handler? Hmm. But since he failed to explain the problem
coherently, and also failed to provide a code sample, i'm
not willing to exert any effort beyond that.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Noob in Python. Problem with fairly simple test case

2015-07-17 Thread Mark Lawrence

On 17/07/2015 21:38, Laura Creighton wrote:

I think kivy is doing a very nice job of python-on-the-mobile.
Have you looked?  Please do not rant at me, just tell me what you
think.

Laura



At least rr occasionally comes out with something useful, usually WRT 
tkinter.  He's in the bottom division when compared to the RUE, who is 
still managing to get onto gg with his complete nonsense.  I'll admit I 
enjoy tripping over there just to report him.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Python Requirements

2015-07-17 Thread Luke Harrison
 Dear Python-List
 
 As part of my A2 Computing coursework, I need to program a solution using
 Python 3.4. I also need to document the minimum requirements to run Python
 3.4 on a Windows machine, including minimum RAM, minimum processing power,
 minimum hard disk space and monitor resolution.
 
 I have searched the Python forums and website, but I was unable to find
 these requirements.
 
 Could you please send me a copy of these requirements for use in my
 coursework?
 
 Thank you for your response in advance,
 
 Luke Harrison
 A2 Computing Student

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


[issue24655] _ssl.c: Missing do for do {} while(0) idiom

2015-07-17 Thread Brian Cain

New submission from Brian Cain:

_ssl.c has a convert() macro which misuses the do { ... } while(0) pattern 
by accidentally omitting the do.

This was discovered when building with clang, it reports while loop has empty 
body.  Effectively, convert puts the body into gratuitous scope braces and 
happens to be followed by a while(0);.  If convert() were used in some 
context where it weren't followed by a semicolon, it might do something 
terribly interesting.  Or, more likely, just fail to build.

--
components: Extension Modules
files: ssl_convert.patch
keywords: patch
messages: 246868
nosy: Brian.Cain
priority: normal
severity: normal
status: open
title: _ssl.c: Missing do for do {} while(0) idiom
versions: Python 3.6
Added file: http://bugs.python.org/file39938/ssl_convert.patch

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



Re: Proposed keyword to transfer control to another function

2015-07-17 Thread Cameron Simpson

On 17Jul2015 20:43, Chris Angelico ros...@gmail.com wrote:

On Fri, Jul 17, 2015 at 5:17 PM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:

On 07/17/2015 01:46 AM, Chris Angelico wrote:

Open for bikeshedding: What should the keyword be? We can't use
exec, which would match Unix and shell usage, because it's already
used in a rather different sense in Python. Current candidates:
transfer, goto, recurse, and anything else you suggest.


I propose the combination return from. I think it is similar enough
with yield from to justify this and it also won't need an extra
keyword, so no programs will be broken because they used transfer,
goto or whatever other new keyword as an identifier.



Oooh I like this. The parallel makes sense, and as you say, no new
keyword. Yes, return from is my new preferred command!


+1

Cheers,
Cameron Simpson c...@zip.com.au

A pessimist is an optimist in full possession of the facts.
--
https://mail.python.org/mailman/listinfo/python-list


[issue24642] Will there be an MSI installer?

2015-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 06600287f11f by Steve Dower in branch '3.5':
Issue #24642: Adds installer notes and links to What's New for 3.5
https://hg.python.org/cpython/rev/06600287f11f

New changeset d6c91b8242d2 by Steve Dower in branch 'default':
Issue #24642: Adds installer notes and links to What's New for 3.5
https://hg.python.org/cpython/rev/d6c91b8242d2

--
nosy: +python-dev

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



[issue24650] Error in yield expression documentation

2015-07-17 Thread swanson

swanson added the comment:

Okay, interesting - I hadn't checked the glossary.  I don't ultimately care 
what it's called as long as the documentation is clear and consistent.  But for 
anyone just looking at the names of the classes and the class hierarchy, they'd 
come away saying, A generator is a type of iterator, not A generator is a 
type of function.  (Functions can't even have subtypes.)  If the docs are 
painting a different picture than the already existing reality, it seems like 
that would be confusing to anyone who doesn't already know how they work.  (If 
you already know how something works, you don't really need the docs, so it's 
easy to think they're clearer than they really are.)

--

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



Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-17 Thread Terry Reedy

On 7/17/2015 7:43 AM, Antoon Pardon wrote:

On 07/17/2015 01:05 PM, Chris Angelico wrote:



def gen():
 yield stuff
 yield more stuff

for stuff in gen():
 bomb with exception

The error didn't happen in the generator, so I wouldn't expect to see
it in the traceback.


Yes something like that. And I wouldn't expect it either but if it
is not present, is it because nobody thought about it or because it
is a bad idea or an idea difficult to implement?


There's still room for the cause of an error to
not be in the traceback; imagine, for instance, a function that
populates a concrete list, and then you iterate over the list. If that
function sticks a None into the list and the subsequent processing is
expecting all strings, that's going to bomb, but then you have to
figure out where the None came from. If the traceback could include
that, it'd be great, but some things aren't possible.


Sure, but in this case, the generator is still active.


No more than any other object sitting around inactive. Calling a 
generator function like gen above returns a generator with the generator 
function, in a suspended inactive state, attached as an attribute.  When 
the generator.__next__ function is called, it activates its instance of 
the generator function, which suspends itself again after yielding 
something.  At the point of the exception above, the generator next 
function has returned.  There could be multiple generators with 
suspended generator functions sitting around.  For instance:


def f():
for tup in zip(gf0, gf1, gf2, gf3, gf4, gf5):
a = tup[6]  # whoops, IndexError
unreachable code meant to do something

--
Terry Jan Reedy

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


Trac 1.1.6 Released

2015-07-17 Thread Ryan Ollos
Trac 1.1.6 Released
===

Trac 1.1.6, the final release on the 1.1.x
development line leading up to 1.2, provides
more than a half-dozen minor fixes and
enhancements.

Note that the 1.1.x releases are stable and
tested snapshots of the trunk.  They can be seen
as sub-milestones on the road towards Trac 1.2. As
opposed to maintenance releases, *we offer no
guarantees on feature and API compatibility from
one 1.1.x release to the next*.

However, by following 1.1.x you get a chance to
use new features earlier, and therefore be able to
contribute feedback when things are still in flux.
It's also less risky than just getting the latest
trunk, as we won't cut a 1.1.x release in the middle
of a series of changes (though we had and still intend
to have a good record of keeping things always working
on trunk).

The intended audience are therefore enthusiast Trac
users and Trac plugin developers. These packages should
*not* be integrated in distributions, for example.

The fixes made for 1.0.7 are also included.

You can find all the detailed release notes at:

 -
http://trac.edgewall.org/wiki/TracDev/ReleaseNotes/1.1#DevelopmentReleases
 -
http://trac.edgewall.org/wiki/TracDev/ReleaseNotes/1.0#MaintenanceReleases

Download URLs:

  http://download.edgewall.org/trac/Trac-1.1.6.tar.gz
  http://download.edgewall.org/trac/Trac-1.1.6.win32.exe
  http://download.edgewall.org/trac/Trac-1.1.6.win-amd64.exe
  http://download.edgewall.org/trac/Trac-1.1.6.zip

MD5 sums:

  0f96a95a3e8a92e7a694883c929b2fa2  Trac-1.1.6.tar.gz
  55c9dbb5ee430d139d0195eb9a056146  Trac-1.1.6.win32.exe
  4d42dcbedafcfeba30a8be6d8a02ab4c  Trac-1.1.6.win-amd64.exe
  fdf6f5e7653ae84cd2c8f14ac6475dc2  Trac-1.1.6.zip

SHA1 sums:

  0f4b3cc3cb8a2ee6b649ee5c4cf502f4f1f213e3  Trac-1.1.6.tar.gz
  d1273671ab354ea97efbc0a78bf03a0b86125399  Trac-1.1.6.win32.exe
  13e5f23e940bf9eaef9cb9261e0e6b5b87da21c6  Trac-1.1.6.win-amd64.exe
  99b98f716f38eda3fdacf4ab7221e0d381d41418  Trac-1.1.6.zip


Enjoy!

- The Trac Team  http://trac.edgewall.org/
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Parsing and displaying C structs in a semi-intelligent way.

2015-07-17 Thread Anders Wegge Keller
 In my day job, we have a large code base of mostly identical projects, each
with their own customizations. The customizations can be a real pain
sometimes. Especially when debugging binary data. The interesting part of
the binary dumps are most often the stuff that are tweaked from project to
project. The prime suspect is a structure like this:

typedef struct
{
bytenext ;  /* Index to next wedge  */
byteflags ; /* ricd-control flags   */
wordalt [MAX_alt] ; /* Alternative wedges   */
...
} ConvResult ;

typedef struct
{
bytestate ; /* UCART_ (see cart.h)  */
wordheadcart ;  /* Cart number for header cart  */
ConvResult  conv ;
...
} cartUTable_t ;

 The actual structure with substructures are much larger. This structure
contains all the information used when sorting stuff[1]. For historical
reasons, the data is dumped to a binary file at the end of the items
life-cycle. We do have a debugging tool, that reads an in-house file format
specifying the members of the structure, and how to display them. However,
updating this description is error-prone, and just about as funny as waiting
for the Norwegian Blue to fly out over the fiords. So most often it's either
not done, or is unusable. 

 To clean up this mess, I've devised a cunning plan, involving a C-parser,
that can write a structure definition as XML. Reading this is simple enough,
and going from that to a format string for struct.unpack() is mostly
trivial. Except for the arrays of some C-type, that happens to be something
else than an array of char. Due to the normal use case[2] of dumping this
binary data, I need to get the parsed data munged into a form, that can be
put into a namedtuple as single member, even when I have an array of
(typical) six conv.alt values. I'm getting stuck with the limitations of
struct and namedtuple. While inheriting either of them to get the job done,
seem to be feasible, I still feel that I somehow should be able to do
something list comprehension-ish, to avoid going there. I just can't see
the light.

(Thank you for reading all the way to here!)


1. Luggage, parcels, shop replenishments ... In short: mostly rectangular
   things that has a barcode attached.

2. Random ordering, not displaying all members, and only a part of the
   arrays.

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


Re: Need assistance

2015-07-17 Thread Denis McMahon
On Thu, 16 Jul 2015 19:15:38 -0700, craig.sirna wrote:

 The assignment wants us to take a users first, middle and last name in a
 single input ( name=('enter your full name: )).
 
 Then we must display the full name rearranged in Last, First Middle
 order.

To generate a list of words from a string, split the string up on the 
spaces between words. See the split method of strings.

Having a list of words, get a copy of the list in reverse order. See the 
reversed function (and maybe the list function).

Note - reversed returns an iterable, list will convert the iterable to a 
list.

To join the elements of a list into a string, see the join method of 
strings.

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tkinter resize question

2015-07-17 Thread nickgeovanis
On Friday, July 17, 2015 at 5:55:19 PM UTC-5, Terry Reedy wrote:
 On 7/17/2015 2:53 PM, nickgeova...@gmail.com wrote:
  Resizing a tkinter window which contains a frame which contains a
  button widget, will not change the current size of the window, frame
  or button as recorded in their height and width attributes (at least
  not if they are resizable).
 
 Post the code and experiments performed that leads you to believe the above.

It's really boring but here you are:

[ngeo@localhost src]$ python3
Python 3.4.2 (default, Dec 20 2014, 13:53:33) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux
Type help, copyright, credits or license for more information.
 import tkinter
 win=tkinter.Tk()
 frame=tkinter.Frame(win, bg=blue, width=200, height=200)
 butt1=tkinter.Button(fg=green, bg=black)
 frame.grid()
 butt1.grid()
 butt1[width]
0
 butt1[height]
0
 win[width]
0
 win[height]
0

Needless to say the button has appeared and has non-zero size.

   What is the correct way to detect their current size?
 
 It is hard to fix code not posted.

Just a question from first principles: Find a widget's current size.
But the code example posted showed a working way to do the same thing.
Unfortunately requiring a function call, and not in the doc online AFAICS 
butdoc is doc.
 
 Terry Jan Reedy
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Requirements

2015-07-17 Thread Chris Angelico
On Sat, Jul 18, 2015 at 7:37 AM, Luke Harrison lukeharriso...@gmail.com wrote:
 As part of my A2 Computing coursework, I need to program a solution using

 Python 3.4. I also need to document the minimum requirements to run Python

 3.4 on a Windows machine, including minimum RAM, minimum processing power,

 minimum hard disk space and monitor resolution.

Simple answer: If it's capable of running a modern Windows, it's
capable of running Python. There's no screen resolution requirements,
and the RAM, CPU, and HD requirements depend more on what you do with
Python than on the language itself. The easiest way to find out is to
try it - grab the installer, plop it onto a system, see how much less
disk space you have. Then start running code and see how efficient it
is. There's a world of difference between the RAM/CPU requirements of
Hello, world and a program that does video processing, and that's
true regardless of the language.

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


  1   2   >