[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-28 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Given the complexities here, and that the Track/Untrack functions are public 
now, I do wonder if the actual aligned allocation routines should just be an 
internal API (i.e., not exposed in Python.h).

--

___
Python tracker 

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



[issue31304] Update doc for starmap_async error_back kwarg

2017-10-28 Thread Berker Peksag

Change by Berker Peksag :


--
keywords: +easy
stage:  -> needs patch
versions: +Python 3.7

___
Python tracker 

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



[issue31065] Documentation for Popen.poll is unclear

2017-10-28 Thread Berker Peksag

Berker Peksag  added the comment:

I've backported 006617ff7d6df3fdedcfe53e94ee2c52cc796437  to 3.6. I think this 
can be closed now, thank you!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement
versions:  -Python 2.7

___
Python tracker 

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



[issue31065] Documentation for Popen.poll is unclear

2017-10-28 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset 0f1973d06e2116deafb19bbb9443b138187803c7 by Berker Peksag in 
branch '3.6':
bpo-31065: Add doc about Popen.poll returning None. (GH-3169)
https://github.com/python/cpython/commit/0f1973d06e2116deafb19bbb9443b138187803c7


--
nosy: +berker.peksag

___
Python tracker 

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



[issue31065] Documentation for Popen.poll is unclear

2017-10-28 Thread Berker Peksag

Change by Berker Peksag :


--
pull_requests: +4130
stage:  -> patch review

___
Python tracker 

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



[issue30987] Support for ISO-TP protocol in SocketCAN

2017-10-28 Thread Berker Peksag

Berker Peksag  added the comment:

PR 2956 has been merged. Christian, can this issue be closed now?

--
nosy: +berker.peksag

___
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

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 2:08 PM, Gregory Ewing
 wrote:
> Stefan Ram wrote:
>>
>>   Well, then one can ask about the entropy of a data source
>>   that only is emitting this message.
>
>
> You can, but it's still the *source* that has the entropy,
> not the message.
>
> (And the answer in that case is that the entropy is zero.
> If there's only one possible message you can ever send, you
> don't need to send it at all!)

One bit. It might send the message, or it might NOT send the message.

And I have known situations in which that is exactly the system used.
Back before mobile phones were common, you could sometimes use a
payphone to cause someone's phone to ring, but you couldn't actually
speak on it. So you had one message you could send: "bing
bring". A pre-arranged meaning for that message might be "I'm at
the railway station, please come and pick me up"... but there's still
*some* information in the mere fact of the call.

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


Re: Compression of random binary data

2017-10-28 Thread Gregory Ewing

Steve D'Aprano wrote:

I don't think that's right. The entropy of a single message is a well-defined
quantity, formally called the self-information. 


https://en.wikipedia.org/wiki/Self-information


True, but it still depends on knowing (or assuming) the
probability of getting that particular message out of
the set of all possible messages.

This is *not* what danceswithnumbers did when he
calculated the "entropy" of his example bit sequences.
He didn't define the set they were drawn from or
what their probabilities were.

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


[issue1447222] tkinter Dialog fails when more than four buttons are used

2017-10-28 Thread Berker Peksag

Berker Peksag  added the comment:

I ported OP's example to Python 3 and I agree with Cheryl that this is fixed 
now.

--
nosy: +berker.peksag
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed
Added file: https://bugs.python.org/file47244/example.py

___
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

2017-10-28 Thread Gregory Ewing

Stefan Ram wrote:

  Well, then one can ask about the entropy of a data source
  that only is emitting this message.


You can, but it's still the *source* that has the entropy,
not the message.

(And the answer in that case is that the entropy is zero.
If there's only one possible message you can ever send, you
don't need to send it at all!)

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


[issue22671] Typo in class io.BufferedIOBase docs

2017-10-28 Thread Martin Panter

Martin Panter  added the comment:

I’m unlikely to soon, but I don’t mind if someone else uses my patch.

--

___
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

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 1:32 PM, Chris Angelico  wrote:
> On Sun, Oct 29, 2017 at 1:18 PM, Gregory Ewing
>  wrote:
>> You're missing something fundamental about what
>> entropy is in information theory.
>>
>> It's meaningless to talk about the entropy of a single
>> message. Entropy is a function of the probability
>> distribution of *all* the messages you might want to
>> send.
>
> Which is where a lot of "password strength" confusion comes from. How
> much entropy is there in the password "U3ZINVp3PT0="? Strong password
> or weak? What about "dark-next-sure-secret"?
> "with-about-want-really-going"? They were generated by, respectively:
> double-MIME-encoding four bytes from /dev/random (32 bits of entropy),
> picking four words from the top 1024 (40 bits), and picking 5 words
> from the top 64 (30 bits). But just by looking at the passwords
> themselves, you can't tell that.

To clarify: The "top 1024 words" concept is XKCD 936 style password
generation, using my tabletop gaming room's resident parrot. So it's
based on the frequency of words used by D players. YMMV if you use a
different corpus :)

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


[issue31273] Unicode support in TestCase.skip

2017-10-28 Thread Berker Peksag

Change by Berker Peksag :


--
components: +Library (Lib) -Tests, Unicode
nosy: +michael.foord, rbcollins
stage:  -> needs patch
type: crash -> behavior

___
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

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 1:18 PM, Gregory Ewing
 wrote:
> You're missing something fundamental about what
> entropy is in information theory.
>
> It's meaningless to talk about the entropy of a single
> message. Entropy is a function of the probability
> distribution of *all* the messages you might want to
> send.

Which is where a lot of "password strength" confusion comes from. How
much entropy is there in the password "U3ZINVp3PT0="? Strong password
or weak? What about "dark-next-sure-secret"?
"with-about-want-really-going"? They were generated by, respectively:
double-MIME-encoding four bytes from /dev/random (32 bits of entropy),
picking four words from the top 1024 (40 bits), and picking 5 words
from the top 64 (30 bits). But just by looking at the passwords
themselves, you can't tell that.

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


[issue20479] Efficiently support weight/frequency mappings in the statistics module

2017-10-28 Thread Nick Coghlan

Nick Coghlan  added the comment:

Thinking back to my signal processing days, I have to agree that our weightings 
(filter definitions) were usually separate from our data (live signals). 
Similarly, systems engineering trade studies all maintained feature weights 
separately from the assessments of the individual options.

The comment from my original RFE about avoiding expanding value -> 
weight/frequency mappings "to a full iterable all the time" doesn't actually 
make much sense in 3.x, since m.keys() and m.values() are now typically able to 
avoid data copying.

So +1 from me for the separates "weights" parameter, with the 
m.keys()/m.values() idiom used to handle mappings like Counter.

As another point in favour of that approach, it's trivial to build zero-copy 
weighted variants on top of it for mappings with cheap key and value views:

def weighted_mean(mapping):
return statistics.mean(mapping.keys(), mapping.values())

By contrast, if the lowest level primitive provided is a mapping based API, 
then when you do have separate values-and-weights iterables, you're going to 
have a much harder time avoiding building a completely new container.

--

___
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

2017-10-28 Thread Gregory Ewing

Steve D'Aprano wrote:


Random data = any set of data generated by "a source of random".


Any set of data generated by Grant Thompson?

https://www.youtube.com/user/01032010814

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


Re: Compression of random binary data

2017-10-28 Thread Gregory Ewing

danceswithnumb...@gmail.com wrote:

10101011
This equals
61611
This can be represented using
0-6 log2(7)*5= 14.0367746103 bits


11010101
This equals 
54543

This can be represented using
0-5 log2(6)*5= 12.9248125036 bits


You're missing something fundamental about what
entropy is in information theory.

It's meaningless to talk about the entropy of a single
message. Entropy is a function of the probability
distribution of *all* the messages you might want to
send.

What you calculated in your first example relates to
this situation: You want to send someone messages
consisting of 5 symbols drawn from the set {0, 1,
2, 3, 4, 5, 6}, where all such messages have equal
probability. In that case, you need and average of
about 14.03 bits for each message.

Note that this has essentially nothing to do with
the particular sequence of bits you started with.

Your second calculation was for a similar situation,
except that the set of symbols is just {0, 1, 2,
3, 4, 5}. There are fewer messages of length 5 that
can be constructed from that set, so the number of
bits needed is smaller.


In reality you can express 54543 with 10 bits.


Again, this statement is meaningless. You can't
say *anything* about the number of bits needed to
represent that particular number, without knowing
what *other* numbers you might want to represent.

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


Re: Coding style in CPython implementation

2017-10-28 Thread Dan Sommers
On Sat, 28 Oct 2017 16:20:54 -0700, Στέφανος Σωφρονίου wrote:

> I do believe though that if (!d) is a lot clearer than if (d == NULL)
> as it is safer than falsely assigning NULL in d, by pure mistake.

Having made my living writing C code for a very long time, I always
found if (!d) *harder* to read, especially if it happened to be written
if(!d) without the space, because it was never a single character name
the ! disappeared into the noise.  OTOH, = vs. == always stuck out like
a sore thumb.  Then again, I grew up with monochrome terminals
vs. unusably slow syntax highlighting, and grayscale printers (and we
had to live in a small shoebox in the middle of the road).

YMMV.  Obviously.

Dan

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


Re: Compression of random binary data

2017-10-28 Thread Gregory Ewing

Ben Bacarisse wrote:

But that has to be about the process that gives rise to the data, not
the data themselves.



If I say: "here is some random data..." you can't tell if it is or is
not from a random source.  I can, as a parlour trick, compress and
recover this "random data" because I chose it.


Indeed. Another way to say it is that you can't conclude
anything about the source from a sample size of one.

If you have a large enough sample, then you can estimate
a probability distribution, and calculate an entropy.


I think the argument that you can't compress arbitrary data is simpler
...  it's obvious that it includes the results of previous
compressions.


What? I don't see how "results of previous compressions" comes
into it. The source has an entropy even if you're not doing
compression at all.

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


Re: Compression of random binary data

2017-10-28 Thread Ian Kelly
On Oct 28, 2017 10:30 AM, "Stefan Ram"  wrote:
> Well, then one can ask about the entropy of a data source
> thatt only is emitting this message. (If it needs to be endless:
> thatt only is emitting this message repeatedly.)

If there is only one possible message then the entropy is zero.

-1.0 * log2(1.0) == 0
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28197] range.index mismatch with documentation

2017-10-28 Thread Raymond Hettinger

Change by Raymond Hettinger :


--
assignee: rhettinger -> 

___
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

2017-10-28 Thread Steve D'Aprano
On Sun, 29 Oct 2017 07:03 am, Peter Pearson wrote:

> On Thu, 26 Oct 2017 19:26:11 -0600, Ian Kelly  wrote:
>>
>> . . . Shannon entropy is correctly calculated for a data source,
>> not an individual message . . .
> 
> Thank you; I was about to make the same observation.  When
> people talk about the entropy of a particular message, you
> can bet they're headed for confusion.

I don't think that's right. The entropy of a single message is a well-defined
quantity, formally called the self-information. The entropy of a data source
is the expected value of the self-information of all possible messages coming
from that data source.

https://en.wikipedia.org/wiki/Self-information

We can consider the entropy of a data source as analogous to the population
mean, and the entropy of a single message as the sample mean. A single
message is like a sample taken from the set of all possible messages.

Self-information is sometimes also called "surprisal" as it is a measure of
how surprising an event is. If your data source is a coin toss, then actually
receiving a Heads has a self-information ("entropy") of 1 bit. That's not
very surprising. If your data source is a pair of fair, independent dice,
then the self-information of receiving a two and a four is 5.170 bits. Its a
logarithmic scale, not linear: if the probability of a message or event is p,
the self-information of that event is log_2 (1/p) bits.



-- 
Steve
“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: Repairing Python installation?

2017-10-28 Thread Percival John Hackworth
On 28-Oct-2017, Martin Schöön wrote
(in article ):

> It seems something is amiss with my Python 2.7 installation. Revisiting
> Nikola (static web site generator written in Python) for the first time
> in several years the other day I experience some unexpected problems. I
> got some help form the Nikola people and the conclusion is something
> is broken with my Python 2.7. Pip list throws exceptions at me while
> pip3 list works the way I expect it to do.
>
> All this is happening on a Debian machine.
>
> Questions:
>
> Should I try to pinpoint what is broken (and how is that done) or should
> I just remove everything Python 2.7 and re-install?
>
> Could mixing pip installs with Debian distro installs of Python
> packages lead to conflicts or other problems?
>
> TIA,
>
> /Martin

If this site is accessible from the internet, have you looked around other 
parts of the system? Like date/timestamps for /bin/*. I recently was asked to 
look at a friends web site and found they were doing several things that I 
consider a security no-no, like running the tomcat server as root to serve 
their web site. It had been root-kitted. I helped them setup a new system 
that ran tomcat under a non-priv user.

It's just a SWAG, but perhaps something further is amiss that you don't see. 
I was really surprised that my friend, a pretty good programmer, was clueless 
about such things.

The only other time I've seen python "damaged" was when some developer 
decided they wanted a more current version than the default installed on the 
CentOS system (2.6) which is required for updating the system. They borked it 
beyond repair and my boss took away root access after we repaired it.

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


Re: Coding style in CPython implementation

2017-10-28 Thread Στέφανος Σωφρονίου
On Saturday, October 28, 2017 at 9:54:30 PM UTC+3, bartc wrote:
> On 28/10/2017 19:42, Στέφανος Σωφρονίου wrote:
> > Greetings everyone.
> > 
> > I have noticed that in many if conditions the following syntax is used:
> > 
> > a) if (variable == NULL) { ... }
> > b) if (variable == -1) { ... }
> > c) if (variable != NULL) { ... }
> > 
> > What I wanted to ask is, is there a particular reason for not choosing
> > 
> > a) if (!variable) { ... } in place of if (variable == NULL) { ... },
> > b) if (-1 == variable) { ... } in place of if (variable == -1) { ... }, and
> > c) if (variable) { ... } in place of if (variable) { ... } ?
> 
> (Presumably you meant variable != NULL)

Yep, I forgot to show the != NULL part; good catch!

> 
> > Especially the (b) syntax is extremely dangerous to assign -1 to variable 
> > in case of an accidental mistyping of equals sign; it had happened 
> > countless times by now to to many of us that use various C-family languages.
> > 
> > Is there a particular reason for using this specific coding style?
> 
> Which one do you think is more readable?
> 
> Which style would you prefer to read?
> 
> Or do you prefer the more cryptic style in open source code?
> 
> 
> (The = vs. == issue is of one of numerous design flaws in C, but 
> uglifying source code to get around it isn't the answer.)

I understand what you are saying and I don't have a styling preference, at 
least in CPython's case.

I do believe though that if (!d) is a lot clearer than if (d == NULL) as it is 
safer than falsely assigning NULL in d, by pure mistake.

But indeed it's a matter of taste.

I just wanted to see whether there is a certain favor around such coding style, 
that's all.

> 
> 
> 
> -- 
> bartc

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


Re: Problem with subprocess.Popen and EINTR

2017-10-28 Thread Cameron Simpson

On 28Oct2017 23:56, Piet van Oostrum  wrote:

I am using Python 2.7.14 on MacOS Sierra.

I have a small Python program that calls a shell script in a loop with a 
time.sleep() in it.
The shell script is called with subprocess.Popen(), followed by a 
subprocess.wait().
No information is exchanged with the shell script.

Once in a while I send a SIGINT to the program to cancel the sleep. I don't 
know if the sleep is active at the time of the SIGINT, but most of the time it 
will be as it takes much more time than the shell script.

I do this by having a handler for the SIGINT which does nothing. It is just 
there to have the SIGINT silently cancel the sleep.

Now after weeks of running correctly it crashed. It appears that the SIGINT 
came during the Popen. This causes a system call in the Popen to be terminated 
with EINTR and Popen then retries that system call, but unfortunately it fails. 
It seems to me that this could be a bug.


It may be a bug. Or it may be a system call which cannot be meaningfulling 
retried. But had you considered only activating the handler around the sleep?  
You still need to copy with SIGINT single I infer that you send this from 
outside the program.  What if you did this:


 os.signal(SIGINT, SIG_IGN)
 ... code code code, including the Popen/wait ...
 old_handler = os.signal(SIGINT, do_nothing_handler)
 sleep(...)
 os.signal(SIGINT, old_handler)

SIG_IGN is different from a do-nothing handler; it prevents the process seeing 
the signal at all, and therefore prevents the signal interrupting system calls.


So you activate your dummy-quit-sleeping function only around the sleep itself.

Cheers,
Cameron Simpson  (formerly c...@zip.com.au)
--
https://mail.python.org/mailman/listinfo/python-list


Re: Problem with subprocess.Popen and EINTR

2017-10-28 Thread Cameron Simpson

On 29Oct2017 10:11, Cameron Simpson  wrote:
It may be a bug. Or it may be a system call which cannot be meaningfulling 
retried. But had you considered only activating the handler around the sleep?  
You still need to copy with SIGINT single I infer that you send this from 
outside the program.


I need more coffee. Or less. "meaningfully". "copy" ==> "cope". "single" => 
"since".


Argh,
Cameron Simpson  (formerly c...@zip.com.au)
--
https://mail.python.org/mailman/listinfo/python-list


[issue20047] bytearray partition bug

2017-10-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset a2314283ff87c65e1745a42c2f2b716b1a209128 by Serhiy Storchaka in 
branch 'master':
bpo-20047: Make bytearray methods partition() and rpartition() rejecting (#4158)
https://github.com/python/cpython/commit/a2314283ff87c65e1745a42c2f2b716b1a209128


--

___
Python tracker 

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-10-28 Thread Berker Peksag

Berker Peksag  added the comment:

> Should we backport the fix to Python 3.3 and 3.4 as well?
> 
> I don't think so.

I agree with Victor. Closing this as all PRs have been merged. Thank you, all 
(especially for the documentation update!)

--
nosy: +berker.peksag
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



Re: Problem with subprocess.Popen and EINTR

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 8:56 AM, Piet van Oostrum  wrote:
> I am using Python 2.7.14 on MacOS Sierra.
>
> I have a small Python program that calls a shell script in a loop with a 
> time.sleep() in it.
> The shell script is called with subprocess.Popen(), followed by a 
> subprocess.wait().
> No information is exchanged with the shell script.
>
> Once in a while I send a SIGINT to the program to cancel the sleep. I don't 
> know if the sleep is active at the time of the SIGINT, but most of the time 
> it will be as it takes much more time than the shell script.
>
> I do this by having a handler for the SIGINT which does nothing. It is just 
> there to have the SIGINT silently cancel the sleep.
>
> Now after weeks of running correctly it crashed. It appears that the SIGINT 
> came during the Popen. This causes a system call in the Popen to be 
> terminated with EINTR and Popen then retries that system call, but 
> unfortunately it fails. It seems to me that this could be a bug.

That definitely could be a bug. The behaviour of signals and retries
of system calls got changed more recently, but Python 2.7 is the
oldstable version and didn't get that sort of change. My advice to you
is simply live with it; the probability of it recurring is low (if, as
you say, the sleep takes the bulk of the time), unless you can migrate
to Python 3, to take advantage of the new behaviour.

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


Problem with subprocess.Popen and EINTR

2017-10-28 Thread Piet van Oostrum
I am using Python 2.7.14 on MacOS Sierra.

I have a small Python program that calls a shell script in a loop with a 
time.sleep() in it.
The shell script is called with subprocess.Popen(), followed by a 
subprocess.wait().
No information is exchanged with the shell script.

Once in a while I send a SIGINT to the program to cancel the sleep. I don't 
know if the sleep is active at the time of the SIGINT, but most of the time it 
will be as it takes much more time than the shell script.

I do this by having a handler for the SIGINT which does nothing. It is just 
there to have the SIGINT silently cancel the sleep.

Now after weeks of running correctly it crashed. It appears that the SIGINT 
came during the Popen. This causes a system call in the Popen to be terminated 
with EINTR and Popen then retries that system call, but unfortunately it fails. 
It seems to me that this could be a bug.

Here is the traceback:

Traceback (most recent call last):
  File "/Users/piet/bin/smoveinloop.py", line 86, in 
main()
  File "/Users/piet/bin/smoveinloop.py", line 65, in main
task = subprocess.Popen([TASK], executable=TASK)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
 line 390, in __init__
errread, errwrite)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
 line 1001, in _execute_child
data = _eintr_retry_call(os.read, errpipe_read, 1048576)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
 line 121, in _eintr_retry_call
return func(*args)
OSError: [Errno 22] Invalid argument

TASK is a string with the name of the shell script.

Can anybody shed some light on this?
-- 
Piet van Oostrum 
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]

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


[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2017-10-28 Thread Tal Einat

Tal Einat  added the comment:

Regarding the select module, the existing patch moves typedefs and object type 
declarations to the top of the file with the #include clinic/selectmodule.c.h 
statement can come afterwards. Should I keep it this way, or instead move the 
method list and type definitions to the bottom of the file, as Serhiy said was 
preferable with itertoolsmodule.c?

--

___
Python tracker 

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



Re: Repairing Python installation?

2017-10-28 Thread Karsten Hilbert
On Sat, Oct 28, 2017 at 08:41:34PM +, Martin Schöön wrote:

> It seems something is amiss with my Python 2.7 installation. Revisiting
> Nikola (static web site generator written in Python) for the first time
> in several years the other day I experience some unexpected problems. I
> got some help form the Nikola people and the conclusion is something
> is broken with my Python 2.7. Pip list throws exceptions at me
...
> All this is happening on a Debian machine.

Exceptions or crashes of the python interpreter ?

Karsten
-- 
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Coding style in CPython implementation

2017-10-28 Thread Ned Batchelder

On 10/28/17 4:26 PM, Stefan Ram wrote:

Ned Batchelder  writes:

On 10/28/17 3:00 PM, Stefan Ram wrote:

=?UTF-8?B?zqPPhM6tz4bOsc69zr/PgiDOo8+Jz4bPgc6/zr3Or86/z4U=?= 
 writes:

What I wanted to ask is, is there a particular reason for not choosing

definition of »NULL«. »NULL« is not part of the C language proper.

Especially if NULL is not part of the standard,

   »NULL« is defined in the standard, but it is an identifier
   from the library and, therefore, needs an »#include«.

   The language proper is the language core without any
   library added.

   The expression »NULL« AFAIK has only the meaning that
   usually is intended if one of the headers needed for
   it has been »#include«d.

   The operator »!« and the if-statement do not require
   any »#include«.



I certainly wouldn't adjust my coding style to avoid #include'ing the 
definition of NULL.


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


Repairing Python installation?

2017-10-28 Thread Martin Schöön
It seems something is amiss with my Python 2.7 installation. Revisiting
Nikola (static web site generator written in Python) for the first time
in several years the other day I experience some unexpected problems. I
got some help form the Nikola people and the conclusion is something
is broken with my Python 2.7. Pip list throws exceptions at me while
pip3 list works the way I expect it to do.

All this is happening on a Debian machine.

Questions:

Should I try to pinpoint what is broken (and how is that done) or should
I just remove everything Python 2.7 and re-install?

Could mixing pip installs with Debian distro installs of Python
packages lead to conflicts or other problems?

TIA,

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


[issue30696] infinite loop in PyRun_InteractiveLoopFlags()

2017-10-28 Thread Xavier de Gaye

Change by Xavier de Gaye :


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



[issue20047] bytearray partition bug

2017-10-28 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

To answer Mark, even though no longer nosy: In general, sequence methods 
.count, .index, and .__contains__ take sequence members and only members as 
arguments.  Unicode sequences are exceptional because codepoints are not Python 
objects, so string subsequences must be used instead.  Byte-like sequences are 
also exceptional in that both members and subsequences are accepted for these 
methods.

String-like sequence methods .split and .partition take subsequences as 
arguments.  I think the doc should make this clearer.

--

___
Python tracker 

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



[issue30696] infinite loop in PyRun_InteractiveLoopFlags()

2017-10-28 Thread Xavier de Gaye

Change by Xavier de Gaye :


--
pull_requests: +4129
stage:  -> patch review

___
Python tracker 

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



Re: Coding style in CPython implementation

2017-10-28 Thread Ned Batchelder

On 10/28/17 3:00 PM, Stefan Ram wrote:

=?UTF-8?B?zqPPhM6tz4bOsc69zr/PgiDOo8+Jz4bPgc6/zr3Or86/z4U=?= 
 writes:

What I wanted to ask is, is there a particular reason for not choosing

   I am not a CPython developer, but here are my 2 cents about
   the possibilities:


if (variable == NULL) { ... }
if (!variable) { ... }

   »!variable« is clearer, because it does not depend on the
   definition of »NULL«. »NULL« is not part of the C language proper.
Especially if NULL is not part of the standard, then you need to write 
"variable == NULL", since "!variable" may not have the same effect after 
"return NULL;" depending on how NULL is defined.


   (I sometimes like to write »if( variable ); else { ... }«.)

Ick.

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


Re: Compression of random binary data

2017-10-28 Thread Peter Pearson
On Thu, 26 Oct 2017 19:26:11 -0600, Ian Kelly  wrote:
>
> . . . Shannon entropy is correctly calculated for a data source,
> not an individual message . . .

Thank you; I was about to make the same observation.  When
people talk about the entropy of a particular message, you
can bet they're headed for confusion.

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20479] Efficiently support weight/frequency mappings in the statistics module

2017-10-28 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

My recommendation is to have *weights* as an optional argument:

statistics.mean(values, weights=None)

While it is tempting to special case dicts and counters, I got feedback from 
Jake Vanderplas and Wes McKinney that in practice it is more common to have the 
weights as a separate list/array/vector.

That API has other advantages as well.  For starters, it is a simple extension 
of the existing API, so it isn't a disruptive change.  Also, it works well with 
mapping views: 
   
   statistics.mean(vehicle_sales.keys(), vehicle_sales.values())

And the API also helps support use cases where different weightings are being 
explored for the same population:

   statistics.mean(salary, years_of_service)
   statistics.mean(salary, education)
   statistics.mean(salary, age)

--
nosy: +rhettinger
versions: +Python 3.7 -Python 3.5

___
Python tracker 

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



ANN: distlib 0.2.6 released on PyPI

2017-10-28 Thread Vinay Sajip via Python-announce-list
I've just released version 0.2.6 of distlib on PyPI [1]. For newcomers,distlib 
is a library of packaging functionality which is intended to beusable as the 
basis for third-party packaging tools.
The main changes in this release are as follows:
* Fixed #99: Updated to handle a case where sys.getfilesystemencoding()  
returns None.
* Fixed #97: Eliminated a crash in EggInfoDistribution.list_distinfo_files()  
which was caused by trying to open a non-existent file.
* Fixed #96: SimpleScrapingLocator no longer fails prematurely when scraping  
links due to invalid versions.
* Improved error messages issued when interpreting markers.
* Improved the shebangs written into installed scripts when the interpreter  
path is very long or contains spaces (to cater for a limitation in shebang  
line parsing on Linux).
* Updated launcher binaries.
A more detailed change log is available at [2].
Please try it out, and if you find any problems or have any suggestions 
forimprovements, please give some feedback using the issue tracker! [3]
Regards,

Vinay Sajip
[1] https://pypi.python.org/pypi/distlib/0.2.6[2] https://goo.gl/M3kQzR[3] 
https://bitbucket.org/pypa/distlib/issues/new

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

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


EuroPython 2017: Videos for Friday available online

2017-10-28 Thread M.-A. Lemburg
We are pleased to announce the last batch of cut videos for EuroPython 2017.

   * All 163 EuroPython 2017 videos are now online *

To see the new videos, please head over to our EuroPython YouTube
channel and select the "EuroPython 2017" playlist. The new videos start
at entry 129 in the playlist.

We have also published a few videos from Monday, we had missed in the
first batch.

  * EuroPython 2017 Videos *

http://europython.tv/


Enjoy,
--
EuroPython 2017 Team
http://ep2017.europython.eu/
http://www.europython-society.org/

PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/924283342291431424
Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


ANN: Pandas 0.21.0 Released

2017-10-28 Thread Tom Augspurger
Hi,

I'm pleased to announce the availability pandas 0.21.0.

This is a major release from 0.20.3 and includes a number of API changes,
deprecations, new features, enhancements, and performance improvements
along with a large number of bug fixes. We recommend that all users upgrade
to this version.

Highlights include:

- Integration with Apache Parquet , including a
new top-level read_parquet

function and a DataFrame.to_parquet

method, see here
.

- New user-facing dtype pandas.api.types.CategoricalDtype

for specifying categoricals independent of the data, see here

.

- The behavior of sum and prod on all-NaN Series/DataFrames is now
consistent and no longer depends on whether bottleneck
 is installed, see here

.

- Compatibility fixes for pypy, see here

.

- Additions to the drop, reindex, and rename API to make them more
consistent, see here


- Addition of the new methods DataFrame.infer_objects (see here
)
and GroupBy.pipe (see here

).

- Indexing with a list of labels, where one or more of the labels is
missing, is deprecated and will raise a KeyError in a future version, see
here

.


Check the whatsnew
 for
detailed changes, including backwards incompatible changes

and deprecations
.
Please report any issues you find on the pandas issue tracker
.

Binary packages will be available in the defaults and conda-forge channels
shortly.

conda install pandas

Wheels and a source distribution are available on PyPI.

pip install --upgrade pip setuptools
pip install --upgrade --upgrade-strategy=only-if-needed pandas



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

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


Re: Ide vs ide

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 6:10 AM, Stefan Ram  wrote:
> Rustom Mody  writes:
>>Useful python programs are often small; even tiny
>
>   We must not forget that tiny programs are just large
>   problems with the size masterfully hidden.
>
>   For example, the »print« of Python is actually implemented
>   by a subprogram (in C or Python) which invokes other subprograms.
>
>   If we would add the listing to all subprograms invoked
>   during the execution of a small Python script such as
>
> print( 2 )
>
>   , it would become much larger.
>
>   So this serves to illustrate
>
>  "Fools ignore complexity.
>   Pragmatists suffer it.
>   Some can avoid it.
>   Geniuses remove it."

At which point you're just arguing levels of abstraction. If someone
comes to me and says, hey look, I can do all this numerical
computation and analysis in one line of simple code, I won't argue
that it's not really "one line" just because it depends on Pandas -
I'll agree with him/her on the basis that Pandas grants you an
extremely high level of abstraction for data manipulation. That print
function does a lot of work, yes, but logically it does one thing: it
prints stuff out.

Tiny Python programs are still tiny in terms of elegance and
readability. And the CPython interpreter has over four hundred
separate files full of unit tests to help ensure that the lower
abstraction layers are correctly representing the intent of the higher
layers.

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


Re: Coding style in CPython implementation

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 5:42 AM, Στέφανος Σωφρονίου
 wrote:
> Greetings everyone.
>
> I have noticed that in many if conditions the following syntax is used:
>
> a) if (variable == NULL) { ... }
> b) if (variable == -1) { ... }
> c) if (variable != NULL) { ... }
>
> What I wanted to ask is, is there a particular reason for not choosing
>
> a) if (!variable) { ... } in place of if (variable == NULL) { ... },
> b) if (-1 == variable) { ... } in place of if (variable == -1) { ... }, and
> c) if (variable) { ... } in place of if (variable) { ... } ?
>
> Especially the (b) syntax is extremely dangerous to assign -1 to variable in 
> case of an accidental mistyping of equals sign; it had happened countless 
> times by now to to many of us that use various C-family languages.
>
> Is there a particular reason for using this specific coding style?

Have you read PEP 7?

https://www.python.org/dev/peps/pep-0007/

PEP 7 and PEP 8 are a pair of style guides that govern the CPython
source code - PEP 7 for the C code, and PEP 8 for the Python code in
the standard library. Unfortunately, many people seem to think that
PEP 8 is supposed to govern *their* code, and as such, end up not even
realizing that PEP 7 exists to answer all the same sorts of questions.

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


[issue16994] collections.Counter.least_common

2017-10-28 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Thank you for the suggestion, but I'm going to mark it as rejected for the 
reasons listed in the other posts.

--
resolution:  -> rejected
stage: patch review -> resolved
status: pending -> closed

___
Python tracker 

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



Re: Coding style in CPython implementation

2017-10-28 Thread bartc

On 28/10/2017 19:42, Στέφανος Σωφρονίου wrote:

Greetings everyone.

I have noticed that in many if conditions the following syntax is used:

a) if (variable == NULL) { ... }
b) if (variable == -1) { ... }
c) if (variable != NULL) { ... }

What I wanted to ask is, is there a particular reason for not choosing

a) if (!variable) { ... } in place of if (variable == NULL) { ... },
b) if (-1 == variable) { ... } in place of if (variable == -1) { ... }, and
c) if (variable) { ... } in place of if (variable) { ... } ?


(Presumably you meant variable != NULL)


Especially the (b) syntax is extremely dangerous to assign -1 to variable in 
case of an accidental mistyping of equals sign; it had happened countless times 
by now to to many of us that use various C-family languages.

Is there a particular reason for using this specific coding style?


Which one do you think is more readable?

Which style would you prefer to read?

Or do you prefer the more cryptic style in open source code?


(The = vs. == issue is of one of numerous design flaws in C, but 
uglifying source code to get around it isn't the answer.)




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


Coding style in CPython implementation

2017-10-28 Thread Στέφανος Σωφρονίου
Greetings everyone.

I have noticed that in many if conditions the following syntax is used:

a) if (variable == NULL) { ... }
b) if (variable == -1) { ... }
c) if (variable != NULL) { ... }

What I wanted to ask is, is there a particular reason for not choosing

a) if (!variable) { ... } in place of if (variable == NULL) { ... },
b) if (-1 == variable) { ... } in place of if (variable == -1) { ... }, and
c) if (variable) { ... } in place of if (variable) { ... } ?

Especially the (b) syntax is extremely dangerous to assign -1 to variable in 
case of an accidental mistyping of equals sign; it had happened countless times 
by now to to many of us that use various C-family languages.

Is there a particular reason for using this specific coding style?

Regards,

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


Re: What use is of this 'cast=float ,'?

2017-10-28 Thread Rick Johnson
On Friday, October 27, 2017 at 3:35:45 PM UTC-5, Robert wrote:
> I read below code snippet on line. I am interested in the
> second of the last line: `cast=float`. I've tried it in
> Python. Even simply with: `float` It has no error, but what
> use is it? 
> 
> self.freqslider=forms.slider(
>  parent=self.GetWin( ),
>  sizer=freqsizer,
>  value=self.freq,
>  callback= self.setfreq,
>  minimum=−samprate/2,
>  maximum=samprate/2,
>  num_steps=100,
>  style=wx.SL_HORIZONTAL,
>  cast=float ,
>  proportion=1,
> )

This is a fine example of the distinctly pungent form of
code-smell otherwise known as: "unintuitive naming
convention".

A more informative keyword argument would have been
something like "castFunc" or "castTo" or even "returnType",
any of which would indicate that the argument is (depending
on the specific implementation of course) expected to be a
function object or that some specific type of "casting
action" is to be performed on the return value. Whereas,
using the ambiguous word "cast" leaves too much to the
imagination. And while my crazy-uncle-who-lives-in-the-
basement swears that lingerie magazines are better than the
nudie mags (because, in the case of the former, more is
reserved for the imagination), an API that requires
imagination to grokk is a poorly designed API.

Here is an interactive example of assigning a builtin to a
generic, allbeit very _intuitive_, symbol.

>>> value = "12.3"
>>> type(value)

>>> castFunc = float
>>> valueAsFloat = castFunc(value)
>>> valueAsFloat
12.3
>>> type(valueAsFloat)

>>> value = "12.3"
#
# And now for integers...
#
>>> castfunc = int
>>> valueAsInteger = castfunc(value)
Traceback (most recent call last):
  File "", line 1, in 
valueAsInteger = castfunc(value)
ValueError: invalid literal for int() with base 10: '12.3'

Oops! O:-) Well, don't blame me because Python is so hobbled that
it cannot even convert a string-ified version of a float into
an integer. *SHRUGS*

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


sys.path[] question

2017-10-28 Thread ElChino

From the Python2.7 snippet in [1], Python2.7 reports that my
sys.path[] contains:
  f:\ProgramFiler\Python27\lib\site-packages\pyreadline-2.0-py2.7-win32.egg

(a .zip-file)

But I have also a 'f:\ProgramFiler\Python27\lib\site-packages\pyreadline'
directory. With the complete package AFAICS.

So my question is where will Python import a 'import pyreadline' from?
E.f. if I do a:
  python -vv 
f:\ProgramFiler\Python27\lib\site-packages\pyreadline\test\test_lineeditor.py

it shows a:
  # zipimport: found 89 names in 
F:\ProgramFiler\Python27\lib\site-packages\pyreadline-2.0-py2.7-win32.egg
But no other references to pyreadline-2.0-py2.7-win32.egg.

Does that mean that only this .egg is where python imports all pyreadline
files from? And if so, can I delete
  'f:\ProgramFiler\Python27\lib\site-packages\pyreadline' ?

--

[1]: in a py-path.bat file:
   f:\ProgramFiler\Python27\python.exe -c "import sys; [sys.stdout.write('%%2d: %%s\n' %% (i,p)) for (i,p) in 
enumerate(sys.path)]"


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


[issue31890] Please define the flag METH_STACKLESS for Stackless Python

2017-10-28 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +haypo

___
Python tracker 

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



[issue31890] Please define the flag METH_STACKLESS for Stackless Python

2017-10-28 Thread Anselm Kruis

Change by Anselm Kruis :


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

___
Python tracker 

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



[issue31890] Please define the flag METH_STACKLESS for Stackless Python

2017-10-28 Thread Anselm Kruis

New submission from Anselm Kruis :

The header Include/methodobject.h defines ml_flags METH_xxx.

Stackless Python adds the flag METH_STACKLESS. Traditionally Stackless used bit 
0x0080 for METH_STACKLESS, but starting with C-Python 3.6 bit 0x0080 is used 
for METH_FASTCALL. 

In order to prevent future conflicts, I propose to add METH_STACKLESS to 
methodobject.h. 

#ifdef STACKLESS
#define METH_STACKLESS 0x0100
#else
#define METH_STACKLESS 0x
#endif

Include/object.h already contains a similar definition.

--
components: Interpreter Core
messages: 305164
nosy: anselm.kruis
priority: normal
severity: normal
status: open
title: Please define the flag METH_STACKLESS for Stackless Python
type: enhancement
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue20047] bytearray partition bug

2017-10-28 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



Re: Ide vs ide

2017-10-28 Thread Andrew Z
I like this trajectory of conversation.
Can we re define "small tiny" as "scripts"?
 i can argue, based on my expirience with other languages, that there is no
need for an "ide". The most ive ever needed is a text editor and a few
plugins with "print".

Moving to "average" size projects.
What i found useful and what i use constantly:
 Built in, up to date, correct! help on _installed_classes, functions. The
golden standard all these years for me was Delphi (2,3).
 Drop downs to show list of functions for an object. Also validates your
logic as far as you  use of correct variable, type etc.
Templates- define a language construct,
Type a shortcut and get the whole construct inserted. Saves typing.
Built-in change control,  build.

This is the main functionality i use . Needless to say the ide itself has
to be professional. And, since im not doing coding 24x7, i prefer "buttons"
as opposite to shortcut-to-find-the-shortcut-so-i-can-shortcut to get the
action. (Yeah, i found myself far less productive  while using atom and
company).at the same time, using editors like atom, whenyou work with
multiple filetypes is a gods sent .





On Oct 28, 2017 07:40, "Rustom Mody"  wrote:

> On Saturday, October 28, 2017 at 4:46:03 PM UTC+5:30, Christian Gollwitzer
> wrote:
> > Am 28.10.17 um 09:04 schrieb Rustom Mody:
> > > [The other day I was writing a program to split alternate lines of a
> file;
> > > Apart from file-handling it was these two lines:
> > >
> > >  for x in lines[0::2]:   print(x.strip())
> > >  for x in lines[1::2]:   print(x.strip())
> > > ]
> >
> > ...and using the best(TM) tool for it, it is a one-liner:
> >
> > gawk '{ print > "split" NR%2}' input.txt
>
> Ooo!¡!
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20047] bytearray partition bug

2017-10-28 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
versions: +Python 2.7, Python 3.6, Python 3.7 -Python 3.3, Python 3.4

___
Python tracker 

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



Re: Compression of random binary data

2017-10-28 Thread Ben Bacarisse
Steve D'Aprano  writes:

> On Fri, 27 Oct 2017 09:53 am, Ben Bacarisse wrote:
>
>> A source of random can be defined but "random data" is much more
>> illusive.
>
> Random data = any set of data generated by "a source of random".

(I had an editing error there; it should be "a source of random data".)

Yes, that's a fine definition, but it has the disadvantage of not being
a verifiable property of the thing defined -- you can't know, from the
data themselves, if they constitute random data.  You would not care
about a compression program that worked on some data that looks random,
you'd want to present your own data for compression (and then you can
use a random source with confidence because the data are yours).  That's
the big win (for me) of talking about "arbitrary data".

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


Re: Python noob having a little trouble with strings

2017-10-28 Thread William Ray Wing
OSX has been shipping with Python 2.7 for several years.  I’m not sure why you 
are seeing 2.6.

Bill

> On Oct 27, 2017, at 2:48 AM, Lutz Horn  wrote:
> 
> On Thu, Oct 26, 2017 at 07:59:10PM -0700, randyli...@gmail.com wrote:
>> Hi Bob, thanks for responding. I'm not sure where to do so, my
>> professor had us download Pycharm for mac's which uses python 2.6
> 
> The code from your question is not specific to Python 2 or 3. Just try
> it in the Python installation you have available.
> 
> Lutz
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


EuroPython 2017: Videos for Friday available online

2017-10-28 Thread M.-A. Lemburg
We are pleased to announce the last batch of cut videos for EuroPython 2017.

   * All 163 EuroPython 2017 videos are now online *

To see the new videos, please head over to our EuroPython YouTube
channel and select the "EuroPython 2017" playlist. The new videos start
at entry 129 in the playlist.

We have also published a few videos from Monday, we had missed in the
first batch.

  * EuroPython 2017 Videos *

http://europython.tv/


Enjoy,
--
EuroPython 2017 Team
http://ep2017.europython.eu/
http://www.europython-society.org/

PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/924283342291431424
Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-10-28 Thread Stefan Krah

Stefan Krah  added the comment:

Ah sorry, you mean it cannot write the special bytes.

--

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-10-28 Thread Stefan Krah

Stefan Krah  added the comment:

> realloc() must not touch the original buffer on failure

I don't understand this: If realloc() fails, the original buffer
is perfectly valid.

--
nosy: +skrah

___
Python tracker 

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



[issue19891] Exiting Python REPL prompt with user without home directory throws error in atexit._run_exitfuncs

2017-10-28 Thread Andreas Krüger

Andreas Krüger  added the comment:

I can easily reproduce the problem with Docker,
and it does seem to be a permission problem:

$ docker run -ti --rm --user=":" python:3.6.3-jessie bash -c 
"python3"
Python 3.6.3 (default, Oct 10 2017, 02:29:16) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Error in atexit._run_exitfuncs:
PermissionError: [Errno 13] Permission denied

$ docker run -ti --rm --user=":" python:3.6.3-jessie bash -c 
"HOME=/tmp python3; ls -lta /tmp"
Python 3.6.3 (default, Oct 10 2017, 02:29:16) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
total 8
drwxrwxrwt  2 root root 4096 Oct 28 14:10 .
drwxr-xr-x 55 root root 4096 Oct 28 14:10 ..
-rw---  1  0 Oct 28 14:10 .python_history

--
nosy: +dj3ei
versions: +Python 3.6

___
Python tracker 

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



Re: Compression of random binary data

2017-10-28 Thread Steve D'Aprano
On Fri, 27 Oct 2017 09:53 am, Ben Bacarisse wrote:

> A source of random can be defined but "random data" is much more
> illusive.

Random data = any set of data generated by "a source of random".





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


[issue20479] Efficiently support weight/frequency mappings in the statistics module

2017-10-28 Thread Serhiy Storchaka

Change 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



[issue31860] IDLE: Make font sample editable

2017-10-28 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
pull_requests:  -4125

___
Python tracker 

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



Re: from packaging import version as pack_version ImportError: No module named packaging

2017-10-28 Thread David Gabriel
I forget to precise that I am using pycharm.
And this issue is reproducible also using command line to run the code.

Best regards

2017-10-28 14:31 GMT+02:00 David Gabriel :

> Thanks so Lutz much for your reply.
> I am using python2.7 and I am running this code in an Openstack instance.
> I will apply your recommandation and let you know about the result ...
>
> Kind regards.
>
> 2017-10-27 16:13 GMT+02:00 Lutz Horn :
>
>> On Fri, Oct 27, 2017 at 03:56:39PM +0200, David Gabriel wrote:
>> > from packaging import version as pack_version
>> > ImportError: No module named packaging
>> >
>> > I googled it and I have found so many suggestions regarding updating
>> > 'pip' and installing python-setuptools but all of these did not fix
>> > this issue.
>>
>> So many questions:
>>
>> * What is your Python version?
>> * Do you use virtualenv?
>> * How?
>> * Did you install packaging in this virtualenv?
>>
>> Just one example of making this work:
>>
>> $ mkdir /tmp/pack
>> $ cd /tmp/pack
>> $ virtualenv -p $(which python3.5) .
>> Running virtualenv with interpreter /usr/bin/python3.5
>> Using base prefix '/usr'
>> New python executable in /tmp/pack/bin/python3.5
>> Also creating executable in /tmp/pack/bin/python
>> Installing setuptools, pkg_resources, pip, wheel...done.
>> $ source bin/activate
>> $ pip3 install packaging
>> Collecting packaging
>>   Using cached packaging-16.8-py2.py3-none-any.whl
>> Collecting six (from packaging)
>>   Using cached six-1.11.0-py2.py3-none-any.whl
>> Collecting pyparsing (from packaging)
>>   Using cached pyparsing-2.2.0-py2.py3-none-any.whl
>> Installing collected packages: six, pyparsing, packaging
>> Successfully installed packaging-16.8 pyparsing-2.2.0 six-1.11.0
>> $ python3.5
>> Python 3.5.2 (default, Sep 14 2017, 22:51:06)
>> [GCC 5.4.0 20160609] on linux
>> Type "help", "copyright", "credits" or "license" for more
>> information.
>> >>> from packaging import version as pack_version
>> >>>
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: from packaging import version as pack_version ImportError: No module named packaging

2017-10-28 Thread David Gabriel
Thanks so Lutz much for your reply.
I am using python2.7 and I am running this code in an Openstack instance.
I will apply your recommandation and let you know about the result ...

Kind regards.

2017-10-27 16:13 GMT+02:00 Lutz Horn :

> On Fri, Oct 27, 2017 at 03:56:39PM +0200, David Gabriel wrote:
> > from packaging import version as pack_version
> > ImportError: No module named packaging
> >
> > I googled it and I have found so many suggestions regarding updating
> > 'pip' and installing python-setuptools but all of these did not fix
> > this issue.
>
> So many questions:
>
> * What is your Python version?
> * Do you use virtualenv?
> * How?
> * Did you install packaging in this virtualenv?
>
> Just one example of making this work:
>
> $ mkdir /tmp/pack
> $ cd /tmp/pack
> $ virtualenv -p $(which python3.5) .
> Running virtualenv with interpreter /usr/bin/python3.5
> Using base prefix '/usr'
> New python executable in /tmp/pack/bin/python3.5
> Also creating executable in /tmp/pack/bin/python
> Installing setuptools, pkg_resources, pip, wheel...done.
> $ source bin/activate
> $ pip3 install packaging
> Collecting packaging
>   Using cached packaging-16.8-py2.py3-none-any.whl
> Collecting six (from packaging)
>   Using cached six-1.11.0-py2.py3-none-any.whl
> Collecting pyparsing (from packaging)
>   Using cached pyparsing-2.2.0-py2.py3-none-any.whl
> Installing collected packages: six, pyparsing, packaging
> Successfully installed packaging-16.8 pyparsing-2.2.0 six-1.11.0
> $ python3.5
> Python 3.5.2 (default, Sep 14 2017, 22:51:06)
> [GCC 5.4.0 20160609] on linux
> Type "help", "copyright", "credits" or "license" for more
> information.
> >>> from packaging import version as pack_version
> >>>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue18534] State clearly that open() 'file' param is "name" attr of the result

2017-10-28 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue1243730] Big speedup in email message parsing

2017-10-28 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-28 Thread Stefan Krah

Stefan Krah  added the comment:

> The ways we've discussed using aligned allocation in numpy wouldn't follow 
> this requirement without special checking. Which isn't necessarily a big 
> deal, and numpy won't necessarily use this API anyway. But I would suggest 
> being very clear about exactly what you guarantee and what you don't :-).

In the GitHub issue we sort of decided to make the more relaxed Posix
semantics official:

'alignment' must be a power of 2 and a multiple of 'sizeof(void *)'.

'size' can be really anything, so it should work for numpy.

It's a pity that Posix does not round up align={1,2,4} to 'sizeof(void *)'
automatically (why not?), so the applications will have to do that.

--

___
Python tracker 

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



ANN: distlib 0.2.6 released on PyPI

2017-10-28 Thread Vinay Sajip via Python-list
I've just released version 0.2.6 of distlib on PyPI [1]. For newcomers,distlib 
is a library of packaging functionality which is intended to beusable as the 
basis for third-party packaging tools.
The main changes in this release are as follows:
* Fixed #99: Updated to handle a case where sys.getfilesystemencoding()  
returns None.
* Fixed #97: Eliminated a crash in EggInfoDistribution.list_distinfo_files()  
which was caused by trying to open a non-existent file.
* Fixed #96: SimpleScrapingLocator no longer fails prematurely when scraping  
links due to invalid versions.
* Improved error messages issued when interpreting markers.
* Improved the shebangs written into installed scripts when the interpreter  
path is very long or contains spaces (to cater for a limitation in shebang  
line parsing on Linux).
* Updated launcher binaries.
A more detailed change log is available at [2].
Please try it out, and if you find any problems or have any suggestions 
forimprovements, please give some feedback using the issue tracker! [3]
Regards,

Vinay Sajip
[1] https://pypi.python.org/pypi/distlib/0.2.6[2] https://goo.gl/M3kQzR[3] 
https://bitbucket.org/pypa/distlib/issues/new

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


[issue31775] Support unbuffered TextIOWrapper

2017-10-28 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue22671] Typo in class io.BufferedIOBase docs

2017-10-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Do you mind to create a PR Martin?

--
assignee: docs@python -> martin.panter
nosy: +serhiy.storchaka
versions: +Python 3.6, Python 3.7 -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



[issue17418] Documentation links for io.open

2017-10-28 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue15606] re.VERBOSE whitespace behavior not completely documented

2017-10-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Steven, would you mind to update your patch according to review comments and 
create a pull request on GitHub?

--
stage: patch review -> needs patch
versions: +Python 2.7, Python 3.6, Python 3.7 -Python 3.3

___
Python tracker 

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



[issue31836] test_code_module fails after test_idle

2017-10-28 Thread Terry J. Reedy

Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue31836] test_code_module fails after test_idle

2017-10-28 Thread Terry J. Reedy

Terry J. Reedy  added the comment:


New changeset 8ed5644f78e57cd59813097b35906ad6f1775f95 by Terry Jan Reedy (Miss 
Islington (bot)) in branch '3.6':
bpo-31836: Test_code_module now passes with sys.ps1, ps2 set (GH-4070) (#4156)
https://github.com/python/cpython/commit/8ed5644f78e57cd59813097b35906ad6f1775f95


--

___
Python tracker 

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



Re: Ide vs ide

2017-10-28 Thread Rustom Mody
On Saturday, October 28, 2017 at 4:46:03 PM UTC+5:30, Christian Gollwitzer 
wrote:
> Am 28.10.17 um 09:04 schrieb Rustom Mody:
> > [The other day I was writing a program to split alternate lines of a file;
> > Apart from file-handling it was these two lines:
> > 
> >  for x in lines[0::2]:   print(x.strip())
> >  for x in lines[1::2]:   print(x.strip())
> > ]
> 
> ...and using the best(TM) tool for it, it is a one-liner:
> 
> gawk '{ print > "split" NR%2}' input.txt

Ooo!¡!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue16994] collections.Counter.least_common

2017-10-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This proposition was discussed also on Python-Ideas 
(https://mail.python.org/pipermail/python-ideas/2017-March/045215.html).

I think it should be rejected. In general this doesn't make sense. In rare 
cases when you want to to get the least common items in the Counter (I don't 
know any practical examples), you can take a list of all items sorted by the 
value and take few last items.

--
assignee:  -> rhettinger
status: open -> pending

___
Python tracker 

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



Re: Ide vs ide

2017-10-28 Thread Christian Gollwitzer

Am 28.10.17 um 09:04 schrieb Rustom Mody:

[The other day I was writing a program to split alternate lines of a file;
Apart from file-handling it was these two lines:

 for x in lines[0::2]:   print(x.strip())
 for x in lines[1::2]:   print(x.strip())
]


...and using the best(TM) tool for it, it is a one-liner:

gawk '{ print > "split" NR%2}' input.txt



So coming to your question: IDEs are good for medium and (diminishingly) for 
large programs.


agreed


Useful python programs are often small; even tiny



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


[issue1617161] Instance methods compare equal when their self's are equal

2017-10-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Armin, do you mind to create a pull request on GitHub?

--
type: enhancement -> behavior
versions: +Python 3.6, Python 3.7 -Python 3.4

___
Python tracker 

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



[issue11383] compilation seg faults on insanely large expressions

2017-10-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

If someone will backport an issue5765 patch to 2.7, he can open a new issue or 
reopen issue5765.

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-10-28 Thread Xavier de Gaye

Change by Xavier de Gaye :


--
nosy: +xdegaye

___
Python tracker 

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



[issue31889] difflib SequenceMatcher ratio() still have unpredictable behavior

2017-10-28 Thread Simon Descarpentries

New submission from Simon Descarpentries :

I, it's my 1st post here. I'm a French computer-science engineer with 10 years 
XP and manager at Acoeuro.com SSLL compagny. I suggested a better regexp 
integration on python-ideas a few months ago failing to convince getting things 
done.

Despite issue https://bugs.python.org/issue25391 closed in 2010, nothing seems 
visible on https://docs.python.org/3/library/difflib.html to help users 
anticipating that a string greatly matching at 199 characters length, won't at 
all at the 200th one. It's an inconsistent behavior that looks like a bug.

#!/usr/bin/env python3

from difflib import SequenceMatcher

a = 'ab'*400

b = 'ba'*400

for i in range(1, 400):
diff_ratio = SequenceMatcher(None, a=a[:i], b=b[:i]).ratio()
print('%3.i %.2f' % (i, diff_ratio), end=' ')
not i % 10 and print('')

EOF

At 199c I have a 0.99 ratio, and 0.00 at 200c. The results are nearly the same 
with strings made of emails like in 
https://github.com/Siltaar/drop_alternatives especially comparing strings like 
: 

"performantsetdvelopperducontenusimilairepourvosprochainstweets.suivezn...@twitterbusinesspourdautresinfosetactus.testerlespublicitstwitterbusiness.twitter.com|@TwitterBusiness|Aide|SedsinscrireLemailsadresse@gggTwitter,Inc.MarketStreet,SuiteSanFrancisco,CA"

"rducontenusimilairepourvosprochainsTweets.Suiveznous@TwitterBusinesspourprofiterdautresinfosetactus.TesterlesPublicitésTwitterbusiness.twitter.com@TwitterBusinessAideSedésinscrireTwitterInternationalCompanyOneCumberlandPlace,FenianStreetDublin,DAXIRELAND"

Fortunately, I didn't experienced the problem using quick_ratio().

The documentation is not clear about ratio / quick_ratio / real_quick_ratio ; 
but looks like unstable. With in addition an inconsistent behavior it looks 
like worthing some fix.

--
components: Library (Lib)
messages: 305153
nosy: Siltaar
priority: normal
severity: normal
status: open
title: difflib SequenceMatcher ratio() still have unpredictable behavior
type: behavior
versions: Python 2.7, 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



[issue31871] Support for file descriptor params in os.path

2017-10-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Éric, see https://docs.python.org/3/library/os.html#files-and-directories.

Yes, now some os.path functions can accept a file descriptor as a path. I don't 
think this is intentional. And this may not work on all platforms.

>>> os.path.isdir(1)
False
>>> os.path.islink(1)
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/posixpath.py", line 169, in islink
st = os.lstat(path)
TypeError: lstat: path should be string, bytes or os.PathLike, not int

--
nosy: +serhiy.storchaka

___
Python tracker 

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



testfixtures 5.3.0 released!

2017-10-28 Thread Chris Withers

Hi All,

I'm pleased to announce the release of testfixtures 5.3.0 featuring the 
following:


 * Add pytest traceback hiding for|TempDirectory.compare()|.
 * Add warnings that|log_capture()|,|tempdir()|and|replace()|are not
   currently compatible with pytest’s fixtures mechanism.
 * Better support for|stdout|or|stderr|/not/being set to|PIPE|when
   using|MockPopen|.
 * Add support to|MockPopen|for using|subprocess.Popen|
   as
   a context manager in Python 3.
 * Add support to|MockPopen|for|stderr=STDOUT|.

Thanks to Tim Davies for his work on|MockPopen|.

The package is on PyPI and a full list of all the links to docs, issue 
trackers and the like can be found here:


https://github.com/Simplistix/testfixtures

Any questions, please do ask on the Testing in Python list or on the 
Simplistix open source mailing list...


cheers,

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


Re: Keep or drop index.html from Django?

2017-10-28 Thread Thomas Jollans
On 28/10/17 08:55, Christopher Reimer wrote:
> Greetings,
> 
> When I set up my static website using Pelican several years ago, many URLs 
> ended with index.html. Now that I'm looking at Django, I got a small set of 
> URLs working with and without index.html to point to the correct pages.
> 
> I read somewhere that the Django philosophy was to keep the URLs as clean as 
> possible (i.e., no *.html at the end). I can go either way with this. What's 
> the best practice for this?

Best practice is to keep your URLs working in one way or another.

As you said, with Django it's unusual to add artificial file endings
like ".html". I'd recommend setting up the URLs in a way that makes
sense to you now (probably without index.html and so on) and set up HTTP
301 redirects to get your visitors to the right place. (Probably best in
the web server configuration, but you can do this in Django)

-- Thomas



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


[issue25612] nested try..excepts don't work correctly for generators

2017-10-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The problem I mentioned in msg304117 has been resolved in backward direction: 
"raise" outside of an except block don't raise a RuntimeError.

--
status: closed -> open

___
Python tracker 

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



[issue25612] nested try..excepts don't work correctly for generators

2017-10-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Note that removing exc_type, exc_value and exc_traceback from PyThreadState 
breaks Cython.

--
nosy: +scoder

___
Python tracker 

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



[issue31888] Creating a UUID with a list throws bad exception

2017-10-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This is a consequence of duck-typing and is common in Python. If you pass a 
value of wrong type, it is expected that you can get an AttributeError.

Explicit type checks clutter and slow down the code, and make it less flexible.

You can test an explicit type before calling uuid.UUID() in your code if you 
need.

--
nosy: +serhiy.storchaka
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



Re: Ide vs ide

2017-10-28 Thread Rustom Mody
On Saturday, October 28, 2017 at 11:59:14 AM UTC+5:30, Andrew Z wrote:
> Yeah, lets start the war!
> // joking!
> 
> But if i think about it... there are tons articles and flame wars about "a
> vs b".
> And yet, what if the question should be different:
> 
> If you were to create the "ide" for yourself (think lego) , what are the
> functions that you _use_ and like a lot?

[Not really an answer to your question…]
But in a related direction:

I think we need to talk more systematically about 
- programming-in-the-small:  [< 70 lines — one or so screenfuls; only 1 file]
- -in-the-medium : all files in one directory
- -in-the-large : multiple directories/languages/OSes etc
- -huge : millions of lines; thousands of man-years

I think one of the main attractions (to me but also generally to teachers)
is that languages like python make programming-in-the-tiny a realistic 
possibility
ie a couple of lines worked out possibly file-less, at the interpreter prompt.

[The other day I was writing a program to split alternate lines of a file;
Apart from file-handling it was these two lines:

for x in lines[0::2]:   print(x.strip())
for x in lines[1::2]:   print(x.strip())
]

So coming to your question: IDEs are good for medium and (diminishingly) for 
large programs.

Useful python programs are often small; even tiny
-- 
https://mail.python.org/mailman/listinfo/python-list


Keep or drop index.html from Django?

2017-10-28 Thread Christopher Reimer
Greetings,

When I set up my static website using Pelican several years ago, many URLs 
ended with index.html. Now that I'm looking at Django, I got a small set of 
URLs working with and without index.html to point to the correct pages.

I read somewhere that the Django philosophy was to keep the URLs as clean as 
possible (i.e., no *.html at the end). I can go either way with this. What's 
the best practice for this?

Thank you,

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


Re: from packaging import version as pack_version ImportError: No module named packaging

2017-10-28 Thread Lutz Horn
On Fri, Oct 27, 2017 at 03:56:39PM +0200, David Gabriel wrote:
> from packaging import version as pack_version
> ImportError: No module named packaging
> 
> I googled it and I have found so many suggestions regarding updating
> 'pip' and installing python-setuptools but all of these did not fix
> this issue.

So many questions:

* What is your Python version?
* Do you use virtualenv?
* How?
* Did you install packaging in this virtualenv?

Just one example of making this work:

$ mkdir /tmp/pack
$ cd /tmp/pack
$ virtualenv -p $(which python3.5) .
Running virtualenv with interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in /tmp/pack/bin/python3.5
Also creating executable in /tmp/pack/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
$ source bin/activate
$ pip3 install packaging
Collecting packaging
  Using cached packaging-16.8-py2.py3-none-any.whl
Collecting six (from packaging)
  Using cached six-1.11.0-py2.py3-none-any.whl
Collecting pyparsing (from packaging)
  Using cached pyparsing-2.2.0-py2.py3-none-any.whl
Installing collected packages: six, pyparsing, packaging
Successfully installed packaging-16.8 pyparsing-2.2.0 six-1.11.0
$ python3.5
Python 3.5.2 (default, Sep 14 2017, 22:51:06)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more
information.
>>> from packaging import version as pack_version   
>>> 
>>>  
>>>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python noob having a little trouble with strings

2017-10-28 Thread Lutz Horn
On Thu, Oct 26, 2017 at 07:59:10PM -0700, randyli...@gmail.com wrote:
> Hi Bob, thanks for responding. I'm not sure where to do so, my
> professor had us download Pycharm for mac's which uses python 2.6

The code from your question is not specific to Python 2 or 3. Just try
it in the Python installation you have available.

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


Re: SciPy 1.0 released!

2017-10-28 Thread Paul Dubois
The DNA of this work goes much further back. After some discussion as
mentioned, Jim Hugunin wrote a numerical extension (called Numerical) and
after a bit I took over as its coordinator with financial support for my
work from Lawrence Livermore National Laboratory. They also supported the
Foundation. I do not remember the exact timing but certainly Numerical was
running before the 4th International was held at the Lab in the early 90s.
Guido put in the complex type and other things to help us. We had endless
discussion amongst us as how to spell it: 1i or 1j!

One should note that the Lab was breaking new ground in supporting an open
source project. SciPy was born to try to improve and extend a product that
was already crucial to a lot of people. Indeed, it is a big part of several
ongoing projects. Even non-numerical applications are important there.

I retired in 2005, and everyone who writes software knows that what they do
is ephemeral, but I don’t want history to be lost so soon.

Paul Dubois
... moving as we speak to La Mesa, CA



On Wed, Oct 25, 2017 at 5:05 AM Ralf Gommers  wrote:

> Hi all,
>
> We are extremely pleased to announce the release of SciPy 1.0, 16 years
> after
> version 0.1 saw the light of day.  It has been a long, productive journey
> to
> get here, and we anticipate many more exciting new features and releases in
> the
> future.
>
>
> Why 1.0 now?
> 
>
> A version number should reflect the maturity of a project - and SciPy was a
> mature and stable library that is heavily used in production settings for a
> long time already.  From that perspective, the 1.0 version number is long
> overdue.
>
> Some key project goals, both technical (e.g. Windows wheels and continuous
> integration) and organisational (a governance structure, code of conduct
> and a
> roadmap), have been achieved recently.
>
> Many of us are a bit perfectionist, and therefore are reluctant to call
> something "1.0" because it may imply that it's "finished" or "we are 100%
> happy
> with it".  This is normal for many open source projects, however that
> doesn't
> make it right.  We acknowledge to ourselves that it's not perfect, and
> there
> are some dusty corners left (that will probably always be the case).
> Despite
> that, SciPy is extremely useful to its users, on average has high quality
> code
> and documentation, and gives the stability and backwards compatibility
> guarantees that a 1.0 label imply.
>
>
> Some history and perspectives
> -
>
> - 2001: the first SciPy release
> - 2005: transition to NumPy
> - 2007: creation of scikits
> - 2008: scipy.spatial module and first Cython code added
> - 2010: moving to a 6-monthly release cycle
> - 2011: SciPy development moves to GitHub
> - 2011: Python 3 support
> - 2012: adding a sparse graph module and unified optimization interface
> - 2012: removal of scipy.maxentropy
> - 2013: continuous integration with TravisCI
> - 2015: adding Cython interface for BLAS/LAPACK and a benchmark suite
> - 2017: adding a unified C API with scipy.LowLevelCallable; removal of
> scipy.weave
> - 2017: SciPy 1.0 release
>
>
> **Pauli Virtanen** is SciPy's Benevolent Dictator For Life (BDFL).  He
> says:
>
> *Truthfully speaking, we could have released a SciPy 1.0 a long time ago,
> so I'm
> happy we do it now at long last. The project has a long history, and during
> the
> years it has matured also as a software project.  I believe it has well
> proved
> its merit to warrant a version number starting with unity.*
>
> *Since its conception 15+ years ago, SciPy has largely been written by and
> for
> scientists, to provide a box of basic tools that they need. Over time, the
> set
> of people active in its development has undergone some rotation, and we
> have
> evolved towards a somewhat more systematic approach to development.
> Regardless,
> this underlying drive has stayed the same, and I think it will also
> continue
> propelling the project forward in future. This is all good, since not long
> after 1.0 comes 1.1.*
>
> **Travis Oliphant** is one of SciPy's creators.  He says:
>
> *I'm honored to write a note of congratulations to the SciPy developers and
> the
> entire SciPy community for the release of SciPy 1.0.   This release
> represents
> a dream of many that has been patiently pursued by a stalwart group of
> pioneers
> for nearly 2 decades.   Efforts have been broad and consistent over that
> time
> from many hundreds of people.   From initial discussions to efforts coding
> and
> packaging to documentation efforts to extensive conference and community
> building, the SciPy effort has been a global phenomenon that it has been a
> privilege to participate in.*
>
> *The idea of SciPy was already in multiple people’s minds in 1997 when I
> first
> joined the Python community as a young graduate student who had just fallen
> in
> love with the expressibility and extensibility of Python.   The internet
> was
> 

Ide vs ide

2017-10-28 Thread Andrew Z
Yeah, lets start the war!
// joking!

But if i think about it... there are tons articles and flame wars about "a
vs b".
And yet, what if the question should be different:

If you were to create the "ide" for yourself (think lego) , what are the
functions that you _use_ and like a lot?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python noob having a little trouble with strings

2017-10-28 Thread Naman Bhalla
I guess your professor just asked you to download Pycharm. It is just MacOS 
that happens to have Python 2.6 inbuilt. Had your professor actually wanted you 
to be using Python 2 (I doubt), that would have been 2.7. Regardless of that I 
recommend having latest Python 2 or 3 as per your requirements, from 
python.org. 
In Pycharm, you can access Python Console from bottom right (Make sure you 
select correct version of Python in your project settings.) Or in MacOS, just 
type python and then type commands and check for yourself.
BTW, You can know more about what you are going to test here:- 
https://docs.python.org/3/tutorial/introduction.html#strings

Regards.

On 27/10/17, 08:33, "python-list-bounces+dev=namanbhalla...@python.org on 
behalf of randyli...@gmail.com" 
 wrote:

On Thursday, October 26, 2017 at 7:41:10 PM UTC-7, boB Stepp wrote:
> On Thu, Oct 26, 2017 at 9:25 PM,   wrote:
> > If s1 = "Welcome students", what is the output when you print the 
following:
> >
> > 1. s4 = 3 * s1
> >
> > 2. s1[3 : 6]
> >
> > 3. 'W' in s1
> >
> > 4. S1[-1]
> >
> > 5. S1[:-1]
> >
> > Any help would be great, thanks!
> 
> Why not find out for yourself and print these in the Python
> interpreter?  For instance:
> 
> > py
> Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:57:36) [MSC v.1900 64
> bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> py3: s1 = "Welcome students"
> py3: s4 = 3 * s1
> py3: print(s4)
> Welcome studentsWelcome studentsWelcome students
> 
> 
> 
> -- 
> boB

Hi Bob, thanks for responding. I'm not sure where to do so, my professor 
had us download Pycharm for mac's which uses python 2.6
-- 
https://mail.python.org/mailman/listinfo/python-list



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