[issue10225] Fix doctest runable examples in python manual

2016-07-12 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +andymaier, belopolsky, docs@python, eric.araujo, ezio.melotti, 
georg.brandl, lukasz.langa, rhettinger, terry.reedy -lissacoffeyx

___
Python tracker 

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



[issue10225] Fix doctest runable examples in python manual

2016-07-12 Thread Berker Peksag

Changes by Berker Peksag :


--
Removed message: http://bugs.python.org/msg270297

___
Python tracker 

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



[issue10225] Fix doctest runable examples in python manual

2016-07-12 Thread lissacoffeyx

lissacoffeyx added the comment:

I had a thought that it made the template more readable, but the better 
solution was to just use real newlines instead of '\n'. 

Thanks
http://www.fixithere.net/sky-customer-service/

--
nosy: +lissacoffeyx -andymaier, belopolsky, docs@python, eric.araujo, 
ezio.melotti, georg.brandl, lukasz.langa, rhettinger, terry.reedy

___
Python tracker 

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



Re: Were is a great place to Share your finished projects?

2016-07-12 Thread Chris Angelico
On Wed, Jul 13, 2016 at 2:42 PM, Ben Finney  wrote:
> Chris Angelico  writes:
>
>> On Wed, Jul 13, 2016 at 11:28 AM, Ben Finney  
>> wrote:
>> > Pull requests. Code review. Issues. Integration with other services.
>> > All the social information around all of those interactions, and
>> > more.
>> >
>> > If *any* of that is valuable, then yes it's important that it not be
>> > locked to any one vendor.
>>
>> Exactly how important? Not so important as to stop slabs of Python
>> from migrating to GitHub, including its pull request system.
>
> I maintain that it is important enough to stop that.
>
> The migration happened anyway, because not everyone is convinced of the
> importance of avoiding vendor lock-in of valuable data, over criteria
> such as “this person happens to like Vendor-locked Solution Foo”.
>

Fine. You're welcome to take a 100% philosophical stance; I applaud
you for it. (I understand Richard Stallman is so adamant about not
using *any* non-free code - software or firmware - that he restricts
himself to a tiny selection of laptops that have free BIOSes.)
Personally, I believe practicality beats purity in computing
philosophy as well as API design, and I'll happily let GitHub carry my
software. What's the worst that can happen? I have to switch to
somewhere else, and I lose the issue tracker and pull requests. In the
case of CPython, they wouldn't even be lost - they're (to be) backed
up. In the meantime, I'm on a well-polished platform with a large
number of users. The same cannot be said for *many* other hosts, even
if they do use exclusively free software.

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


Re: Were is a great place to Share your finished projects?

2016-07-12 Thread Ben Finney
Chris Angelico  writes:

> On Wed, Jul 13, 2016 at 11:28 AM, Ben Finney  
> wrote:
> > Pull requests. Code review. Issues. Integration with other services.
> > All the social information around all of those interactions, and
> > more.
> >
> > If *any* of that is valuable, then yes it's important that it not be
> > locked to any one vendor.
>
> Exactly how important? Not so important as to stop slabs of Python
> from migrating to GitHub, including its pull request system.

I maintain that it is important enough to stop that.

The migration happened anyway, because not everyone is convinced of the
importance of avoiding vendor lock-in of valuable data, over criteria
such as “this person happens to like Vendor-locked Solution Foo”.

There are other projects considering such a migration; I am hopeful they
can still be reasoned with.

-- 
 \  “Begin with false premises and you risk reaching false |
  `\   conclusions. Begin with falsified premises and you forfeit your |
_o__)  authority.” —Kathryn Schulz, 2015-10-19 |
Ben Finney

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


[issue25393] 'resource' module documentation error

2016-07-12 Thread Berker Peksag

Changes by Berker Peksag :


--
keywords: +easy
nosy: +berker.peksag
stage:  -> needs patch
type: enhancement -> behavior
versions: +Python 3.6

___
Python tracker 

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




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

2016-07-12 Thread Kushal Das

Kushal Das added the comment:

The NEWS file got a typo. Thanks for noticing that.
This change did require a lot of updates to the tests.
If rest of the people agrees to revert this change, then we should go ahead and 
do it. Just wondering if Raymond has anything to add.

--

___
Python tracker 

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



[issue27498] Regression in repr() of class object

2016-07-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



Re: Were is a great place to Share your finished projects?

2016-07-12 Thread Chris Angelico
On Wed, Jul 13, 2016 at 11:28 AM, Ben Finney  wrote:
> Pull requests. Code review. Issues. Integration with other services. All
> the social information around all of those interactions, and more.
>
> If *any* of that is valuable, then yes it's important that it not be
> locked to any one vendor.

Exactly how important? Not so important as to stop slabs of Python
from migrating to GitHub, including its pull request system. (Work in
progress; currently, PEPs are on GitHub, but the core interpreter
hasn't moved yet. See PEP 512.)

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


[issue27449] pip install --upgrade pip (Windows)

2016-07-12 Thread frank-e

frank-e added the comment:

Thanks, worked, most likely an error on my side (command line window without 
admin rights).

--

___
Python tracker 

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



[issue27133] python 3.5.1 will not compile because libffi module uses wrong CFLAGS

2016-07-12 Thread Martin Panter

Martin Panter added the comment:

In the original report you mentioned a linker error caused by not using “-m64” 
from CFLAGS. Perhaps would it make more sense to add LDFLAGS=“-m64”, or use 
CC=“cc -m64” instead? There is also Issue 27490 and Issue 22981, both 
apparently about setting the ABI with CFLAGS.

--
nosy: +martin.panter

___
Python tracker 

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



[issue22981] Use CFLAGS when extracting multiarch

2016-07-12 Thread Martin Panter

Martin Panter added the comment:

Why do you set CFLAGS=-m32? When I cross-compile a 32-bit Python on a 64-bit 
host, I set CC="gcc -m32" instead. (Otherwise, I would have to specify 
LDFLAGS="-m32" as well.)

--
components: +Build
nosy: +martin.panter

___
Python tracker 

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



[issue27490] ARM cross-compile: pgen built without $(CFLAGS) as $(LIBRARY) dependency

2016-07-12 Thread Martin Panter

Martin Panter added the comment:

I don’t know the details of how Python uses CFLAGS etc, but according to 

 and 
,
 the general convention may be that CFLAGS and LDFLAGS are only for _compiler_ 
and _linker_ flags respectively, and CFLAGS may not be used for a link step.

Why don’t you either use CC="arm-none-eabi-gcc -mfloat-abi=hard", or 
LDFLAGS="-mfloat-abi=hard"? If these options work for you, perhaps what we 
really need is better documentation of how to build Python.

Ideally I would also like to make it so that compiling pgen is not necessary. 
But I think we can only use Gnu Make extensions if they are harmless in other 
operating systems (e.g. we have to keep the makefile compatible with BSD Make, 
though maybe it is okay to require Gnu Make for cross compiling).

In  I left some rambling thoughts 
on ways to make the file regeneration like pgen does less automatic and more up 
to the user to control.

--
nosy: +martin.panter

___
Python tracker 

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



[issue19027] undefined symbol: _PyParser_Grammar

2016-07-12 Thread Martin Panter

Martin Panter added the comment:

The same $(GRAMMAR_H) dependency and touch command still exists today, so I 
suspect this is still valid (though I didn’t try to reproduce it). I think we 
need to figure out if you can write a proper makefile rule that handles a 
single command that updates two targets at once.

FWIW I don’t think “make touch” will currently help on Python 2, because it 
only affects two files that are generated by pgen (see also my comment in Issue 
19142).

--
nosy: +martin.panter
stage:  -> needs patch

___
Python tracker 

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



[issue27504] Missing assertion methods in unittest documentation

2016-07-12 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue19142] Cross-compile fails trying to execute foreign pgen on build host

2016-07-12 Thread Martin Panter

Martin Panter added the comment:

Since 2.7.12 and 3.5.2, pgen should not be executed when in cross-compilation 
mode, thanks to Issue 22359 and Issue 22625. So I suspect the main problem is 
basically solved now.

Even though it should no longer be used, pgen is still cross-compiled depending 
on the timestamps and “make touch”. (Evidence: 
Issue 27490.)

My guess of why “make touch” did not work for Trevor was that he was compiling 
Python 2. In this case, “make touch” was added in revision da3f4774b939, and 
still only affects two files, neither of which are generated by pgen. Maybe 
Python 2’s “make touch” rule could be expanded for other generated files 
including Include/graminit.h etc.

--
nosy: +martin.panter
superseder:  -> When cross-compiling, don’t try to execute binaries

___
Python tracker 

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



Re: Compression of random binary data

2016-07-12 Thread Steven D'Aprano
On Wed, 13 Jul 2016 03:35 am, jonas.thornv...@gmail.com wrote:

> No it is only compressible down to a limit given by the algorithm.

Right! Then there is data that you can't compress.

Suppose you have some data:

data = "ABABABABABAB...ABAB"

And you compress it "down to a limit":

x = compress(compress(compress(data)))
print(x)
=> prints "@nx7%k!b"

Now let's try again with something else:

data = "AABBB..."

And you compress it "down to a limit":

x = compress(compress(compress(compress(data
print(x)
=> prints "wu*$cS#k-pv32zx[&+r"


One more time:

data = "AABBAABBAABBAABBAABB"
x = compress(data)
print(x)
=> prints "g^x3@"


We agree on this. Now you say, "Give me some random data, anything at all,
and I'll compress it!", and I run a random number generator and out pops:

data = "@nx7%k!b"

or possibly:

data = "wu*$cS#k-pv32zx[&+r"

or:

data = "g^x3@"


and I say "Compress that!"

But we've already agreed that this is as compressed as you can possibly make
it. You can't compress it any more.

So there's *at least some* random data that you can't compress. Surely you
have to accept that. You don't get to say "Oh, I don't mean *that* data, I
mean only data that I can compress". Random data means its random, you
don't get to pick and choose between data you can compress and data that
you can't.

Now the tricky part is to realise that its not just short sequences of
random data that can't be compressed. The same applies for LONG sequences
to. If I give you a gigabyte of raw video, you can probably compress that a
fair bit. That's what things like x264 encoders do. The x265 encoder is
even better. But they're lossy, so you can't reverse them.

But if I give you a gigabyte of random data, you'll be lucky to find *any*
patterns or redundancies that allow compression. You might be able to
shrink the file by a few KB. And if you take that already compressed file,
and try to compress it again, well, you've already hit the limit of
compression. There no more redundancy left to remove.

It doesn't matter how clever you are, or what a "folding structure" is, or
how many times you iterate over the data. It's a matter of absolute
simplicity: the pigeonhole principle. You can't argue with the numbers.

If you start with a 100 digit decimal number, there are 10**100 different
pigeons. If you can compress down to a 6 digit decimal number, there are
10**6 pigeon holes. You cannot put 10*100 pigeons into 10**6 pigeon holes
without doubling up (which makes your compression lossly).

So either some numbers cannot be compressed, or some numbers are compressed
to the same result, and you can't tell which was the original. That's your
choice: a lossless encoder means some numbers can't be compressed, a lossy
encoder means you can't reverse the process exactly.





-- 
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: Quick poll: gmean or geometric_mean

2016-07-12 Thread Steven D'Aprano
On Wed, 13 Jul 2016 08:57 am, alister wrote:

> a US gallon is smaller than an Imperial Gallon
> a US Mile is shorter than an Imperial mile
> and probably most importantly (because it means they keep serving me
> short measures) a US pint is smaller than an Imperial Pint

That's okay, they charge you more to make up for it being smaller.




-- 
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: Quick poll: gmean or geometric_mean

2016-07-12 Thread Gene Heskett
On Tuesday 12 July 2016 21:42:44 Lawrence D’Oliveiro wrote:

> On Wednesday, July 13, 2016 at 10:58:14 AM UTC+12, alister wrote:
> > a US gallon is smaller than an Imperial Gallon
> > a US Mile is shorter than an Imperial mile
> > and probably most importantly (because it means they keep serving me
> > short measures) a US pint is smaller than an Imperial Pint
>
> I thought everything was bigger in the USA...

Only the lies the pols tell us thru the mainsleaze media we loosely call 
news.  And although Texas is indeed pretty good sized, they still use 
the std definition for a foot, mile or gallon.  Been there, checked it 
out personally.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27504] Missing assertion methods in unittest documentation

2016-07-12 Thread Mitchell Model

Mitchell Model added the comment:

My strong apology. I missed a section of the documentation. It didn't seem 
possible that they weren't there, but I made a mistake when I checked for them. 
Sorry.

> On Jul 12, 2016, at 9:15 PM, R. David Murray  wrote:
> 
> 
> R. David Murray added the comment:
> 
> If you are looking at the source, you can look at the source.  If you are 
> looking at the documentation, we believe they are all documented.  If you use 
> pydoc/help, they are all documented.
> 
> I can't find the phrase you cite, but 'assert methods' is correct: all of the 
> method names start with the word 'assert'.
> 
> If there are specific methods you think are *not* in the library reference 
> that you think should be, please give examples.  I suspect they will turn out 
> to be internal helper functions.
> 
> --
> nosy: +r.david.murray
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



Re: Quick poll: gmean or geometric_mean

2016-07-12 Thread Lawrence D’Oliveiro
On Wednesday, July 13, 2016 at 10:58:14 AM UTC+12, alister wrote:

> a US gallon is smaller than an Imperial Gallon
> a US Mile is shorter than an Imperial mile
> and probably most importantly (because it means they keep serving me 
> short measures) a US pint is smaller than an Imperial Pint

I thought everything was bigger in the USA...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: subprocess: xterm -c cat, need to send data to cat and have it displayed in the xterm window

2016-07-12 Thread Lawrence D’Oliveiro
On Tuesday, July 12, 2016 at 3:20:35 PM UTC+12, Veek. M wrote:
> I then need to get it translated which also works and then display in 
> XTerm using cat.


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


[issue27487] -m switch regression in Python 3.5.2 (under rare circumstances)

2016-07-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Oops, that PEP reference was meant to be PEP 451 (which added the __spec__ 
attribute and the concept of module specs as something distinct from the 
modules themselves)

--

___
Python tracker 

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



[issue27487] -m switch regression in Python 3.5.2 (under rare circumstances)

2016-07-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Breaking down a few of the moving parts here:

* Yes, modules replacing themselves in sys.modules as a side effect of import 
is supported behaviour (it's why the import system looks them up by name in 
sys.modules as the final step, rather than just returning whatever the loader 
returns)

* the dependency on __spec__ attributes is actually in importlib, where 
following PEP 351 Brett has been pushing hard to ensure modules always have a 
__spec__ attribute so the rest of the import system (including, indirectly, 
runpy) can rely on having it available (however, as seen here, not everything 
in sys.modules is going to be a module, so we may need to either keep more of 
the workarounds that help tolerate folks breaking that assumption, or else find 
a way to try to enforce it even for custom objects)

* explicitly copying __spec__ from the original module object to the 
replacement object (in Wolfgang's code) should indeed be enough to get the use 
case reported here restored to the way it behaved in 3.5.1

--

___
Python tracker 

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



[issue27505] Missing documentation for setting module __class__ attribute

2016-07-12 Thread Nick Coghlan

Changes by Nick Coghlan :


--
dependencies: +Improved handling of __class__ assignment

___
Python tracker 

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



[issue22986] Improved handling of __class__ assignment

2016-07-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Just noting I filed http://bugs.python.org/issue27505 regarding the lack of 
documentation for the new-in-Python-3.5 ability to set module __class__ 
attributes.

--

___
Python tracker 

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



[issue27505] Missing documentation for setting module __class__ attribute

2016-07-12 Thread Nick Coghlan

New submission from Nick Coghlan:

Python 3.5 added the ability to set module __class__ attributes by way of 
http://bugs.python.org/issue22986

However, this isn't covered in the What's New guide or anywhere else in the 
documentation, and even in the NEWS file it appears under the cryptic title 
"Issue #22986: Allow changing an object’s __class__ between a dynamic type and 
static type in some cases." for 3.5.0a1

This should be documented somewhere (perhaps in the data model section of the 
language reference?) and an example given of using the feature to emit 
DeprecationWarning for access to a particular module level attribute.

It should also be mentioned in the Python 3.5 What's New documentation.

--
assignee: docs@python
components: Documentation
messages: 270285
nosy: docs@python, ncoghlan, njs
priority: normal
severity: normal
stage: needs patch
status: open
title: Missing documentation for setting module __class__ attribute
type: enhancement
versions: Python 3.5, Python 3.6

___
Python tracker 

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



Re: Were is a great place to Share your finished projects?

2016-07-12 Thread Ben Finney
Christian Gollwitzer  writes:

> Am 01.07.16 um 03:38 schrieb Ben Finney:
> > If one wants to avoid vendor lock-in, Github is not best: the
> > workflow tools (other than Git itself) are completely closed and not
> > available for implementation on another vendor's servers.
>
> Yes, but that is relevant only if the workflow (i.e. pull requests)

Pull requests. Code review. Issues. Integration with other services. All
the social information around all of those interactions, and more.

If *any* of that is valuable, then yes it's important that it not be
locked to any one vendor.

If *none* of that is valuable, then why prefer GitHub? Clearly people do
find those quite valuable, and it is disingenuous to pretend that the
code is the only valuable thing in a Github repository.

-- 
 \ “The cost of a thing is the amount of what I call life which is |
  `\   required to be exchanged for it, immediately or in the long |
_o__)   run.” —Henry David Thoreau |
Ben Finney

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


[issue14977] mailcap does not respect precedence in the presence of wildcards

2016-07-12 Thread R. David Murray

R. David Murray added the comment:

How about this: rename the existing readmailcapfile as an internal 
_readmailcapfile with the new signature.  Then add a backward compatible 
readmailcapfile with the existing signature/return value that uses a dummy 
value for lineno and throws away the lineno on output.  The point here is just 
to avoid breaking programs that are using the existing api, even though it is 
an internal one.  Yes, it is cruft, but backward compatibility sometimes 
requires cruft.  We could deprecate the old api with a message that says it is 
an internal method and should not be used, and see if anyone complains about it 
being deprecated.

--

___
Python tracker 

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



[issue14977] mailcap does not respect precedence in the presence of wildcards

2016-07-12 Thread Michael Lazar

Michael Lazar added the comment:

I can certainly do that. Although in addition to adding a keyword argument, we 
would also have to change the return signature to switch between modes like 
this:

if lineno is None:
return caps
else:
return caps, lineno

Overall I'm not a fan of this technique and would like to avoid it if possible. 
The problem is that we have to keep track of the current line between 
successive calls to readmailcapfile(). An alternative would be to go back to 
using lineno as a generator. This is close to what I had in the initial patch.

lineno = itertools.count()
caps = readmailcapfile(fp, lineno=lineno)
caps = readmailcapfile(fp2, lineno=lineno)
caps = readmailcapfile(fp3, lineno=lineno)
...etc

Happy to hear any insights you have on this.

--

___
Python tracker 

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



Re: how raspi-idle3 configure?

2016-07-12 Thread Egon Mueller
It is a little bit helpful and very interesting, but answers to my 
question isn't available.

I have to search again.


Am 12.07.2016 um 20:33 schrieb memilanuk:

Egon Mueller  online.de> writes:


Where can read a beginner so simple things about handling the python 3
idle3? I don't think about python programming, only about better
handling the ide.



This link might be of some help...

https://hkn.eecs.berkeley.edu/~DYOO/python/idle_intro/index.html

HTH,

Monte




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


[issue27504] Missing assertion methods in unittest documentation

2016-07-12 Thread R. David Murray

R. David Murray added the comment:

If you are looking at the source, you can look at the source.  If you are 
looking at the documentation, we believe they are all documented.  If you use 
pydoc/help, they are all documented.

I can't find the phrase you cite, but 'assert methods' is correct: all of the 
method names start with the word 'assert'.

If there are specific methods you think are *not* in the library reference that 
you think should be, please give examples.  I suspect they will turn out to be 
internal helper functions.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27078] Make f'' strings faster than .format: BUILD_STRING opcode?

2016-07-12 Thread Demur Rumed

Demur Rumed added the comment:

Benchmarked f'X is {x}' with BUILD_TUPLE change:

Before: 6.62 usec per loop
After: 6.33 usec per loop

f'X is {x} {x+2} {x+3}'
Before: 15.1 usec per loop
After: 14.7 usec per loop

Attached patch

--
keywords: +patch
Added file: http://bugs.python.org/file43701/fstrtup.patch

___
Python tracker 

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



Announcing PyBidi

2016-07-12 Thread Lawrence D’Oliveiro
Just thought I’d mention PyBidi , my
Python 3 wrapper for all the functionality in FriBidi that I could
usefully find, that I threw together over the weekend.

I’m impressed that FriBidi doesn’t just do bidirectional
logical-to-visual rearrangement, but it will also perform contextual
substitutions for Arabic ligatures, which look (to my nonexpert eyes)
like they might be good enough for day-to-day written text, without
having to resort to HarfBuzz, or Pango, or sophisticated stuff like
that.

(Feel free to point out I’m wrong; the only language I have any
familiarity with that uses, or used to use, Arabic script, is Malay
written in the old “Jawi” script.)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27078] Make f'' strings faster than .format: BUILD_STRING opcode?

2016-07-12 Thread Demur Rumed

Demur Rumed added the comment:

The simplest perf fix is to first use BUILD_TUPLE instead of BUILD_LIST

timeit 'x=1;(x,x,x)'
0.36 usec per loop

timeit 'x=1;[x,x,x]'
0.425 usec per loop

Introducing a new opcode BUILD_STRING to inline PyTuple_New + PyUnicode_Join to 
replace BUILD_TUPLE + CALL_FUNCTION should benchmark against BUILD_TUPLE 
version, not BUILD_LIST + CALL_FUNCTION

--

___
Python tracker 

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



Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den onsdag 13 juli 2016 kl. 00:24:23 UTC+2 skrev Ian:
> On Tue, Jul 12, 2016 at 11:35 AM,   wrote:
> >
> > No it is only compressible down to a limit given by the algorithm.
> 
> Then your algorithm does not compress random data as you claimed.
> 
> For some input, determine the limiting output that it ultimately
> compresses down to. Take that output and feed it through your
> algorithm as if it were the original input. If the data are to be
> considered random, then this input is just as probable as the
> original. What output does the algorithm now create? If it just
> returns the input unchanged, then how do you discern the original
> input from this input when decompressing? If it returns a different
> output of the same size, then repeat the process with the new output.
> Now there are *two* outputs of that size that can't be repeated. There
> are only finitely many possible outputs of that size, so eventually
> you're going to have to get to one that either repeats an output -- in
> which case your algorithm produces the same output for two different
> inputs and is therefore incorrect -- or you will get to an input that
> produces an output *larger* in size than the original.

The later sounds reasonable that is start toggle between states.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den onsdag 13 juli 2016 kl. 00:24:23 UTC+2 skrev Ian:
> On Tue, Jul 12, 2016 at 11:35 AM,   wrote:
> >
> > No it is only compressible down to a limit given by the algorithm.
> 
> Then your algorithm does not compress random data as you claimed.
> 
> For some input, determine the limiting output that it ultimately
> compresses down to. Take that output and feed it through your
> algorithm as if it were the original input. If the data are to be
> considered random, then this input is just as probable as the
> original. What output does the algorithm now create? If it just
> returns the input unchanged, then how do you discern the original
> input from this input when decompressing? If it returns a different
> output of the same size, then repeat the process with the new output.
> Now there are *two* outputs of that size that can't be repeated. There
> are only finitely many possible outputs of that size, so eventually
> you're going to have to get to one that either repeats an output -- in
> which case your algorithm produces the same output for two different
> inputs and is therefore incorrect -- or you will get to an input that
> produces an output *larger* in size than the original.

The dataset must have a certain size that is the only requirment, of course you 
can not compress something into nothing, at least the arithmetic ruleset need 
to be encoded but what would be the point to just compress something less than 
a couple of bytes. And of course the number of rounds you applied the algorithm 
must be stored. But that is no problem for small datasets.

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


[issue27504] Missing assertion methods in unittest documentation

2016-07-12 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +ezio.melotti, michael.foord, rbcollins
versions: +Python 3.6 -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue27487] -m switch regression in Python 3.5.2 (under rare circumstances)

2016-07-12 Thread Martin Panter

Martin Panter added the comment:

In trying to understand this, I built a package with two simple files:

$ cat package/*.py
# package/__init__.py:
from . import module
# package/module.py:
import sys
sys.modules[__name__] = object()

With this I can reproduce your __spec__ error, and I see it works without error 
in 3.5.0 and 2.7.11. FWIW, with the current 3.3 branch, I get a different error:

/media/disk/home/proj/python/cpython/python: Error while finding loader for 
'package.module' (: 'object' object has no attribute 
'__loader__')

The revision that causes the regression is 3202d143a194. Since I made that 
change, I feel responsible for it. But I don’t have much time ATM to come up 
with an ideal solution. One quick solution would be to revert my change, but 
since this is an obscure use case, I am not enthusiastic about doing that :)

Is it possible to set the __spec__ attribute to work around the problem? I 
don’t really understand the “module spec” business, but “runpy” seems to rely 
on that attribute. Is replacing sys.modules entries like this even supported 
usage?

Even in 3.5.0, I can still produce the error by importing the package before 
using runpy:

$ python3.5 -c 'import runpy, package; runpy.run_module("package.module")'
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 104, in _get_module_details
spec = importlib.util.find_spec(mod_name)
  File "/usr/lib/python3.5/importlib/util.py", line 99, in find_spec
raise ValueError('{}.__spec__ is not set'.format(name)) from None
ValueError: package.module.__spec__ is not set

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.5/runpy.py", line 178, in run_module
mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/usr/lib/python3.5/runpy.py", line 110, in _get_module_details
raise ImportError(msg.format(mod_name, type(ex), ex)) from ex
ImportError: Error while finding spec for 'package.module' (: package.module.__spec__ is not set)
[Exit 1]

Wolfgang: Do you want to propose a specific wording to add to the 
documentation? Maybe something like “runpy and the ‘python -m’ option require 
that after the module is imported, it should have a __spec__ attribute”. Where 
should this go? In the runpy, command line, and/or What’s New documentation?

FWIW, 2.7.11 gives an even stranger error; perhaps this is a different bug:

$ python2.7 -c 'import runpy, package.module; 
runpy.run_module("package.module")'
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/runpy.py", line 170, in run_module
mod_name, loader, code, fname = _get_module_details(mod_name)
  File "/usr/lib/python2.7/runpy.py", line 101, in _get_module_details
loader = get_loader(mod_name)
  File "/usr/lib/python2.7/pkgutil.py", line 464, in get_loader
return find_loader(fullname)
  File "/usr/lib/python2.7/pkgutil.py", line 474, in find_loader
for importer in iter_importers(fullname):
  File "/usr/lib/python2.7/pkgutil.py", line 424, in iter_importers
if fullname.startswith('.'):
AttributeError: 'object' object has no attribute 'startswith'
[Exit 1]

--
versions: +Python 3.6

___
Python tracker 

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



[issue27504] Missing assertion methods in unittest documentation

2016-07-12 Thread Mitchell Model

New submission from Mitchell Model:

In looking at the source for unittest.TestCase I was very surprised to see 
quite a few assertion methods that are not included in the module 
documentation. Every available assertion method should be included in the 
library documentation. Users should not have to look at the source to see 
what's available — in fact, why would it even occur to the typical user to do 
that?

Also, I think the phrase "provides several assert methods to check for and 
report failures" is an understatement — it provides MANY assert methods.

I think "assertion method" is a better term than "assert method".

--
assignee: docs@python
components: Documentation
messages: 270278
nosy: MLModel, docs@python
priority: normal
severity: normal
status: open
title: Missing assertion methods in unittest documentation
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue27503] support RUSAGE_THREAD as a constant in the resource module

2016-07-12 Thread R. David Murray

R. David Murray added the comment:

Enhancements only go into the next feature release, which is what happened.

--
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-12 Thread R. David Murray

R. David Murray added the comment:

It isn't documented that writer.writeline returns anything, but what it 
actually returns is whatever the write method of the underlying file object 
returns.  Obviously (given the linked example), this fact is being used.  There 
is value in consistency, so I think we should make this change.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27498] Regression in repr() of class object

2016-07-12 Thread Ned Deily

Changes by Ned Deily :


--
priority: normal -> release blocker

___
Python tracker 

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



[issue27503] support RUSAGE_THREAD as a constant in the resource module

2016-07-12 Thread Maxim Sobolev

New submission from Maxim Sobolev:

This is duplicate of the #10440, which has been added in 2010 into 3.x but 
never merged.

--
files: patch-Modules_resource.c
messages: 270275
nosy: Maxim Sobolev
priority: normal
severity: normal
status: open
title: support RUSAGE_THREAD as a constant in the resource module
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file43700/patch-Modules_resource.c

___
Python tracker 

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



Re: How do you guys tackle a package with poorish documentation?

2016-07-12 Thread Ben Finney
"Veek. M"  writes:

> My question is: how do you guys deal with a situation like this? Do you 
> look through the source code? Do you switch to scapy? Do you now look 
> for books on scapy - there are quite a few, with chapters covering it.

Once you realise that there is significantly less incentive *for the
software maintainer* to spend the effort required in producing and
maintaining and distributing high-quality documentation, you necessarily
realise that someone must apply such an an incentive — otherwise the job
simply is not done.

With that realisation, it becomes immediately clear who has such an
incentive: newcomers to the library. Such as you and me.


So, when working through an unfamiliar library, make it a habit to
record the questions that are not immediately answered. Try to answer
them and record those answers in the same place.

Once you have enough understanding to know what works and what doesn't,
you will inevitably have a set of questions that were raised by trying
to learn the library, and were not answered in any obvious place.

Take those, file bug reports, make suggested patches to improve the
documentation.

All this assumes the project is community-maintained. If you come across
a library that is not community-maintained, walk away as soon as you
realise it; the hope of improvement is much lower.

> A lot of my time goes to the dogs browsing for stuff so I was
> wondering if that's the norm?

Until we make it the norm to *demand* better standards from each other,
and provide the example of doing that work with and for each other: yes.

-- 
 \“A free press is one where it's okay to state the conclusion |
  `\  you're led to by the evidence.” —Bill Moyers |
_o__)  |
Ben Finney

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


[issue26446] Mention in the devguide that core dev stuff falls under the PSF CoC

2016-07-12 Thread Brett Cannon

Brett Cannon added the comment:

I figured Berker was/had when he did the review, but I can take care of it when 
I get around to it (prioritizing 3.6 features ATM).

--

___
Python tracker 

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



Re: Quick poll: gmean or geometric_mean

2016-07-12 Thread alister
On Tue, 12 Jul 2016 15:17:58 -0700, Lawrence D’Oliveiro wrote:

> On Monday, July 11, 2016 at 5:16:53 AM UTC+12, Ian wrote:
> 
>> For local variables I usually wouldn't bother with the units, but in
>> general it's a good practice to help avoid crashing your orbiter into
>> Mars.
> 
> The Mars Climate Orbiter fiasco wasn’t a problem with using the wrong
> units (dimensional analysis would have picked that up), but with using
> wrong unit _systems_.
> 
> Ironic to see a country that fought a war to liberate itself from an
> empire, still stay so wedded to “imperial” units...

The are not.

a US gallon is smaller than an Imperial Gallon
a US Mile is shorter than an Imperial mile
and probably most importantly (because it means they keep serving me 
short measures) a US pint is smaller than an Imperial Pint



-- 
Those who cannot remember the past are condemned to repeat it.
-- George Santayana
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27392] Add a server_side keyword parameter to create_connection

2016-07-12 Thread Yury Selivanov

Yury Selivanov added the comment:

Let's keep this issue open until we have the docs updated.

--

___
Python tracker 

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



Re: Compression of random binary data

2016-07-12 Thread Ian Kelly
On Tue, Jul 12, 2016 at 11:35 AM,   wrote:
>
> No it is only compressible down to a limit given by the algorithm.

Then your algorithm does not compress random data as you claimed.

For some input, determine the limiting output that it ultimately
compresses down to. Take that output and feed it through your
algorithm as if it were the original input. If the data are to be
considered random, then this input is just as probable as the
original. What output does the algorithm now create? If it just
returns the input unchanged, then how do you discern the original
input from this input when decompressing? If it returns a different
output of the same size, then repeat the process with the new output.
Now there are *two* outputs of that size that can't be repeated. There
are only finitely many possible outputs of that size, so eventually
you're going to have to get to one that either repeats an output -- in
which case your algorithm produces the same output for two different
inputs and is therefore incorrect -- or you will get to an input that
produces an output *larger* in size than the original.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-12 Thread Lawrence D’Oliveiro
On Monday, July 11, 2016 at 2:30:00 AM UTC+12, Rustom Mody wrote:

> Force is given by the negative of the universal_gravitational_constant times
> the mass_of_first_body times mass_of_second_body divided by the square of
> the distance_between_the_bodies
> 
> Cobol anyone?

Look at it this way: the ancients (Greeks, Babylonians etc) were doing their 
maths in the equivalent of Cobol.

The reason why mathematicians invented short names for things was because it 
made the structure easier to see. Being able to easily manipulate that 
structure is key to solving mathematical problems.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27392] Add a server_side keyword parameter to create_connection

2016-07-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3e44c449433a by Yury Selivanov in branch '3.5':
Issue #27392: Add loop.connect_accepted_socket().
https://hg.python.org/cpython/rev/3e44c449433a

New changeset 2f0716009132 by Yury Selivanov in branch 'default':
Merge 3.5 (issue #27392)
https://hg.python.org/cpython/rev/2f0716009132

--
nosy: +python-dev

___
Python tracker 

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



Re: Quick poll: gmean or geometric_mean

2016-07-12 Thread Lawrence D’Oliveiro
On Monday, July 11, 2016 at 5:16:53 AM UTC+12, Ian wrote:

> For local variables I usually wouldn't bother with the units, but in
> general it's a good practice to help avoid crashing your orbiter into
> Mars.

The Mars Climate Orbiter fiasco wasn’t a problem with using the wrong units 
(dimensional analysis would have picked that up), but with using wrong unit 
_systems_.

Ironic to see a country that fought a war to liberate itself from an empire, 
still stay so wedded to “imperial” units...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Quick poll: gmean or geometric_mean

2016-07-12 Thread Chris Angelico
On Wed, Jul 13, 2016 at 8:13 AM, Lawrence D’Oliveiro
 wrote:
> On Saturday, July 9, 2016 at 9:05:18 PM UTC+12, Peter Otten wrote:
>
>> Life's too short for abbreviations.
>
> Why is there no abbreviation for “abbreviation”?
>
> Let me propose “brev”. Nice and ... um ... abbreviated.

abbr?

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


Re: Quick poll: gmean or geometric_mean

2016-07-12 Thread Lawrence D’Oliveiro
On Saturday, July 9, 2016 at 9:05:18 PM UTC+12, Peter Otten wrote:

> Life's too short for abbreviations.

Why is there no abbreviation for “abbreviation”?

Let me propose “brev”. Nice and ... um ... abbreviated.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27180] Doc/pathlib: Please describe the behaviour of Path().rename() is depends on the platform (same as os.rename())

2016-07-12 Thread STINNER Victor

STINNER Victor added the comment:

patch27180. LGTM.

--
nosy: +haypo

___
Python tracker 

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



[issue26446] Mention in the devguide that core dev stuff falls under the PSF CoC

2016-07-12 Thread STINNER Victor

STINNER Victor added the comment:

Brett: "Thanks for the patch, Evelyn! The latest one LGTM and I will commit it 
when I have time."

Ok, so are you going to push it?

--
nosy: +haypo

___
Python tracker 

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



[issue8538] Add FlagAction to argparse

2016-07-12 Thread STINNER Victor

STINNER Victor added the comment:

I'm sorry but there is no activity since 4 years, so I guess that the feature 
is not common enough to require a builtin support in argparse.

--
nosy: +haypo
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-12 Thread STINNER Victor

STINNER Victor added the comment:

It doesn't seem right to me.

The writer should be blocking: write *all* data, don't use partial write.

Supporting partial write (non-blocking files) requires more changes, and it 
isn't worth it.

Here the problem is that the function doesn't support partial write. Each time, 
it tries to write the full content.

What is your use case?

--
nosy: +haypo

___
Python tracker 

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



Re: Touch screen development in Python

2016-07-12 Thread Dietmar Schwertberger

On 12.07.2016 21:10, Jahn wrote:

I was thinking about Python touch screen applications for industrial boards( 
computers).
If I have a touch screen  with that industrial board, what I must have 
installed to be able to
write  touch screen applications in Python?
This could be any platform:  QNX, Android, Windows, Embedded Windows, 
Windows CE, Windows Mobile, Linux with X, Linux with Wayland, Linux 
command line and a display connected via SPI or whatever...
If you don't write which platform you actually have, you will probably 
not get answers that will help you.


Regards,

Dietmar

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


[issue27498] Regression in repr() of class object

2016-07-12 Thread Tim Graham

Changes by Tim Graham :


--
nosy: +Tim.Graham

___
Python tracker 

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

2016-07-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
Removed message: http://bugs.python.org/msg270265

___
Python tracker 

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



[issue27502] Python -m Module Vulnerable to Buffer Over Flow.

2016-07-12 Thread R. David Murray

R. David Murray added the comment:

Your screenshots don't show any evidence of a crash.  I don't see any buffer 
overflow here, just normal python error messages.

--
nosy: +r.david.murray

___
Python tracker 

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

2016-07-12 Thread Steve Holden

Steve Holden added the comment:

Just wanted to add a couple of comments here in case there's any interest. In 
our missions to make the world's market data available we deal with financial 
exchanges, many of whom are already recording event data at nanosecond 
resolution.

Further, I believe the decision to use a separate nanoseconds field to be 
essentially correct. While  it may well introduce some arithmetical complexity 
its value in backwards compatibility should be regarded as paramount. If I 
understand it correctly, the new nanosecond resolution times would continue to 
be correctly handled (module loss of nanosecond resolution) when handled as 
current microsecond date-times.

--

___
Python tracker 

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



Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den tisdag 12 juli 2016 kl. 21:40:36 UTC+2 skrev jonas.t...@gmail.com:
> Den tisdag 12 juli 2016 kl. 20:20:52 UTC+2 skrev Michael Torrie:
> > On 07/12/2016 11:46 AM, jonas.thornv...@gmail.com wrote:
> > > Well the algorithm start with looking up a suitable folding structure
> > > "close enough to the number", then it works down the folding
> > > structure finding the fold where the difference or sum between the
> > > folds closest to zero.
> > > 
> > > You do the same prinicple with the remainder until zero is achieved.
> > > 
> > > So our first fold can either be bigger or smaller, and it seek a
> > > configuration for the fold that close in max on the actual random
> > > number. The second fold could be a fold that depending upon our first
> > > fold was bigger or smaller than number either will add or subtract
> > > lower layers of the fold.
> > > 
> > > There will come out a difference that need to be folded, the process
> > > is repeated until there is nothing to fold.
> > > 
> > > It is basicly a search algorithm looking for suitable folding
> > > structures.
> > 
> > Better patent it quickly then.  And you will win a noble prize for math
> > if you could do what you say you could.
> 
> I must stress when i say number here i really mean +10 decimal digit. So 
> i basicly search in on big numbers that i compress. So i divide the dataset 
> into suitable sizes for compression.

And the dataset chunks that comes out from the process can also be treated like 
a new datafile, so the compression is iterative down to a limit. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den tisdag 12 juli 2016 kl. 20:20:52 UTC+2 skrev Michael Torrie:
> On 07/12/2016 11:46 AM, jonas.thornv...@gmail.com wrote:
> > Well the algorithm start with looking up a suitable folding structure
> > "close enough to the number", then it works down the folding
> > structure finding the fold where the difference or sum between the
> > folds closest to zero.
> > 
> > You do the same prinicple with the remainder until zero is achieved.
> > 
> > So our first fold can either be bigger or smaller, and it seek a
> > configuration for the fold that close in max on the actual random
> > number. The second fold could be a fold that depending upon our first
> > fold was bigger or smaller than number either will add or subtract
> > lower layers of the fold.
> > 
> > There will come out a difference that need to be folded, the process
> > is repeated until there is nothing to fold.
> > 
> > It is basicly a search algorithm looking for suitable folding
> > structures.
> 
> Better patent it quickly then.  And you will win a noble prize for math
> if you could do what you say you could.

I must stress when i say number here i really mean +10 decimal digit. So i 
basicly search in on big numbers that i compress. So i divide the dataset into 
suitable sizes for compression.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue15443] datetime module has no support for nanoseconds

2016-07-12 Thread Steve Holden

Steve Holden added the comment:

Just wanted to add a couple of comments here in case there's any interest. In 
our missions to make the world's market data available we deal with financial 
exchanges, many of whom are already recording event data at nanosecond 
resolution.

Further, I believe the decision to use a separate nanoseconds field to be 
essentially correct. While  it may well introduce some arithmetical complexity 
its value in backwards compatibility should be regarded as paramount. If I 
understand it correctly, the new nanosecond resolution times would continue to 
be correctly handled (module loss of nanosecond resolution) when handled as 
current microsecond date-times.

--
nosy: +holdenweb

___
Python tracker 

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



Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den tisdag 12 juli 2016 kl. 20:20:52 UTC+2 skrev Michael Torrie:
> On 07/12/2016 11:46 AM, jonas.thornv...@gmail.com wrote:
> > Well the algorithm start with looking up a suitable folding structure
> > "close enough to the number", then it works down the folding
> > structure finding the fold where the difference or sum between the
> > folds closest to zero.
> > 
> > You do the same prinicple with the remainder until zero is achieved.
> > 
> > So our first fold can either be bigger or smaller, and it seek a
> > configuration for the fold that close in max on the actual random
> > number. The second fold could be a fold that depending upon our first
> > fold was bigger or smaller than number either will add or subtract
> > lower layers of the fold.
> > 
> > There will come out a difference that need to be folded, the process
> > is repeated until there is nothing to fold.
> > 
> > It is basicly a search algorithm looking for suitable folding
> > structures.
> 
> Better patent it quickly then.  And you will win a noble prize for math
> if you could do what you say you could.

I doubt it i never got anyone before for my ideas.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27415] regression: BaseEventLoop.create_server does not accept port=None

2016-07-12 Thread Marcus Cobden

Changes by Marcus Cobden :


--
title: BaseEventLoop.create_server does not accept port=None -> regression: 
BaseEventLoop.create_server does not accept port=None

___
Python tracker 

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



Re: Touch screen development in Python

2016-07-12 Thread Jahn
I was thinking about Python touch screen applications for industrial boards( 
computers).
If I have a touch screen  with that industrial board, what I must have 
installed to be able to 
write  touch screen applications in Python?


> On 11.07.2016 19:21, Jahn wrote:
> > Does anyone use Python for  developping  applications that  work with a 
> > touch screen?
> 
> Yes.
> 
> 
> You should probably specify the platform and the type of applications 
> that you're interested in.
> 
> Mobiles (Android, iOS, Sailfish OS)? Windows 10 Tablets? Ubuntu Touch? 
> Embedded systems?
> 
> 
> Regards,
> 
> Dietmar
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


[issue27502] Python -m Module Vulnerable to Buffer Over Flow.

2016-07-12 Thread Dhiraj

New submission from Dhiraj:

Hello Sir ,

The Module of Python " -m SimpleHTTPServer " is vulnerable to Buffer Over Flow.
Step :
I have prepared a python script which is sending more than 5000+ Values to the 
Module in GET Method , and as soon as , I run that Script , the Python -m 
SimpleHTTPServer  which is running on the Victim's system Generator’s a huge 
Line or Error where as Exception handling is not done Proper , as if the Server 
do not get crash ,  but if the fuzzing script is run again and again it gets 
Crashed , and Buffer Over Flow is been Taken place.
In our Scenario Kali Linux machine is victims system running the server module 
and Linux Mint is sending the fuzzing script.

Please have a look on the POC below.
I ll be happy to hear from the team.
Thank You

--
files: POC-Python.zip
messages: 270264
nosy: DhirajMishra
priority: normal
severity: normal
status: open
title: Python -m Module Vulnerable to Buffer Over Flow.
type: security
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43699/POC-Python.zip

___
Python tracker 

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



[issue27498] Regression in repr() of class object

2016-07-12 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +kushal.das

___
Python tracker 

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



[issue27500] ProactorEventLoop cannot open connection to ::1

2016-07-12 Thread Sebastien Bourdeauducq

Sebastien Bourdeauducq added the comment:

The first offending commit is this one:
https://github.com/python/cpython/commit/03df54d549173e17e1cf9a767199de32a363aa6b

more specifically "return af, type, proto, '', (host, port)". For IPv6, it 
should be "(host, port, flow info, scope id)" instead of just "(host, port)".

--

___
Python tracker 

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



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

2016-07-12 Thread Guido van Rossum

Guido van Rossum added the comment:

I'm also echoing this... It breaks too many tests. I filed issue27498.

--
nosy: +gvanrossum

___
Python tracker 

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



Re: pocketsphinx no module named pocketsphinx found

2016-07-12 Thread ldompeling
Op dinsdag 12 juli 2016 10:00:51 UTC+2 schreef ldomp...@casema.nl:
> I try to run an example python file for pocketsphinx but I get this error: 
> 
> File "continuous_test.py", line 5, in 
> from pocketsphinx.pocketsphinx import *
> ImportError: No module named pocketsphinx
> 
> Does somebody knows how to repair this.

I work it out with importing pocketsphinx and sphinxbase but I have an other 
error:

Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named Decoder

Is there a way to download the module Decoder somewhere? 

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


Re: how raspi-idle3 configure?

2016-07-12 Thread memilanuk
Egon Mueller  online.de> writes:
> 
> Where can read a beginner so simple things about handling the python 3 
> idle3? I don't think about python programming, only about better 
> handling the ide.
> 

This link might be of some help...

https://hkn.eecs.berkeley.edu/~DYOO/python/idle_intro/index.html

HTH,

Monte


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


Re: Compression of random binary data

2016-07-12 Thread Michael Torrie
On 07/12/2016 11:46 AM, jonas.thornv...@gmail.com wrote:
> Well the algorithm start with looking up a suitable folding structure
> "close enough to the number", then it works down the folding
> structure finding the fold where the difference or sum between the
> folds closest to zero.
> 
> You do the same prinicple with the remainder until zero is achieved.
> 
> So our first fold can either be bigger or smaller, and it seek a
> configuration for the fold that close in max on the actual random
> number. The second fold could be a fold that depending upon our first
> fold was bigger or smaller than number either will add or subtract
> lower layers of the fold.
> 
> There will come out a difference that need to be folded, the process
> is repeated until there is nothing to fold.
> 
> It is basicly a search algorithm looking for suitable folding
> structures.

Better patent it quickly then.  And you will win a noble prize for math
if you could do what you say you could.

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


[issue27501] Create a collections.abc class that describes PEP 3118 buffer

2016-07-12 Thread Daniel Moisset

Changes by Daniel Moisset :


--
components: +Library (Lib)
type:  -> enhancement

___
Python tracker 

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



[issue27501] Create a collections.abc class that describes PEP 3118 buffer

2016-07-12 Thread Daniel Moisset

New submission from Daniel Moisset:

The buffer protocol is a low level C protocol, but even if it doesn't expose a 
specific python API, it's currently not possible to say "this object implements 
the buffer protocol" in Python

This might be useful for some applications, including PEP-484 typing hints. It 
would be useful to have a collections.abc.Buffer which already registers the 
types that already support the protocol (bytes, strings, array.array, struct, 
mmap, ctype arrays/pointers, etc)

--
messages: 270261
nosy: Daniel Moisset
priority: normal
severity: normal
status: open
title: Create a collections.abc class that describes PEP 3118 buffer

___
Python tracker 

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



[issue27499] PY_SSIZE_T_CLEAN conflicts with Py_LIMITED_API

2016-07-12 Thread Daniel Holth

Daniel Holth added the comment:

Oh, I can avoid this problem by setting Py_LIMITED_API to 0x3030 or greater.

--

___
Python tracker 

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



[issue27498] Regression in repr() of class object

2016-07-12 Thread Ethan Furman

Ethan Furman added the comment:

This change was done in issue25548.

--
nosy: +ethan.furman

___
Python tracker 

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



[issue27500] ProactorEventLoop cannot open connection to ::1

2016-07-12 Thread Sebastien Bourdeauducq

New submission from Sebastien Bourdeauducq:

The following code fails with "OSError: [WinError 10022] An invalid argument 
was supplied".

import asyncio
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop)
loop.run_until_complete(asyncio.open_connection("::1", 4242))

This is a regression in 3.5.2. 3.5.1 does not have this bug. Connecting to 
127.0.0.1 does not cause the problem.

--
components: asyncio
messages: 270258
nosy: gvanrossum, haypo, sebastien.bourdeauducq, yselivanov
priority: normal
severity: normal
status: open
title: ProactorEventLoop cannot open connection to ::1
versions: Python 3.5

___
Python tracker 

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



Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den tisdag 12 juli 2016 kl. 17:19:54 UTC+2 skrev Steven D'Aprano:
> On Wed, 13 Jul 2016 12:29 am, jonas.thornv...@gmail.com wrote:
> 
> > Den tisdag 12 juli 2016 kl. 05:01:20 UTC+2 skrev Lawrence D’Oliveiro:
> >> On Tuesday, July 12, 2016 at 5:52:27 AM UTC+12, jonas.t...@gmail.com
> >> wrote:
> >> 
> >> > What kind of statistic law or mathematical conjecture  or is it even a
> >> > physical law is violated by compression of random binary data?
> >> 
> >> Try compressing already-compressed data.
> >> 
> >> Does that answer your question?
> > 
> > Yes that is my question, and also a claim i can do it.
> 
> Can you also make a perpetual motion machine, square the circle, and find an
> exact rational fraction equal to pi?
> 
> 
> What gets me is the people who *say* that they can compress already
> compressed data. We know they can't, because if they could, they could
> compress it again and again and again and again until there was only a
> single bit, AND STILL REVERSE IT, using no external storage. Your lookup
> tables are part of the compressed data. If the "compressed file" plus the
> lookup table is bigger than the original file, then you haven't really
> compressed anything. You've just moved some of it from the file into a
> lookup table.
> 
> So why do people claim that they can compress already compressed data? Who
> are they fooling? Themselves?
> 
> 
> 
> -- 
> Steve

Well the algorithm start with looking up a suitable folding structure "close 
enough to the number", then it works down the folding structure finding the 
fold where the difference or sum between the folds closest to zero.

You do the same prinicple with the remainder until zero is achieved.

So our first fold can either be bigger or smaller, and it seek a configuration 
for the fold that close in max on the actual random number. The second fold 
could be a fold that depending upon our first fold was bigger or smaller than 
number either will add or subtract lower layers of the fold. 

There will come out a difference that need to be folded, the process is 
repeated until there is nothing to fold.

It is basicly a search algorithm looking for suitable folding structures.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2016-07-12 Thread jonas . thornvall
Den tisdag 12 juli 2016 kl. 17:12:01 UTC+2 skrev Steven D'Aprano:
> On Wed, 13 Jul 2016 12:24 am, jonas.thornv...@gmail.com wrote:
> 
> > Den måndag 11 juli 2016 kl. 20:38:51 UTC+2 skrev Steven D'Aprano:
> >> On Tue, 12 Jul 2016 03:52 am, jonas.thornv...@gmail.com wrote:
> >> 
> >> > What kind of statistic law or mathematical conjecture  or is it even a
> >> > physical law is violated by compression of random binary data?
> >> 
> >> The pigeon hole principle. If you have 100 pigeon holes, and 101 pigeons,
> >> then clearly at least one pigeon hole must have two pigeons in it.
> [...]
> > But it seem your reasoning is based upon interpretation of the actual
> > digits, bits and bytes value.
> 
> Not at all. If you think that, you've misread my example. There's no
> interpretation of the bytes: they are just 8-bit numbers from 0 to 255. You
> cannot losslessly compress all 256 of them to just four 2-bit numbers.
> 
> 
> > There could be different interpretation 
> > worlds of course you would have to chose one using digits, An 
> > interpretationworld here could be reading out different word lengths of
> > the dataset and maybe a lookup table.
> 
> Any lookup table you have counts as part of the compressed data.
> 
> 
> > But it could also be arithmetic rules that magically recreate a number
> > from a number of folds or difference of folds.
> 
> Oh, sure, if you believe in magic, anything is possible. Just close your
> eyes, click your heels together, and wish really, really hard.
> 
> Suppose I could compress ANY random data, no matter what, down to 10% of the
> original size. Okay, let's start with a million bits of data. Compress it
> down to 100,000 bits.
> 
> But I believe that I can compress *anything*, any random collection of data.
> Okay, let me compress it again. Now I have 10,000 bits.
> 
> Compress it again. Now I have 1,000 bits.
> 
> Compress it again. Now I have 100 bits.
> 
> Compress it again. Now I have 10 bits.
> 
> Compress it again. Now I have 1 bit, either a 0 or a 1.
> 
> 
> Can you not see how absurd this is? I have claimed that I can take *any*
> random set of data, and by compressing it again and again and again,
> compress it down to ONE BIT, either a 0 or a 1, WITHOUT LOSS. Somehow I
> have to take that 0 bit and uncompress it back to the Complete Works Of
> William Shakespeare, and *also* uncompress it back to the recent Deadpool
> movie, AND uncompress it back to last year's Ant Man movie, AND uncompress
> it back to some funny picture of a cat.
> 
> How can I possibly know which of the billions and billions of different
> files this 0 bit represents?
> 
> If you pass me a 0 bit, and say "uncompress this", and I get The Lord Of The
> Rings novels, and then you pass me another 0 bit, and I uncompress it and
> get The Hobbit, well, how did I tell the two bits apart? They're both zero.
> 
> 
> 
> The alternative is to say, it doesn't matter how clever you are, you can't
> compress *everything*. There are some things that simply won't compress.
> Eventually you get something no longer compresses. If you could compress
> EVERYTHING, then you could compress the compressed data, and compress the
> compressed-compressed data, and so on, until you've got only a single bit.
> And that is ridiculous.
> 
> 
> 
> -- 
> Steven
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.

No it is only compressible down to a limit given by the algorithm.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27285] Document the deprecation of pyvenv in favor of `python3 -m venv`

2016-07-12 Thread Steve Piercy

Steve Piercy added the comment:

Thanks, Ned. This was my first hg patch. I'm learning.

--

___
Python tracker 

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



[issue27496] unicodedata.name() doesn't have names for control characters

2016-07-12 Thread Eryk Sun

Changes by Eryk Sun :


--
versions: +Python 2.7, Python 3.6

___
Python tracker 

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



[issue27496] unicodedata.name() doesn't have names for control characters

2016-07-12 Thread Eryk Sun

Changes by Eryk Sun :


--
components: +Unicode
nosy: +ezio.melotti, haypo

___
Python tracker 

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



[issue27499] PY_SSIZE_T_CLEAN conflicts with Py_LIMITED_API

2016-07-12 Thread Daniel Holth

Daniel Holth added the comment:

Here it is. 
https://mail.python.org/pipermail/python-3000/2008-November/015344.html

On Sat, Nov 22, 2008 at 06:29, Barry Warsaw  wrote:
>
> On Nov 22, 2008, at 4:05 AM, Martin v. Löwis wrote:
>
>> I just noticed that the Python 3 C API still contains PY_SSIZE_T_CLEAN.
>>
>> This macro was a transition mechanism, to allow extensions to use
>> Py_ssize_t in PyArg_ParseTuple, while allowing other module continue
>> to use int.
>>
>> In Python 3, I would like the mechanism, making Py_ssize_t the only
>> valid data type for size in, say, s# parsers.
>>
>> Is it ok to still change that?
>
> Given that we just released the last planned candidate, I'd say it was too
> late to change this for Python 3.0.
>

But we can at least document that the macro is a gone as soon as 3.0
final is out the door.

-Brett

--

___
Python tracker 

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



Re: Compression of random binary data

2016-07-12 Thread mm0fmf

On 12/07/2016 15:29, jonas.thornv...@gmail.com wrote:

Den tisdag 12 juli 2016 kl. 05:01:20 UTC+2 skrev Lawrence D’Oliveiro:

On Tuesday, July 12, 2016 at 5:52:27 AM UTC+12, jonas.t...@gmail.com wrote:


What kind of statistic law or mathematical conjecture  or is it even a
physical law is violated by compression of random binary data?


Try compressing already-compressed data.

Does that answer your question?


Yes that is my question, and also a claim i can do it.



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


[issue27498] Regression in repr() of class object

2016-07-12 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +rhettinger

___
Python tracker 

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



[issue27499] PY_SSIZE_T_CLEAN conflicts with Py_LIMITED_API

2016-07-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

First we should make PY_SSIZE_T_CLEAN mandatory for the term of at least two 
releases (or to the end of 2.7 support).

--
nosy: +serhiy.storchaka

___
Python tracker 

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



how raspi-idle3 configure?

2016-07-12 Thread Egon Mueller

Hello,
is there a manual concerning the python3-ide on a raspberry / debian jessie?
- The menue bar and the items there would I like to have a little bit 
greater for better readability.
- After running a program is needed long search to return to editing 
window.

- 

Where can read a beginner so simple things about handling the python 3 
idle3? I don't think about python programming, only about better 
handling the ide.


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


[issue27496] unicodedata.name() doesn't have names for control characters

2016-07-12 Thread Zack Weinberg

Zack Weinberg added the comment:

It looks to me as if NameAliases.txt is the better reference for the C0 and C1 
controls.  It matches the UnicodeData.txt field 10 names for most entries where 
the field 1 name is "", but it has names for U+0080, U+0081, U+0084, 
and U+0099, which have no field 10 name.  The only catch is that NameAliases 
may have *several* names for the same character, with the same category tag, 
e.g.

0009;CHARACTER TABULATION;control
0009;HORIZONTAL TABULATION;control

It probably makes sense to consistently use the first listed.

--

___
Python tracker 

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



[issue27485] urllib.splitport -- is it official or not?

2016-07-12 Thread Brett Cannon

Brett Cannon added the comment:

Probably a rename is good. Question then becomes whether the old names should 
raise an DeprecationWarning for a release?

--
nosy: +brett.cannon

___
Python tracker 

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



[issue27498] Regression in repr() of class object

2016-07-12 Thread Guido van Rossum

New submission from Guido van Rossum:

In Python 3.6, the repr() of a class includes its memory address.

This is going to cause a lot of problems for tests in 3rd party code that 
expects the nice and clean  instead of .

I understand the desire to provide more clarity in case somehow two class 
objects created at different times have the same name -- but I'm not sure I 
like to rub the hex address in the user's face all the time.

Can we please roll this back or think about a better way to reveal this that 
won't break so many 3rd party tests?

--
messages: 270251
nosy: gvanrossum
priority: normal
severity: normal
status: open
title: Regression in repr() of class object
versions: Python 3.6

___
Python tracker 

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



[issue27499] PY_SSIZE_T_CLEAN conflicts with Py_LIMITED_API

2016-07-12 Thread Daniel Holth

New submission from Daniel Holth:

When compiling my cryptacular extension 
https://bitbucket.org/dholth/cryptacular I noticed -DPy_LIMITED_API 
-DPY_SSIZE_T_CLEAN creates a binary that does not actually use the limited api. 
This causes segfaults on Linux but does not appear to cause problems on Windows.

I found some emails suggestid PY_SSIZE_T_CLEAN was supposed to go away entirely?

--
components: Extension Modules
messages: 270252
nosy: dholth
priority: normal
severity: normal
status: open
title: PY_SSIZE_T_CLEAN conflicts with Py_LIMITED_API
versions: Python 3.5

___
Python tracker 

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



[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-12 Thread Zachary Ware

Zachary Ware added the comment:

This seems like a reasonable request, but could only be done in 3.6 as it would 
be a new feature.

--
keywords: +easy
nosy: +zach.ware
stage:  -> needs patch
versions:  -Python 3.5

___
Python tracker 

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



[issue27492] Enhance bytearray_repr with bytes_repr's logic

2016-07-12 Thread Xiang Zhang

Xiang Zhang added the comment:

I considered that too. But I was not sure what code could go into 
bytes_methods.c then, Python level methods, all common parts or only 
tp->methods? I'll try to factor the common part out later.

--

___
Python tracker 

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



Re: Compression of random binary data

2016-07-12 Thread Steven D'Aprano
On Wed, 13 Jul 2016 12:29 am, jonas.thornv...@gmail.com wrote:

> Den tisdag 12 juli 2016 kl. 05:01:20 UTC+2 skrev Lawrence D’Oliveiro:
>> On Tuesday, July 12, 2016 at 5:52:27 AM UTC+12, jonas.t...@gmail.com
>> wrote:
>> 
>> > What kind of statistic law or mathematical conjecture  or is it even a
>> > physical law is violated by compression of random binary data?
>> 
>> Try compressing already-compressed data.
>> 
>> Does that answer your question?
> 
> Yes that is my question, and also a claim i can do it.

Can you also make a perpetual motion machine, square the circle, and find an
exact rational fraction equal to pi?


What gets me is the people who *say* that they can compress already
compressed data. We know they can't, because if they could, they could
compress it again and again and again and again until there was only a
single bit, AND STILL REVERSE IT, using no external storage. Your lookup
tables are part of the compressed data. If the "compressed file" plus the
lookup table is bigger than the original file, then you haven't really
compressed anything. You've just moved some of it from the file into a
lookup table.

So why do people claim that they can compress already compressed data? Who
are they fooling? Themselves?



-- 
Steve

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


[issue27497] csv module: Add return value to DictWriter.writeheader

2016-07-12 Thread Logan

New submission from Logan:

Currently, DictWriter.writeheader() is defined like:

def writeheader(self):
header = dict(zip(self.fieldnames, self.fieldnames))
self.writerow(header)

It would be useful to have it return the value of writerow():

def writeheader(self):
header = dict(zip(self.fieldnames, self.fieldnames))
return self.writerow(header)

This would useful because:
1) It would match the behavior of DictWriter.writerow
2) It would enable DictWriter.writeheader to be used in within a generator 
function (ala 
https://docs.djangoproject.com/en/1.9/howto/outputting-csv/#streaming-large-csv-files)

--
messages: 270248
nosy: lsowen
priority: normal
severity: normal
status: open
title: csv module: Add return value to DictWriter.writeheader
type: enhancement
versions: Python 3.5, Python 3.6

___
Python tracker 

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



Re: Compression of random binary data

2016-07-12 Thread Steven D'Aprano
On Wed, 13 Jul 2016 12:24 am, jonas.thornv...@gmail.com wrote:

> Den måndag 11 juli 2016 kl. 20:38:51 UTC+2 skrev Steven D'Aprano:
>> On Tue, 12 Jul 2016 03:52 am, jonas.thornv...@gmail.com wrote:
>> 
>> > What kind of statistic law or mathematical conjecture  or is it even a
>> > physical law is violated by compression of random binary data?
>> 
>> The pigeon hole principle. If you have 100 pigeon holes, and 101 pigeons,
>> then clearly at least one pigeon hole must have two pigeons in it.
[...]
> But it seem your reasoning is based upon interpretation of the actual
> digits, bits and bytes value.

Not at all. If you think that, you've misread my example. There's no
interpretation of the bytes: they are just 8-bit numbers from 0 to 255. You
cannot losslessly compress all 256 of them to just four 2-bit numbers.


> There could be different interpretation 
> worlds of course you would have to chose one using digits, An 
> interpretationworld here could be reading out different word lengths of
> the dataset and maybe a lookup table.

Any lookup table you have counts as part of the compressed data.


> But it could also be arithmetic rules that magically recreate a number
> from a number of folds or difference of folds.

Oh, sure, if you believe in magic, anything is possible. Just close your
eyes, click your heels together, and wish really, really hard.

Suppose I could compress ANY random data, no matter what, down to 10% of the
original size. Okay, let's start with a million bits of data. Compress it
down to 100,000 bits.

But I believe that I can compress *anything*, any random collection of data.
Okay, let me compress it again. Now I have 10,000 bits.

Compress it again. Now I have 1,000 bits.

Compress it again. Now I have 100 bits.

Compress it again. Now I have 10 bits.

Compress it again. Now I have 1 bit, either a 0 or a 1.


Can you not see how absurd this is? I have claimed that I can take *any*
random set of data, and by compressing it again and again and again,
compress it down to ONE BIT, either a 0 or a 1, WITHOUT LOSS. Somehow I
have to take that 0 bit and uncompress it back to the Complete Works Of
William Shakespeare, and *also* uncompress it back to the recent Deadpool
movie, AND uncompress it back to last year's Ant Man movie, AND uncompress
it back to some funny picture of a cat.

How can I possibly know which of the billions and billions of different
files this 0 bit represents?

If you pass me a 0 bit, and say "uncompress this", and I get The Lord Of The
Rings novels, and then you pass me another 0 bit, and I uncompress it and
get The Hobbit, well, how did I tell the two bits apart? They're both zero.



The alternative is to say, it doesn't matter how clever you are, you can't
compress *everything*. There are some things that simply won't compress.
Eventually you get something no longer compresses. If you could compress
EVERYTHING, then you could compress the compressed data, and compress the
compressed-compressed data, and so on, until you've got only a single bit.
And that is ridiculous.



-- 
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


  1   2   >