Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 03:00:12 UTC+2 skrev Gregory Ewing:
 Steven D'Aprano wrote:
 
  What digits would you use for base one-million?
 
 Interesting question. Unicode currently has about
 75,000 CJK characters, so we would need to find about
 12 more independently developed cultures with similar
 writing systems to get enough characters. I suggest
 revisiting the issue when interstellar travel and
 exploration have been better developed.
 
 -- 
 Greg

No need Greg it is an easy task creating visual interpretable symbols from low 
to high using lines in a point/pixel space. I could create the set in a day.

And if i use colour space it is even easier.

The hard part is making the point space visible and interpretabel without 
calculation and holding remainders in head. 

But then again when numbers have more than 5 digitplaces people tend to 
interpretate them digitwise anyway.

10010 is interpretated as a single digit by brain.
7582560 people mostly interpretate as 7 m 582 000 and 560.

You can tell how people group and think about numbers by having them reading up 
a very long telephone number.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue19610] Give clear error messages for invalid types used for setup.py params (e.g. tuple for classifiers)

2015-04-08 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the review, Éric. New patch attached.

 When running a setup.py that uses a tuple for classifiers, is the error 
 message in the terminal user-friendly, or do we get a full traceback?

A full traceback:

Traceback (most recent call last):
  File setup.py, line 37, in module
platforms=('Windows', 'Any'),
  File /home/berker/projects/cpython/default/Lib/distutils/core.py, line 108, 
in setup
_setup_distribution = dist = klass(attrs)
  File /home/berker/projects/cpython/default/Lib/distutils/dist.py, line 253, 
in __init__
getattr(self.metadata, set_ + key)(val)
  File /home/berker/projects/cpython/default/Lib/distutils/dist.py, line 
1212, in set_platforms
raise TypeError(msg % type(value).__name__)
TypeError: 'platforms' should be a 'list', not 'tuple'

--
Added file: http://bugs.python.org/file38862/issue19610_v4.diff

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



[issue23883] __all__ lists are incomplete

2015-04-08 Thread Berker Peksag

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


--
nosy: +berker.peksag

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



Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 02:38:57 UTC+2 skrev Steven D'Aprano:
 On Wed, 8 Apr 2015 03:44 am, Ian Kelly wrote:
 
 
 to_base(2932903594368438384328325832983294832483258958495845849584958458435439543858588435856958650865490,
  429496729)
  [27626525, 286159541, 134919277, 305018215, 329341598, 48181777,
  79384857, 112868646, 221068759, 70871527, 416507001, 31]
 
 
 They're not exactly *digits* though, are they? Without an easy to use set of
 429496729 different symbols, the whole exercise is rather pointless. It's
 not more compact: 97 decimal digits, versus 121 characters in the list
 representation. 110 if you strip out the spaces between items. It's
 certainly not more memory efficient: the long int 293...490 takes 56 bytes,
 compared to 80 bytes for just the list, not including the memory used by
 its 12 int items. (Results may vary in other versions of Python.) You can't
 do arithmetic on it faster than Python's built-ins.
 
 Besides, it isn't clear to me whether Jonas wants to convert decimal
 293...490 *into* base 429496729 as you have done, or *base 429496729*
 293...490 into decimal.
 
 
 
 -- 
 Steven

Well Steven you just draw a line under connecting them all, and now you are 
allowed to call whatever combination you write down a single digit.

And you have just created 429496729 unique symbols ;), in a pencil stroke.
I know at least one intergalactic poster that will be impressed ;)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23883] __all__ lists are incomplete

2015-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ebf3e6332a44 by Berker Peksag in branch 'default':
Issue #23883: Add missing entries to traceback.__all__.
https://hg.python.org/cpython/rev/ebf3e6332a44

--
nosy: +python-dev

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



Re: Automate deployment of Python application from multiple VCS repositories

2015-04-08 Thread Damien Wyart
 Fabric might help but is more low-level than what you seem to look
 for.
 http://docs.fabfile.org/en/latest/tutorial.html

Elsewhere in the spectrum is Saltstack, but application deployment
usecases are not that well documented.
https://groups.google.com/forum/#!msg/salt-users/w9hxKpXVL04/5NIHE9aYWscJ

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


[issue16314] Support xz compression in distutils

2015-04-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping.

--
assignee:  - eric.araujo

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



[issue23857] Make default HTTPS certificate verification setting configurable via global ini file

2015-04-08 Thread Nick Coghlan

Nick Coghlan added the comment:

I like the idea of a separate 2.7-redistributor branch to capture changes 
like this, as that would almost *exactly* duplicate the kernel maintenance 
model.

That approach would also mean that we don't have to figure out sensible 
upstream documentation for features like this that only make sense in the 
context of a redistributor that is responsible for ensuring they're used 
appropriately.

--

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



[issue23883] __all__ lists are incomplete

2015-04-08 Thread Milap Bhojak

Milap Bhojak added the comment:

I working on these three. 
calendar.Calendar
calendar.HTMLCalendar
calendar.TextCalendar

Changes would be the same as https://hg.python.org/cpython/rev/ebf3e6332a44/ 
for every module?

--
nosy: +milap.py

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



[issue23883] __all__ lists are incomplete

2015-04-08 Thread Martin Panter

Martin Panter added the comment:

Serhiy: Yes I was also thinking it might be time for a common helper function.

Milap: I think changes like you mentioned (originally by me) would be fine. 
Another variation was done for Issue 10838: revision 10b0a8076be8, which 
expects each object that is not a module object (e.g. not from “import sys”), 
rather than expecting each object that is a function or class defined in the 
module. It might depend on the particular circumstance which technique is 
superior.

--

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



[issue23886] faulthandler_user should use _PyThreadState_Current

2015-04-08 Thread Albert Zeyer

New submission from Albert Zeyer:

SIGUSR1/2 will get delivered to any running thread. The current thread of the 
signal doesn't give any useful information. Try to get the current Python 
thread which holds the GIL instead, or use NULL.

I have patched this for the external faulthandler module here:
https://github.com/haypo/faulthandler/pull/12
https://github.com/albertz/faulthandler/commit/dc92265

--
components: Library (Lib)
messages: 240252
nosy: Albert.Zeyer
priority: normal
severity: normal
status: open
title: faulthandler_user should use _PyThreadState_Current
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6

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



[issue23883] __all__ lists are incomplete

2015-04-08 Thread Berker Peksag

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


--
keywords: +easy
stage:  - needs patch

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



Re: Automate deployment of Python application from multiple VCS repositories

2015-04-08 Thread Damien Wyart
* Ben Finney ben+pyt...@benfinney.id.au in comp.lang.python:
 What tools are available to automate deployment of a Python
 application comprising many discrete modules, spread across different
 code bases in different VCS repositories?

Fabric might help but is more low-level than what you seem to look
for.
http://docs.fabfile.org/en/latest/tutorial.html

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


[issue23865] Fix possible leaks in close methods

2015-04-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ah, yet one purpose of the patch is to make close() methods more robust when 
called at shutdown. Objects can be partially deconstructed at that time, 
attributes can be set to None to break reference loops. That is why I use None 
as signaling value and always check some attribute for None.

The changes to aifc make sense. close() is called from __exit__(). When context 
manager is used in a generator, it creates a reference loop. So self.file is 
None in this case and self.file.close() will raise an AttributeError.

--

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



[issue23882] unittest discovery and namespaced packages

2015-04-08 Thread Alex Shkop

Alex Shkop added the comment:

Spent some time looking into this one. Looks like the problem is in 
TestLoader.discover() method. There are couple of issues I found in it, all 
caused by same assumption.

Documentation [1] states that all test modules found by discover() method 
should be importable from top_level_dir. Whenever this method finds a 
subdirectory of start_dir it checks for __init__.py file. If there's no 
__init__.py then finder assumes that files within this package is not 
importable and stops recursion. This kind of 'importablity' check is not valid 
since we have namespace packages.

I'm not sure what should be done to fix this issue. We can change documentation 
to state that only regular packages with tests will be discovered. Or we can 
fix 'importability' checks, which will mean that all tests in all 
subdirectories will be discovered.

[1] 
https://docs.python.org/3.4/library/unittest.html#unittest.TestLoader.discover

--
nosy: +ashkop

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



[issue23883] __all__ lists are incomplete

2015-04-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be makes sense to add a helper in test.support that implements a test 
similar to the one in issue23411, and add tests for __all__ in multiple modules.

--

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



[issue23884] New DateType for argparse (like FileType but for dates)

2015-04-08 Thread Peter Marsh

Peter Marsh added the comment:

The consensus seems to be that this is simple enough for people to implement 
themselves (if they need it) and it's probably not worth adding to argparse, so 
I've closed this :)

--
resolution:  - rejected
status: open - closed

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



[issue23887] HTTPError doesn't have a good repr representation

2015-04-08 Thread Facundo Batista

New submission from Facundo Batista:

I normally print(repr()) the exception I got, for debugging purposes. I use 
repr() because for builtin exceptions, str() will print only the message, and 
not the exception type.

But for HTTPError, the repr() of it is HTTPError(), without further 
explanation...

--
messages: 240262
nosy: facundobatista
priority: normal
severity: normal
status: open
title: HTTPError doesn't have a good repr representation
versions: Python 3.4

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



Re: Best search algorithm to find condition within a range

2015-04-08 Thread Ian Kelly
On Tue, Apr 7, 2015 at 4:35 PM,  jonas.thornv...@gmail.com wrote:
 I am not sure you guys realised, that althoug the size of the factors to 
 muliply expands according to base^(exp+1) for each digitplace the number of 
 comparissons needed to reach the digit place (multiple of base^exp+1) is 
 constant with my approach/method.

No it isn't. You do one comparison on every iteration of your while
loop, and you do one iteration for every digit. How is that constant?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 09:16:24 UTC+2 skrev Ian:
 On Tue, Apr 7, 2015 at 4:35 PM,  jonas.thornv...@gmail.com wrote:
  I am not sure you guys realised, that althoug the size of the factors to 
  muliply expands according to base^(exp+1) for each digitplace the number of 
  comparissons needed to reach the digit place (multiple of base^exp+1) is 
  constant with my approach/method.
 
 No it isn't. You do one comparison on every iteration of your while
 loop, and you do one iteration for every digit. How is that constant?

Ok the number of comparissons is linear for each digitplace not exponential.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 09:16:24 UTC+2 skrev Ian:
 On Tue, Apr 7, 2015 at 4:35 PM,  jonas.thornv...@gmail.com wrote:
  I am not sure you guys realised, that althoug the size of the factors to 
  muliply expands according to base^(exp+1) for each digitplace the number of 
  comparissons needed to reach the digit place (multiple of base^exp+1) is 
  constant with my approach/method.
 
 No it isn't. You do one comparison on every iteration of your while
 loop, and you do one iteration for every digit. How is that constant?

The for loop should be replaced with a version of binary search making 
comparisson instead of adding to digit. It will be alot faster with a base 
using 32-bits.

But the point is the number of operations is linear for each digitplace with my 
approach/method, you will multiply bigger numbers. But the numbers of 
comparissons and multiplications is linear over the digitspace.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23577] Add tests for wsgiref.validate

2015-04-08 Thread Alex Shkop

Alex Shkop added the comment:

*ping*

--

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



Re: Could not find any downloads that satisfy the requirement novaclient

2015-04-08 Thread marco . nawijn
On Tuesday, April 7, 2015 at 9:55:58 PM UTC+2, kurt_...@symantec40.com wrote:
 Hi-
 
 While trying to install an OpenStack client on Mac OSX, I get the following:
 
 SymMacToolkit-C02N4H9DG3QD:/ kurt_heiss$ sudo pip install novaclient
 Password:
 The directory '/Users/kurt_heiss/Library/Logs/pip' or its parent directory is 
 not owned by the current user and the debug log has been disabled. Please 
 check the permissions and owner of that directory. If executing pip with 
 sudo, you may want the -H flag.
 The directory '/Users/kurt_heiss/Library/Caches/pip/http' or its parent 
 directory is not owned by the current user and the cache has been disabled. 
 Please check the permissions and owner of that directory. If executing pip 
 with sudo, you may want the -H flag.
 The directory '/Users/kurt_heiss/Library/Caches/pip/http' or its parent 
 directory is not owned by the current user and the cache has been disabled. 
 Please check the permissions and owner of that directory. If executing pip 
 with sudo, you may want the -H flag.
 Collecting novaclient
   Could not find any downloads that satisfy the requirement novaclient
   No distributions at all found for novaclient
 SymMacToolkit-C02N4H9DG3QD:/ kurt_heiss$ 
 
 I changed the permissions on the identified folders as well as tried the -H 
 option to no positive result.
 
 Anybody encounter this issue or suggest a possible workaround?

Hi,

The module you are looking for is named python-novaclient and not novaclient.
You can check for yourself by running pip search novaclient.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Code critique please

2015-04-08 Thread Jean-Michel Pichavant
- Original Message -
 From: kai peters kai.pet...@gmail.com
 To: python-list@python.org
 Sent: Wednesday, 8 April, 2015 12:43:23 AM
 Subject: Code critique please
 
 I just wrote this bit (coming from Pascal) and am wondering how
 seasoned Python programmers would have done the same? Anything
 terribly non-python?
 
 As always, thanks for all input.
 
 K
 
 
 
 
  Creates a PNG image from EPD file
 
 
 import os, sys
 from PIL import Image, ImageFont, ImageDraw
 
 #
 -
 def RenderByte(draw, byte, x, y):
 
 blist = list(bin(byte).lstrip('0b')) # turn byte into list with 8
 elements,
 c = 0# each representing one bit
 for bit in blist:
 if bit:
 draw.point((x + c, y), fcolor)
 
 c += 1
 return
 
 #

Apart from what has been already said, you could rewrite your function 
RenderByte this way (untested):

def render_byte(draw, byte, x, y):
  for point in [(x+c, y) for (c, bit) in enumerate(bin(byte)[2:]) if int(bit)]:
draw.point(point, fcolor)


it involves important notions in the python language:
  - list comprehension, this is the  [...] part, where it combines filtering a 
list and applying a function to the values
  - slicing, bin(byte)[2:] returning the sequence stripped from its 2 first 
elements

Additional remarks : 
  - is fcolor defined ?
  - your test if bit: was probably wrong as it was testing either 0 or 1 
which are both evaluated to True. In other words, bool(0) == True, bool(0) == 
False

Cheers,

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


Re: Get the numbering of named regex groups

2015-04-08 Thread MRAB

On 2015-04-08 15:28, Peter Otten wrote:

Mattias Ugelvik wrote:


Example: re.match('(?Pfirsta?)(?Psecondb?)', '')

How can I find out that the group 'first' correlates to the positional
regex group 1? I need to know this to resolve crucial ambiguities in a
string manipulation tool I'm making. Looking at spans, as the example
above illustrates, won't do the job.

I can't see a way to do this through the documented interface (at
least not in the `re` module?).


Compile and match in two separate steps:


import re
r = re.compile('(?Pfirsta?)(?Psecondb?)')


Find the groups' positions:


r.groupindex

{'second': 2, 'first': 1}


Find the matching substrings:


r.match(a).groupdict()

{'second': '', 'first': 'a'}

https://docs.python.org/2.7/library/re.html#re.RegexObject.groupindex


The match object has an attribute 're' that's the compiled regex:

 m = re.match('(?Pfirsta?)(?Psecondb?)', '')
 m.re.groupindex
{'first': 1, 'second': 2}

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


Re: Why PyINCREF on _PyFalseStruct and _PyTrueStruct?

2015-04-08 Thread Shiyao Ma
On Wed, Apr 8, 2015 at 11:24 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
 The ref count is incremented because the caller will decrement it when
 it's done with the reference.

That makes sense.

To be generic, the caller won't check what the returned result is. It
just takes it as a normal PyObject. Traditionally, for functions like
above, the reference is assumed to be transferred to the caller.

Regards.

-- 

吾輩は猫である。ホームーページはhttp://introo.me。
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why PyINCREF on _PyFalseStruct and _PyTrueStruct?

2015-04-08 Thread Ian Kelly
On Wed, Apr 8, 2015 at 9:07 AM, Shiyao Ma i...@introo.me wrote:
 Hi.

 While reading the rich_compare of PyLongObject, I noticed this line:

 https://hg.python.org/cpython/file/a49737bd6086/Objects/longobject.c#l2785

 It increments the ob_ref of the builtin True/False object.

 Initializing the ob_ref of True/False to one so that they won't be
 garbage collected if fair enough. Why do we increment it?

 I don't see the reason behind it, since these two objects should
 always stay in the memory and never participate the garbage collecting
 system.

The ref count is incremented because the caller will decrement it when
it's done with the reference. The ref counter doesn't do any check to
see what the object is before freeing it; it just frees it if the
count hits 0. I believe that for objects like True/False, CPython
avoids getting a 0 ref count by adding one increment at creation that
will never be decremented. If it were possible to hit a decrement
without a corresponding increment though, then the count could reach 0
and the object would be freed anyway.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23342] run() - unified high-level interface for subprocess

2015-04-08 Thread Thomas Kluyver

Thomas Kluyver added the comment:

I am still keen for this to move forwards. I am at PyCon if anyone wants to 
discuss it in person.

--

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



[issue23815] Segmentation fault when create _tkinter objects

2015-04-08 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Probably a PyType_Ready() missing.

--

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



[issue23342] run() - unified high-level interface for subprocess

2015-04-08 Thread Gregory P. Smith

Gregory P. Smith added the comment:

I'm at pycon as well, we can get this taken care of here. :)

--

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



[issue23342] run() - unified high-level interface for subprocess

2015-04-08 Thread Thomas Kluyver

Thomas Kluyver added the comment:

Great! I'm free after my IPython tutorial this afternoon, all of tomorrow, and 
I'm around for the sprints.

--

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



Re: Best search algorithm to find condition within a range

2015-04-08 Thread Denis McMahon
On Tue, 07 Apr 2015 23:18:14 -0700, wxjmfauth wrote:

 Le mercredi 8 avril 2015 08:08:04 UTC+2, wxjm...@gmail.com a écrit :
 Le mercredi 8 avril 2015 00:57:27 UTC+2, Steven D'Aprano a écrit :
  On Tue, 7 Apr 2015 07:44 pm, jonas.thornv...@gmail.com wrote:
  
  
   I want todo faster baseconversion for very big bases like base 1
   000 000,
   so instead of adding up digits i search it.
  
  What digits would you use for base one-million?
  
  Base 2 uses 0 1.
  Base 3 uses 0 1 2.
  Base 10 uses 0 1 2 3 4 5 6 7 8 9.
  Base 16 uses 0 1 2 3 4 5 6 7 8 9 A B C D E F.
  
  Base one million uses what?
  
  How would you write down 12345 in base one-million?
  
  
 =
 
 Why should a digit contain a single/unique character?
 
 Representation of the number 257 in base 256:
 
 257 (base 10) -- FF 02 (base 256)
 
 ==
 
 Oops, typo, erratum
 
 *** 257 (base 10) -- 01 01 (base 256) ***

Bt. Wrong.

0101(256) is 0 * 256^3 + 1 * 256^2 + 0 * 256^1 + 1 * 256^0

= 65537

The whole point of base x is that any number in the range 0 .. x^1 is 
represented with a single characterisation, otherwise you don't have 
base x.

This is the same fundamental issue as the OP is failing to understand - 
base x notation is a human readability and representation thing, not an 
inherent feature of numbers.

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


Re: Best search algorithm to find condition within a range

2015-04-08 Thread Mel Wilson
On Wed, 08 Apr 2015 07:56:05 -0700, jonas.thornvall wrote:

 There is no need for inventing a new set of characters representing
 32-bit numbers. You will not be able to learn them by heart anyway,
 unless they build on a interpretation system binaries, decimals.

See Jorge Luis Borges, _Funes the Memorious_.  Gotta keep up with the 
literature.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23889] Speedup inspect.Signature.bind

2015-04-08 Thread Yury Selivanov

New submission from Yury Selivanov:

Right now the implementation of Signature.bind is very complex, which leads to 
a subpar performance. The only way to significantly speed it up is to employ 
code generation and cache (the other way it to rewrite it in C, but that's 
something I'd like to avoid). I'll upload an initial implementation soon.

--
assignee: yselivanov
components: Library (Lib)
messages: 240279
nosy: asvetlov, brett.cannon, larry, ncoghlan, yselivanov
priority: normal
severity: normal
status: open
title: Speedup inspect.Signature.bind
versions: Python 3.5

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



[issue23889] Speedup inspect.Signature.bind

2015-04-08 Thread Yury Selivanov

Changes by Yury Selivanov yseliva...@gmail.com:


--
stage:  - needs patch
type:  - performance

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



How to find out which named regular expression group corresponds to which positional regex group

2015-04-08 Thread Mattias Ugelvik
I'm making a string manipulation tool in which I need to know this correlation.

Take this example: re.match('(?Pfirsta?)(?Psecondb?)', '')

I need to know that 'first' is group #1, and 'second' is group #2. I
need this to resolve certain ambiguities. I was hopin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best search algorithm to find condition within a range

2015-04-08 Thread Mel Wilson
On Tue, 07 Apr 2015 23:19:49 -0700, jonas.thornvall wrote:

 And you have just created 429496729 unique symbols ;), in a pencil
 stroke.

No.  You did that, when you said base 429496729.  Representing the 
symbols in a computer is no problem, any Python long int can do that.  To 
display the symbols, you can use PIL to make up glyphs out of coloured 
pixels 864x864.  You can keep your glyphs in GIFs.  Where you keep them 
is up to you.  Keeping them in Tumbolia and computing them out as 
required will work well.

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


Get the numbering of named regex groups

2015-04-08 Thread Mattias Ugelvik
Example: re.match('(?Pfirsta?)(?Psecondb?)', '')

How can I find out that the group 'first' correlates to the positional
regex group 1? I need to know this to resolve crucial ambiguities in a
string manipulation tool I'm making. Looking at spans, as the example
above illustrates, won't do the job.

I can't see a way to do this through the documented interface (at
least not in the `re` module?). An algorithm involving searching for
'(' in the regular expression strings requires dealing with
parentheses in square brackets somehow + non-capturing groups in order
not to create rare bugs (the most dangerous of bugs).

If it's possible to get access to a regex AST, then I'm willing to
work with that (if the structure is stable), as it's quite important
that I solve this problem. I might be willing to drop Python2.7
support.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Code critique please

2015-04-08 Thread Robert Kern

On 2015-04-08 01:54, Mark Lawrence wrote:

On 07/04/2015 23:43, kai.pet...@gmail.com wrote:

I just wrote this bit (coming from Pascal) and am wondering how seasoned
Python programmers would have done the same? Anything terribly non-python?

As always, thanks for all input.

import os, sys
from PIL import Image, ImageFont, ImageDraw



As you've had plenty of answers I'll just say that PIL is pretty old now.  Are
you aware of the fork called Pillow? https://pillow.readthedocs.org/


Pillow uses the name PIL for its package name too, in the interest of being 
drop-in compatible.


https://pillow.readthedocs.org/porting-pil-to-pillow.html

--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

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


[issue23887] HTTPError doesn't have a good repr representation

2015-04-08 Thread Berker Peksag

Berker Peksag added the comment:

HTTPError.__str__ already provides useful information: ``'HTTP Error %s: %s' % 
(self.code, self.msg)``, but since the change is minimal and useful, here is a 
patch.

--
components: +Library (Lib)
keywords: +patch
nosy: +berker.peksag
stage:  - patch review
type:  - enhancement
versions: +Python 3.5 -Python 3.4
Added file: http://bugs.python.org/file38863/issue23887.diff

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



[issue23882] unittest discovery and namespaced packages

2015-04-08 Thread Eric Snow

Eric Snow added the comment:

Is there any reason for unittest to not use pkgutil.iter_modules or 
pkgutil.walk_packages?  Either should work.

--

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



Automate deployment of Python application from multiple VCS repositories

2015-04-08 Thread Matt
This seems highly do-able with Ansible. They have a git module, if that's your 
VCS, that fits in here perfectly. 

I would make two lists of variables, the first for repo URL/branch info and the 
second for their destinations. Then Ansible uses simple YAML to write the 
commands. Here's an overly simplified version that I'm typing up quick on my 
phone:

- for each item in /git_variables.yml
  git clone {{ host }} {{ branch }} {{ destination }}

Relevant info is here:
http://docs.ansible.com/playbooks_variables.html
http://docs.ansible.com/playbooks_loops.html
http://docs.ansible.com/git_module.html

I'm in #python and #ansible as heatmeiser if you need any low level detail. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to find out which named regular expression group corresponds to which positional regex group

2015-04-08 Thread Damien Wyart
* Mattias Ugelvik ugle...@gmail.com in comp.lang.python:
 I'm making a string manipulation tool in which I need to know this
 correlation.
 Take this example: re.match('(?Pfirsta?)(?Psecondb?)', '')
 I need to know that 'first' is group #1, and 'second' is group #2.
 I need this to resolve certain ambiguities.

Building a mapping between the results of groups and groupdict on the
match object should be quite straightforward.

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


Re: Automate deployment of Python application from multiple VCS repositories

2015-04-08 Thread Michael Herman
Hi Ben,

I would start with Fabric. - http://www.fabfile.org/. It's low-level,
but super straightforward.

Here's a blog post on how to setup deployment -
https://realpython.com/blog/python/kickstarting-flask-on-ubuntu-setup-and-deployment/

On Tue, Apr 7, 2015 at 7:24 PM, Ben Finney ben+pyt...@benfinney.id.au
wrote:

 Howdy all,

 What tools are available to automate deployment of a Python application
 comprising many discrete modules, spread across different code bases in
 different VCS repositories?

 My idea is to have a single definition (itself under VCS control) that
 specifies VCS locations and branches, a hierarchy into which all the
 modules fit, and a deployment host.

 host foo:
 repo ‘spam-common URL’, branch ‘trunk’, at ‘./common/’
 repo ‘beans URL’, branch ‘version 6.1’, at ‘./’
 repo ‘sausage URL’, branch ‘trunk’, at ‘./third-party/sausage/’

 host bar:
 repo ‘spam-common URL’, branch ‘maint’, at ‘./common/’
 repo ‘beans URL’, branch ‘version 7.0’, at ‘./’
 repo ‘eggs URL’, branch ‘master’, at ‘./third-party/eggs/’
 repo ‘toast URL’, branch ‘trunk’, at ‘./third-party/eggs/toast/’
 repo ‘sausage URL’, branch ‘version 1.4’, at
 ‘./third-party/sausage/’

 The deployment tool, when told which host specification to use, then
 gathers the code by exporting it from its disparate branches, fits it
 into the directory hierarchy, and deploys that to the specified host.

 The goal is to be able to have multiple host specifications, each of
 which needs a different set of code repositories (and often different
 branches within those repositories) to be built into the deployed
 application.

 What frameworks are there to do this for Python code?

 --
  \   “Know what I hate most? Rhetorical questions.” —Henry N. Camp |
   `\   |
 _o__)  |
 Ben Finney

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

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


[issue23888] Fixing fractional expiry time bug in cookiejar

2015-04-08 Thread ssh

New submission from ssh:

If the FileCookieJar reads a cookie whose expiry time is a decimal fraction, it 
crashes.

Chrome extensions cookies.txt and EdiThisCookie export the expiry time as 
decimal fractions. This is accepted by wget and curl, but not by the 
FileCookieJar which ends up crashing.

I made a StackOverflow question checking if fractional decimal expiry times 
were even allowed (if it was a bug in the extensions), but didn't get a 
response: 
https://stackoverflow.com/questions/29502672/can-the-cookie-expires-field-be-a-decimal-value

At any rate, this patch should make the library more robust.

--
components: Library (Lib)
files: mywork.patch
keywords: patch
messages: 240265
nosy: serhiy.storchaka, ssh
priority: normal
severity: normal
status: open
title: Fixing fractional expiry time bug in cookiejar
type: crash
versions: Python 3.5
Added file: http://bugs.python.org/file38864/mywork.patch

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



Re: Get the numbering of named regex groups

2015-04-08 Thread Peter Otten
Mattias Ugelvik wrote:

 Example: re.match('(?Pfirsta?)(?Psecondb?)', '')
 
 How can I find out that the group 'first' correlates to the positional
 regex group 1? I need to know this to resolve crucial ambiguities in a
 string manipulation tool I'm making. Looking at spans, as the example
 above illustrates, won't do the job.
 
 I can't see a way to do this through the documented interface (at
 least not in the `re` module?). 

Compile and match in two separate steps:

 import re
 r = re.compile('(?Pfirsta?)(?Psecondb?)')

Find the groups' positions:

 r.groupindex
{'second': 2, 'first': 1}


Find the matching substrings:

 r.match(a).groupdict()
{'second': '', 'first': 'a'}

https://docs.python.org/2.7/library/re.html#re.RegexObject.groupindex


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


Why PyINCREF on _PyFalseStruct and _PyTrueStruct?

2015-04-08 Thread Shiyao Ma
Hi.

While reading the rich_compare of PyLongObject, I noticed this line:

https://hg.python.org/cpython/file/a49737bd6086/Objects/longobject.c#l2785

It increments the ob_ref of the builtin True/False object.

Initializing the ob_ref of True/False to one so that they won't be
garbage collected if fair enough. Why do we increment it?

I don't see the reason behind it, since these two objects should
always stay in the memory and never participate the garbage collecting
system.


Regards.

-- 

吾輩は猫である。ホームーページはhttp://introo.me。
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23021] Get rid of references to PyString in Modules/

2015-04-08 Thread Berker Peksag

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


--
resolution:  - out of date
stage: needs patch - resolved
status: open - closed

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



[issue23863] Fix EINTR Socket Module issues in 2.7

2015-04-08 Thread Jeff McNeil

Jeff McNeil added the comment:

Missed check on _ex func.

--
Added file: http://bugs.python.org/file38865/socket_eintr.2.patch

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



Re: Get the numbering of named regex groups

2015-04-08 Thread Mattias Ugelvik
Thank god it's that easy! Err, I mean, thank you! I should have read
the docs more carefully :)

On 08/04/2015, Peter Otten __pete...@web.de wrote:
 Mattias Ugelvik wrote:

 Example: re.match('(?Pfirsta?)(?Psecondb?)', '')

 How can I find out that the group 'first' correlates to the positional
 regex group 1? I need to know this to resolve crucial ambiguities in a
 string manipulation tool I'm making. Looking at spans, as the example
 above illustrates, won't do the job.

 I can't see a way to do this through the documented interface (at
 least not in the `re` module?).

 Compile and match in two separate steps:

 import re
 r = re.compile('(?Pfirsta?)(?Psecondb?)')

 Find the groups' positions:

 r.groupindex
 {'second': 2, 'first': 1}


 Find the matching substrings:

 r.match(a).groupdict()
 {'second': '', 'first': 'a'}

 https://docs.python.org/2.7/library/re.html#re.RegexObject.groupindex


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

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


[issue23027] test_warnings fails with -Werror

2015-04-08 Thread Berker Peksag

Berker Peksag added the comment:

Removing issue 18383 from dependencies since the bug is also reproducible on 
the 3.4 branch. This issue only applies to the default branch.

--
dependencies:  -test_warnings modifies warnings.filters when running with -W 
default
resolution:  - fixed
stage: commit review - resolved
status: open - closed
versions:  -Python 3.4

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



[issue23400] Inconsistent behaviour of multiprocessing.Queue() if sem_open is not implemented

2015-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 749fd043de95 by Berker Peksag in branch '3.4':
Issue #23400: Raise same exception on both Python 2 and 3 if sem_open is not 
available.
https://hg.python.org/cpython/rev/749fd043de95

New changeset a49737bd6086 by Berker Peksag in branch 'default':
Issue #23400: Raise same exception on both Python 2 and 3 if sem_open is not 
available.
https://hg.python.org/cpython/rev/a49737bd6086

--
nosy: +python-dev

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



[issue23888] Fixing fractional expiry time bug in cookiejar

2015-04-08 Thread Demian Brecht

Changes by Demian Brecht demianbre...@gmail.com:


--
nosy: +demian.brecht

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



Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 15:40:46 UTC+2 skrev Mel Wilson:
 On Tue, 07 Apr 2015 23:19:49 -0700, jonas.thornvall wrote:
 
  And you have just created 429496729 unique symbols ;), in a pencil
  stroke.
 
 No.  You did that, when you said base 429496729.  Representing the 
 symbols in a computer is no problem, any Python long int can do that.  To 
 display the symbols, you can use PIL to make up glyphs out of coloured 
 pixels 864x864.  You can keep your glyphs in GIFs.  Where you keep them 
 is up to you.  Keeping them in Tumbolia and computing them out as 
 required will work well.

Well many interpretate a numeral digit as a single unique symbol representing a 
number written out in one pensttroke. I just pointed out that using handwriting 
or underscore a compination can be considered a numerical digit in itself.

There is no need for inventing a new set of characters representing 32-bit 
numbers. You will not be able to learn them by heart anyway, unless they build 
on a interpretation system binaries, decimals. 

Of course you could rather easily create a new set building on Points and lines 
and their interpretation.

Well just saying the Babylonians and Sumerians already did this, even the old 
greek had some sort of system with 120 unique digits. But what would be the 
need for such system when we so easy can create a unique permutation 
representing any number, using our 10 digits.

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


Re: Best search algorithm to find condition within a range

2015-04-08 Thread Ian Kelly
On Tue, Apr 7, 2015 at 7:18 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 On Wed, 8 Apr 2015 10:38 am, Steven D'Aprano wrote:

 On Wed, 8 Apr 2015 03:44 am, Ian Kelly wrote:



 to_base(2932903594368438384328325832983294832483258958495845849584958458435439543858588435856958650865490,
 429496729)
 [27626525, 286159541, 134919277, 305018215, 329341598, 48181777,
 79384857, 112868646, 221068759, 70871527, 416507001, 31]


 They're not exactly *digits* though, are they?

 Oh, I forgot... I think this is why Python long ints effectively uses a base
 256 internal storage. If memory serves me correctly, internally a long int
 is stored as an array of bytes using digits:

 \x0 \x1 \x2 ... \xFF

 (in decimal, 0 to 255). Each digit takes a single byte, so it's nicely
 compact, and Python includes a bunch of fast algorithms for doing
 arithmetic on these.

According to the comments in longintrepr.h, Python uses either 15- or
30-bit digits, determined at configure time.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23027] test_warnings fails with -Werror

2015-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e64197dad303 by Berker Peksag in branch 'default':
Issue #23027: test_warnings now passes all tests when run it with -Werror.
https://hg.python.org/cpython/rev/e64197dad303

--
nosy: +python-dev

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



[issue23887] HTTPError doesn't have a good repr representation

2015-04-08 Thread Demian Brecht

Demian Brecht added the comment:

A test really should be added for this. Otherwise, LGTM.

--
nosy: +demian.brecht

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



Re: Best search algorithm to find condition within a range

2015-04-08 Thread Ian Kelly
On Wed, Apr 8, 2015 at 1:28 AM,  jonas.thornv...@gmail.com wrote:
 Den onsdag 8 april 2015 kl. 09:16:24 UTC+2 skrev Ian:
 On Tue, Apr 7, 2015 at 4:35 PM,  jonas.thornv...@gmail.com wrote:
  I am not sure you guys realised, that althoug the size of the factors to 
  muliply expands according to base^(exp+1) for each digitplace the number 
  of comparissons needed to reach the digit place (multiple of base^exp+1) 
  is constant with my approach/method.

 No it isn't. You do one comparison on every iteration of your while
 loop, and you do one iteration for every digit. How is that constant?

 Ok the number of comparissons is linear for each digitplace not exponential.

In other words, the first part of your algorithm where you find the
largest digit place takes O(log n) operations. But the second part
where you do a search for each digit takes O(b * log n) operations, so
the overall number of operations is O(b * log n). If you replace the
linear search with a binary search, that's still O(log b * log n).

Meanwhile, the division method that I and others have repeatedly
suggested does only one comparison and one division per digit, which
is just O(log n).

Note that this analysis doesn't take into account the complexity of
the individual arithmetic operations, but that should affect either
algorithm equally.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23400] Inconsistent behaviour of multiprocessing.Queue() if sem_open is not implemented

2015-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c2f6b3677630 by Berker Peksag in branch '2.7':
Issue #23400: Add notes about the sem_open support of the host OS to
https://hg.python.org/cpython/rev/c2f6b3677630

--

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



[issue23400] Inconsistent behaviour of multiprocessing.Queue() if sem_open is not implemented

2015-04-08 Thread Berker Peksag

Berker Peksag added the comment:

Fixed. Thank you all (and sorry for my late commit, Davin).

--
resolution:  - fixed
stage: commit review - resolved
status: open - closed

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



[issue23863] Fix EINTR Socket Module issues in 2.7

2015-04-08 Thread Jeff McNeil

Jeff McNeil added the comment:

So, yeah, that's right. In the attached patch, I'm closing the file descriptor 
if the timeout/error happens on a non-blocking call.  It fails with an EBADF on 
reconnect at that point, but it doesn't potentially leave an FD in the proc's 
file table.

Should be no more EINTR's coming out of the select call.

--

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



[issue23890] assertRaises increases reference counter

2015-04-08 Thread Vjacheslav Fyodorov

New submission from Vjacheslav Fyodorov:

Sometimes unittest's assertRaises increases reference counter of callable. This 
can break tests in tricky cases. Not seen in 2.X version. Demo file attached.

--
components: Library (Lib)
files: test_assertRaises.py
messages: 240280
nosy: Vjacheslav.Fyodorov
priority: normal
severity: normal
status: open
title: assertRaises increases reference counter
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file38866/test_assertRaises.py

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



[issue22970] Cancelling wait() after notification leaves Condition in an inconsistent state

2015-04-08 Thread David Coles

David Coles added the comment:

This issue can still be reproduced on Python 3.5.0a1.
(Triggers a RuntimeError: Lock is not acquired on cond.release())

Please let me know if there's any further steps you'd like me to take here.

--
versions: +Python 3.5

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



[issue23891] Tutorial doesn't mention either pip or virtualenv

2015-04-08 Thread A.M. Kuchling

New submission from A.M. Kuchling:

(from discussion at the 2015 Python Language Summit)

Current versions of Python make it relatively easy to install third-party 
packages such as requests.  New users may not realize this, though, and 
continue using libraries such as urllib/urllib2 because they're in the stdlib.

The Python tutorial doesn't seem to mention either virtualenv or pip. It 
should, describing how to create a virtualenv, install packages, and manage 
them in basic ways (removing, 'pip freeze', requirements.txt.)

--
assignee: akuchling
components: Documentation
messages: 240281
nosy: akuchling
priority: normal
severity: normal
status: open
title: Tutorial doesn't mention either pip or virtualenv
type: enhancement
versions: Python 3.5

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



[issue23807] Improved test coverage for calendar.py command line

2015-04-08 Thread Thana Annis

Thana Annis added the comment:

Thanks for the quick response. You're right that this is already being tested 
for, so I will close the issue.

--
resolution:  - not a bug
status: open - closed

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



Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 19:34:39 UTC+2 skrev Mel Wilson:
 On Wed, 08 Apr 2015 07:56:05 -0700, jonas.thornvall wrote:
 
  There is no need for inventing a new set of characters representing
  32-bit numbers. You will not be able to learn them by heart anyway,
  unless they build on a interpretation system binaries, decimals.
 
 See Jorge Luis Borges, _Funes the Memorious_.  Gotta keep up with the 
 literature.

One thing is true though the bigger the chunks the less operations doing add.
So arithmetic may turn out to be obsolete and replaced with search in 
lookuptables.

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


[issue23807] Improved test coverage for calendar.py command line

2015-04-08 Thread Berker Peksag

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


--
stage: patch review - resolved

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



Re: Best search algorithm to find condition within a range

2015-04-08 Thread jonas . thornvall
Den onsdag 8 april 2015 kl. 21:28:34 UTC+2 skrev jonas.t...@gmail.com:
 Den onsdag 8 april 2015 kl. 19:34:39 UTC+2 skrev Mel Wilson:
  On Wed, 08 Apr 2015 07:56:05 -0700, jonas.thornvall wrote:
  
   There is no need for inventing a new set of characters representing
   32-bit numbers. You will not be able to learn them by heart anyway,
   unless they build on a interpretation system binaries, decimals.
  
  See Jorge Luis Borges, _Funes the Memorious_.  Gotta keep up with the 
  literature.
 
 One thing is true though the bigger the chunks the less operations doing add.
 So arithmetic may turn out to be obsolete and replaced with search in 
 lookuptables.

When doing by hand and working within the digitspace of a single decimal digit 
like 3+4 the operation is implicit. You do not really add anything you use a 
lookup table.

But if you take an expression like 193+169, most people perform the arithmetic. 
Unless they do not happen to be your favourit numbers and you learnt the sum by 
heart.

Top down or bottom up is basicly the choices.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue15443] datetime module has no support for nanoseconds

2015-04-08 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Python 2 line is closed for new features, but you can start with the main line 
Lib/datetime.py which will probably work with python 2.7.9 after some minor 
tweaks.  You should be able to publish the result on PyPI.  Note that many new 
in 3.x modules are provided for 2.x this way.

--

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



[issue15443] datetime module has no support for nanoseconds

2015-04-08 Thread Steve

Steve added the comment:

Although I don't know what I am doing (patching python), if someone could point 
me to the relevant files in 2.7.9 that need to be patched, I'm willing to see 
if I can do it.

--

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



[issue15443] datetime module has no support for nanoseconds

2015-04-08 Thread mdcb

mdcb added the comment:

Alexander,

The initial patch is indeed minimal. If it gains momentum and some level of 
acceptation, I'd be happy to do more amends and fixes as needed and recommended.

As for 2.7.9 - I'm not sure it makes much sense going PyPI patch if it's not 
going to happen on 3.x?

--

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



[issue23893] Forward-port future_builtins

2015-04-08 Thread Brett Cannon

New submission from Brett Cannon:

future_builtins exists in Python 2.7, but not Python 3 which is annoying for 
code that wants to rely on it in Python 2.7 but not 2to3 (who is the primary 
user of the module for rewrite rules).

--
components: Library (Lib)
messages: 240287
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: Forward-port future_builtins
type: enhancement
versions: Python 3.5

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



[issue23893] Forward-port future_builtins

2015-04-08 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
assignee:  - brett.cannon

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



[issue23893] Forward-port future_builtins

2015-04-08 Thread Brett Cannon

Brett Cannon added the comment:

Since the module is literally `from builtins import ascii, filter, hex, map, 
oct, zip`, I have attached the test file (which is also ridiculously simple).

--
nosy: +eric.smith
stage: test needed - patch review
Added file: http://bugs.python.org/file38870/test_future_builtins.py

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



[issue23199] libpython27.a in amd64 release is 32-bit

2015-04-08 Thread Zachary Ware

Zachary Ware added the comment:

Steve: is this fixed and ready for next time?

--
resolution:  - fixed
stage:  - resolved
status: open - pending

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



[issue15443] datetime module has no support for nanoseconds

2015-04-08 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

I have no doubt this will get into 3.x once we have a working patch and 
backward compatibility issues are addressed.  Given the amount of effort Victor 
has recently put in #22117 to rework CPython internal time handling to support 
nanoseconds, it will be odd not to support nanoseconds in datetime.

On the substance, in your patch you have chosen to add nanoseconds as a 
separate field instead of changing microseconds to nanoseconds.  I don't think 
this is the right approach.  See msg223082.  Once you get to implementing 
timedelta arithmetics, you will see that carrying two subsecond fields will 
unnecessarily complicate the code.

--

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



[issue9517] Make test.script_helper more comprehensive, and use it in the test suite

2015-04-08 Thread R. David Murray

R. David Murray added the comment:

Script helpers has been made more discoverable by moving it into the 
test.support namespace, but it has not been documented in the test.support 
docs.  I can no longer remember if this is intentional or not.  Regardless, 
this issue is still valid insofar as there are probably a number of places in 
the test suite where script_helpers can be used that they aren't being used.  
We probably don't want a multi-module changeset, though, so this could become a 
meta issue for new issues for converting particular test files to use 
script_helpers.

--

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



[issue19561] request to reopen Issue837046 - pyport.h redeclares gethostname() if SOLARIS is defined

2015-04-08 Thread John Beck

John Beck added the comment:

We (Solaris engineering) have hit this issue after migrating from 2.6
being our default version of Python to 2.7 being the default.  The
specific component that broke was vim (version 7.4), trying to compile
if_python.c:

/usr/include/python2.7/pyport.h, line 645: identifier redeclared:
gethostname 
 
current : function(pointer to char, int) returning int  
 
previous: function(pointer to char, unsigned long) returning int :  
 
/usr/include/unistd.h, line 412   
 

We had this patched out in Python 2.6's Include/pyport.h:

-#ifdef SOLARIS
-/* Unchecked */
-extern int gethostname(char *, int);
-#endif

but for some reason that patch was not propagated to our 2.7 line.
Until today, that is; I will be applying that patch shortly to both
2.7 and 3.4.

--
nosy: +jbeck

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



[issue21411] Enable Treat Warning as Error on 32-bit Windows

2015-04-08 Thread Zachary Ware

Zachary Ware added the comment:

This has been complicated by the migration to VS2015, which added a bunch of 
new warnings.  Obviously we can't enable this now without either fixing all the 
warnings (unlikely, I think; most of them are just about shadowing vars) or 
disabling particular ones.

So at this point, fix, disable, or reject?

--
nosy: +paul.moore, steve.dower

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



[issue23670] Modifications to support iOS as a cross-compilation target

2015-04-08 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
assignee:  - ned.deily
stage:  - patch review
versions: +Python 3.5 -Python 3.4

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



[issue23893] Forward-port future_builtins

2015-04-08 Thread Eric V. Smith

Eric V. Smith added the comment:

Looks good to me.

I realize it's trivial, but is it worth putting this on PyPI for older 3.x's?

--

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



[issue23893] Forward-port future_builtins

2015-04-08 Thread Brett Cannon

Brett Cannon added the comment:

I now have a patch that contains everything, including docs.

--
keywords: +patch
Added file: http://bugs.python.org/file38871/future_builtins.diff

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



[issue23886] faulthandler_user should use _PyThreadState_Current

2015-04-08 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +haypo

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



[issue23893] Forward-port future_builtins

2015-04-08 Thread Brett Cannon

Brett Cannon added the comment:

It could go on PyPI if I make sure it doesn't shadow the module in Python 3.5 
or 2.6/2.7.

--

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



[issue16991] Add OrderedDict written in C

2015-04-08 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
nosy: +eric.smith

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



[issue23865] Fix possible leaks in close methods

2015-04-08 Thread Martin Panter

Martin Panter added the comment:

Okay, I think I get it. You are setting some attributes to None, in case they 
happen to be causing a reference cycle. When close() is called, they are no 
longer needed, so it might help to breaking potential reference cycles. I have 
often wondered why this was done. I always assumed it was a carry-over from old 
code relying on the garbage collector to automatically close files, etc.

--

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



[issue15443] datetime module has no support for nanoseconds

2015-04-08 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Matthieu,

I don't see you adding nanoseconds to timedelta in your patch.  Doesn't this 
mean that you would loose nanoseconds when you subtract one datetime from 
another?

To anyone who wants to contribute to this effort, I would recommend starting 
with pure python implementation in Lib/datetime.py .

--

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



[issue23890] assertRaises increases reference counter

2015-04-08 Thread R. David Murray

R. David Murray added the comment:

This is presumably a result of the exception object being saved on the context 
manager object and there being a circular reference chain that doesn't 
immediately get GCed.  This is just how python works.

I don't know if it would be sensible/useful to use the new lightweight 
traceback stuff in assertRaises.  If so it would probably have to be optional 
for backward compatibility reasons.

--
nosy: +r.david.murray
type: behavior - enhancement
versions: +Python 3.5 -Python 3.4

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



[issue23796] BufferedReader.peek() crashes if closed

2015-04-08 Thread John Hergenroeder

John Hergenroeder added the comment:

Thanks!

I submitted my contributor agreement form last week -- is there anything I can 
do to improve this patch while I wait for that to process?

--

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



[issue23892] Introduce sys.implementation.opt_levels ?

2015-04-08 Thread Brett Cannon

New submission from Brett Cannon:

Eric suggested in a code review for issue #23731 that maybe we should have the 
possible optimization levels listed somewhere.

--
components: Library (Lib)
messages: 240286
nosy: brett.cannon, eric.snow
priority: low
severity: normal
stage: test needed
status: open
title: Introduce sys.implementation.opt_levels ?
type: enhancement
versions: Python 3.5

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



[issue23892] Introduce sys.implementation.opt_levels

2015-04-08 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
dependencies: +Implement PEP 488
title: Introduce sys.implementation.opt_levels ? - Introduce 
sys.implementation.opt_levels

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



[issue11205] Evaluation order of dictionary display is different from reference manual.

2015-04-08 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
priority: low - high

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



[issue23731] Implement PEP 488

2015-04-08 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


Added file: http://bugs.python.org/file38869/d4fde2493736.diff

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



[issue8027] distutils fail to determine c++ linker with unixcompiler if using ccache

2015-04-08 Thread Joshua J Cogliati

Joshua J Cogliati added the comment:

I looked and the autoconf variable for the c++ linker is CXXLINK, so I think 
the proper way to fix this would be to change sysconfig.py to look at both 
CXXFLAGS and CXXLINK, and create those and use it to define a cxxlink variable, 
and only if they are missing should we actually try to do some of the magic 
that is currently used.

Also, my patches (fix-distutils-*.patch) do not always work, because sometimes 
the c compiler cannot link the c++ code.

--

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



[issue1182143] making builtin exceptions more informative

2015-04-08 Thread George Jenkins

George Jenkins added the comment:

Add patch generated via mercurial

--
Added file: http://bugs.python.org/file38872/Issue1182143_1hg.patch

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



[issue23670] Modifications to support iOS as a cross-compilation target

2015-04-08 Thread Ned Deily

Ned Deily added the comment:

Russell, we talked a bit about this topic at the Python Language Summit today 
(after watching your excellent video).  I think there was general agreement 
there that having iOS support would be a good thing along with the 
recognition that the requirements for support of a mobile platform like iOS 
differ in some significant ways from most traditional platforms that Python has 
supported.  I agreed to shepherd this issue.  I have some initial thoughts but 
will write up something more detailed shortly.

--

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



[issue3566] httplib persistent connections violate MUST in RFC2616 sec 8.1.4.

2015-04-08 Thread Martin Panter

Martin Panter added the comment:

Your tweaks look fine. Thanks everyone for working through this one.

--

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



Re: Best search algorithm to find condition within a range

2015-04-08 Thread Mark Lawrence

On 08/04/2015 20:28, jonas.thornv...@gmail.com wrote:

Den onsdag 8 april 2015 kl. 19:34:39 UTC+2 skrev Mel Wilson:

On Wed, 08 Apr 2015 07:56:05 -0700, jonas.thornvall wrote:


There is no need for inventing a new set of characters representing
32-bit numbers. You will not be able to learn them by heart anyway,
unless they build on a interpretation system binaries, decimals.


See Jorge Luis Borges, _Funes the Memorious_.  Gotta keep up with the
literature.


One thing is true though the bigger the chunks the less operations doing add.
So arithmetic may turn out to be obsolete and replaced with search in 
lookuptables.



I suggest that you put this on python ideas before writing up a PEP, it 
seems like a sure fire winner to me.


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


[issue23713] intermittent failure of multiprocessing unit test test_imap_unordered_handle_iterable_exception

2015-04-08 Thread Davin Potts

Davin Potts added the comment:

Serhiy: If I understand correctly what you suggest, calling sorted(it) or 
list(it) would run the iterator all the way until it raises the SayWhenError 
exception, triggering the self.assertRaises before it ever actually gets to 
call the self.assertEqual or self.assertCountEqual you suggest.  It would 
indeed test the raising of the exception but would never test individual values 
returned by the iterator to see that they belong.

Or were you suggesting something different?

--

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



[issue23484] SemLock acquire() keyword arg 'blocking' is invalid

2015-04-08 Thread Davin Potts

Davin Potts added the comment:

Updating patch for default/3.5 and 3.4 branches to remove versionchanged 
message on {Lock,RLock}.acquire per feedback from @berker.

--
Added file: 
http://bugs.python.org/file38867/issue_23484_doc_locks_py35_and_py34_noverchange.patch

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



  1   2   >