[issue28414] SSL match_hostname fails for internationalized domain names

2018-02-20 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Christian: we're less than a week out from b2. Do you need any help here?

--

___
Python tracker 

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



[issue31106] os.posix_fallocate() generate exception with errno 0

2018-02-20 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

The failed test is test_posix_fallocate, not test_posix_fallocate_errno. The 
former special-cases Solaris for EINVAL already, and the latter merely passes 
an invalid descriptor.

It seems that this particular issue is still open only because there is no NEWS 
entry in the merged commits.

--
nosy: +izbyshev

___
Python tracker 

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



[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2018-02-20 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Pickles containing a reference to Integer and created in new versions will be 
not compatible with older versions.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue32880] IDLE: Fix and update and cleanup pyparse

2018-02-20 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Is
str = str.replace('', 'x')
str = str.replace('', 'x')
str = str.replace('xx', 'x')
str = str.replace('xx', 'x')
really faster than
_squashex = re.compile('x+').sub  # top of file
_squashex('x', str)

And are the name bindings faster that regex.func(...)?

--

___
Python tracker 

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



[issue31848] "aifc" module does not always initialize "Aifc_read._ssnd_chunk"

2018-02-20 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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



[issue32889] Valgrind suppressions need updating

2018-02-20 Thread miss-islington

miss-islington  added the comment:


New changeset 1e8bc25594db3f36a3f228531bce0ed1b99c2d8d by Miss Islington (bot) 
in branch '3.6':
bpo-32889: update valgrind suppressions (GH-5779)
https://github.com/python/cpython/commit/1e8bc25594db3f36a3f228531bce0ed1b99c2d8d


--

___
Python tracker 

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



[issue31848] "aifc" module does not always initialize "Aifc_read._ssnd_chunk"

2018-02-20 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset b852d8c1f0b12e84549d83cd9b1ec0992b9d9703 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '2.7':
[2.7] bpo-31848: Fix broken error handling in Aifc_read.initfp() when the SSND 
chunk is not found (GH-5240) (GH-5781)
https://github.com/python/cpython/commit/b852d8c1f0b12e84549d83cd9b1ec0992b9d9703


--

___
Python tracker 

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



[issue32889] Valgrind suppressions need updating

2018-02-20 Thread miss-islington

miss-islington  added the comment:


New changeset 69607b4ecf917aea59632ff72695a97a6689ed8c by Miss Islington (bot) 
in branch '3.7':
bpo-32889: update valgrind suppressions (GH-5779)
https://github.com/python/cpython/commit/69607b4ecf917aea59632ff72695a97a6689ed8c


--
nosy: +miss-islington

___
Python tracker 

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



[issue32008] Example suggest to use a TLSv1 socket

2018-02-20 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset 6c7edba1665ea676328c6b50f92e8423c8f0d164 by Benjamin Peterson in 
branch '2.7':
[2.7] closes bpo-32008: don't use PROTOCOL_TLSv1 in example (GH-5789) (#5792)
https://github.com/python/cpython/commit/6c7edba1665ea676328c6b50f92e8423c8f0d164


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



[issue32008] Example suggest to use a TLSv1 socket

2018-02-20 Thread miss-islington

miss-islington  added the comment:


New changeset f8a794c04c8d375da279fc830770a5e6b4f363fb by Miss Islington (bot) 
in branch '3.6':
bpo-32008: don't use PROTOCOL_TLSv1 in example (GH-5789)
https://github.com/python/cpython/commit/f8a794c04c8d375da279fc830770a5e6b4f363fb


--

___
Python tracker 

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



[issue32889] Valgrind suppressions need updating

2018-02-20 Thread Benjamin Peterson

Change by Benjamin Peterson :


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



[issue32008] Example suggest to use a TLSv1 socket

2018-02-20 Thread miss-islington

miss-islington  added the comment:


New changeset e5d38deb045d0907e6fcf82af8d2d8f0556a8591 by Miss Islington (bot) 
in branch '3.7':
bpo-32008: don't use PROTOCOL_TLSv1 in example (GH-5789)
https://github.com/python/cpython/commit/e5d38deb045d0907e6fcf82af8d2d8f0556a8591


--
nosy: +miss-islington

___
Python tracker 

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



[issue32889] Valgrind suppressions need updating

2018-02-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5575

___
Python tracker 

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



[issue32889] Valgrind suppressions need updating

2018-02-20 Thread miss-islington

Change by miss-islington :


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

___
Python tracker 

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



[issue32889] Valgrind suppressions need updating

2018-02-20 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset ba518804bf4c1ea01df5e622b333d3116cbaa3bd by Benjamin Peterson 
(Paul Price) in branch 'master':
bpo-32889: update valgrind suppressions (GH-5779)
https://github.com/python/cpython/commit/ba518804bf4c1ea01df5e622b333d3116cbaa3bd


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue32008] Example suggest to use a TLSv1 socket

2018-02-20 Thread Benjamin Peterson

Change by Benjamin Peterson :


--
pull_requests: +5573

___
Python tracker 

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



Re: Python on Android?

2018-02-20 Thread Abdur-Rahmaan Janhangeer
writing this especially to thank you hey XD pydroid3 suports qt5 and
matplotlib o_0 numpy and sci-kit really, what an amazing discovery !!!

Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ

On 18 Feb 2018 13:59, "Chris Angelico"  wrote:

> Does anyone have experience with running Python scripts on Android
> phones? I have a brother (honestly! I'm not actually using a phone
> myself!) who's trying to run one of my scripts in QPython, which
> claims to be version 3.2.2. I think that really truly is a Python 3.2
> implementation - probing for newer features suggests that it actually
> doesn't even support the u"..." syntax that came (back) in with Python
> 3.3. So... does anyone know of a Python interpreter that's compatible
> with 3.4 or better and runs on Android?
>
> Personal experiences trump just searching the web...
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32008] Example suggest to use a TLSv1 socket

2018-02-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5572

___
Python tracker 

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



[issue32008] Example suggest to use a TLSv1 socket

2018-02-20 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset e9edee0b65650c4f9db90cefc2e9a8125bad762c by Benjamin Peterson in 
branch 'master':
bpo-32008: don't use PROTOCOL_TLSv1 in example (GH-5789)
https://github.com/python/cpython/commit/e9edee0b65650c4f9db90cefc2e9a8125bad762c


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue32008] Example suggest to use a TLSv1 socket

2018-02-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5571

___
Python tracker 

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



[issue32880] IDLE: Fix and update and cleanup pyparse

2018-02-20 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

In def find_good_parse_start:
str, pos = self.str, None
Using str as an attribute is ok, but using the bare built-in class name for an 
instance thereof is annoying.  's' would be better, or even 'sample' (to be 
analyzed).

--

___
Python tracker 

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



Re: Python on Android?

2018-02-20 Thread Chris Angelico
On Wed, Feb 21, 2018 at 4:44 PM, Abdur-Rahmaan Janhangeer
 wrote:
> here is a kivy launcher tutorial i once wrote :
> https://wp.me/p7UB6x-kB
>

Thanks. I'm currently a dozen or so tabs deep into learning Kivy, and
am just starting to get to looking into launchers.

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


Re: Python on Android?

2018-02-20 Thread Abdur-Rahmaan Janhangeer
here is a kivy launcher tutorial i once wrote :
https://wp.me/p7UB6x-kB

Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ

On 18 Feb 2018 13:59, "Chris Angelico"  wrote:

Does anyone have experience with running Python scripts on Android
phones? I have a brother (honestly! I'm not actually using a phone
myself!) who's trying to run one of my scripts in QPython, which
claims to be version 3.2.2. I think that really truly is a Python 3.2
implementation - probing for newer features suggests that it actually
doesn't even support the u"..." syntax that came (back) in with Python
3.3. So... does anyone know of a Python interpreter that's compatible
with 3.4 or better and runs on Android?

Personal experiences trump just searching the web...

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


[issue32008] Example suggest to use a TLSv1 socket

2018-02-20 Thread Benjamin Peterson

Change by Benjamin Peterson :


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

___
Python tracker 

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



[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2018-02-20 Thread Terry J. Reedy

New submission from Terry J. Reedy :

Actually, 'replace' 'Integral' with 'Integer' but keep 'Integral' for back 
compatibility.

>From python-ideas, where Guido said "Looking at 
>https://en.wikipedia.org/wiki/Number it seems that Integer is "special" -- 
>every other number type is listed as " numbers" (e.g. rational 
>numbers, complex numbers) but integers are listed as "Integers". So let's just 
>switch it to that, and keep Integral as an alias for backwards compatibility. 
>I don't think it's a huge problem to fix this in 3.7b2, if someone wants to do 
>the work."

PR needs What's New entry.

Ned, if you disagree as RM, please say so.

--
messages: 312463
nosy: ned.deily, terry.reedy
priority: high
severity: normal
stage: test needed
status: open
title: Add 'Integer' as synonym for 'Integral' in numbers module.
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



Re: could use some help with this problem! (Posting On Python-List Prohibited)

2018-02-20 Thread Terry Reedy

On 2/20/2018 7:59 PM, Ben Bacarisse wrote:

Lawrence D’Oliveiro  writes:


On Wednesday, February 21, 2018 at 3:10:25 AM UTC+13, Ben Bacarisse wrote:

You almost never /have/ to use nested loops.  Has the course got this
far without introducing the idea of a function?


If you are using a function to avoid a nested loop, perhaps that’s not
such a smart use of a function...


Agreed.  And yet it /might/ be a smart use of one.  Nothing about simply
avoiding a loop is sufficient to make the assessment.


If one were using functional style, one would use tail recursive 
functions instead of *any* explicit loops.



--
Terry Jan Reedy


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


[issue32859] os.dup2() tests dup3() availability on each call

2018-02-20 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset 16de2a9b8697cf90840eb217fb079f9c4c73e588 by Benjamin Peterson 
(Miss Islington (bot)) in branch '3.6':
closes bpo-32859: Don't retry dup3() if it is not available at runtime (GH-5708)
https://github.com/python/cpython/commit/16de2a9b8697cf90840eb217fb079f9c4c73e588


--

___
Python tracker 

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



[issue28886] Move deprecated abc module decorators to separate section in docs

2018-02-20 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset 0150dc589439a9a78c80c2aa8d7d6c5d3bba1d6d by INADA Naoki (Miss 
Islington (bot)) in branch '3.6':
bpo-28886: doc: Move deprecated abc decorators to separate section (GH-176)
https://github.com/python/cpython/commit/0150dc589439a9a78c80c2aa8d7d6c5d3bba1d6d


--

___
Python tracker 

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



[issue28886] Move deprecated abc module decorators to separate section in docs

2018-02-20 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset 7452f6d8fa3ffe5dab20f7e4244851a6eca397be by INADA Naoki (Miss 
Islington (bot)) in branch '3.7':
bpo-28886: doc: Move deprecated abc decorators to separate section (GH-176)
https://github.com/python/cpython/commit/7452f6d8fa3ffe5dab20f7e4244851a6eca397be


--

___
Python tracker 

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



Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Terry Reedy

On 2/20/2018 8:38 AM, Antoon Pardon wrote:


People praise the dynamic nature of Python here on this list and then
often enough seem to recoil when they see a piece of code really using
that dynamism.


Dynamic typing is the addition of run-time type information (RTTI) to 
data values.  This allows duck typing of function parameters and 
function code.  Every function that uses duck typing, which is to say, 
most functions written in Python, is 'really using that dynamism' as 
intended.  The concrete type of arguments may change with every call, 
but the function code uses run-time type dispatch to get type-specific 
versions of the operations needed.


For instance, builtin min has a single parameter whose abstract argument 
type is "iterable of '<'-compatible objects".  It's code somewhere 
compares current_min < next_item, which dispatches to current_min.__lt__ 
or possibly next_item.__ge__.  Combining "list of | tuple of | set of | 
frozenset of | iterable of | dict keyed with" witn "ints | doubles | 
strings | bytes | '<'-compatible lists | '<'-compatible tuples" gives 36 
possible concrete input types.  "array of x" gives an indefinite number 
more, as does user additions.  I really like that we do not have to 
define a 'min_collection_type' function for every combination we might 
want to use in a package.


When makes people recoil is abusing dynamism by needlessly rebinding a 
name to objects of different specific type within a single block of code.


--
Terry Jan Reedy

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


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Chris Angelico
On Wed, Feb 21, 2018 at 6:39 AM, Geldenhuys, J, Prof 
 wrote:
> I think your case illustrates the Python/Mathematica issue well:  you found a 
> job for which Mathematica was not the perfect tool and you used Python.  At 
> the end of the day, both M & P have their place.  For example, we probably 
> won't use either to teach Introduction Computer Science soon, because they 
> both lack features that we expect our students to be familiar with at the end 
> of their first year.
>

Out of curiosity, what features does Python lack in that area? (I
don't know anything about Mathematica, and it's only tangentially
on-topic at best.) For an intro to comp sci, I would generally expect
to start with a high level language such as Python, or JavaScript
(because of its ubiquity, primarily due to web browser usage), or Ruby
(particularly if you're Japanese). You don't learn about how to manage
memory (because it's done for you), but on the other hand, you don't
learn about how to manage memory (because hey, it's all done for
you!). You don't learn how to wade through a crash dump (because you
have exceptions and tracebacks), you don't learn how to compile for
different platforms, you don't learn all sorts of other things that
aren't necessary for someone's first year in comp sci. So I'm
interested to what such high level languages lack, from the POV of a
first year of comp sci.

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


[issue28886] Move deprecated abc module decorators to separate section in docs

2018-02-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5569

___
Python tracker 

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



[issue28886] Move deprecated abc module decorators to separate section in docs

2018-02-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5568
stage: needs patch -> patch review

___
Python tracker 

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



[issue28886] Move deprecated abc module decorators to separate section in docs

2018-02-20 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset 52c6b89796a7ec391db20281e05b256f57e97b35 by INADA Naoki (Harshul 
jain) in branch 'master':
bpo-28886: doc: Move deprecated abc decorators to separate section (GH-176)
https://github.com/python/cpython/commit/52c6b89796a7ec391db20281e05b256f57e97b35


--
nosy: +inada.naoki

___
Python tracker 

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



[issue32540] venv docs - doesn't match behavior

2018-02-20 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

This should be good now.
Thanks!

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



[issue32540] venv docs - doesn't match behavior

2018-02-20 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset 76c3f5eeb07aeb037da1ed6761dd9bd95e2c1d8d by Mariatta (Miss 
Islington (bot)) in branch '3.6':
bpo-32540: Update venv documentation (GH-5736)
https://github.com/python/cpython/commit/76c3f5eeb07aeb037da1ed6761dd9bd95e2c1d8d


--

___
Python tracker 

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



[issue32540] venv docs - doesn't match behavior

2018-02-20 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset 98a86cbb9bed94a232263698041acd2775da3dad by Mariatta (Miss 
Islington (bot)) in branch '3.7':
bpo-32540: Update venv documentation (GH-5736)
https://github.com/python/cpython/commit/98a86cbb9bed94a232263698041acd2775da3dad


--

___
Python tracker 

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



[issue32540] venv docs - doesn't match behavior

2018-02-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5567

___
Python tracker 

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



[issue32540] venv docs - doesn't match behavior

2018-02-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5566
stage: backport needed -> patch review

___
Python tracker 

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



Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Geldenhuys, J, Prof <g...@sun.ac.za>
Hi Marcel,

I have read through the article and it seems to me that all of the problems 
described boil down to one important point: use the right tool for the right 
job.  Python is probably not the best language for developing large, complex 
systems (although there are such systems).  Most (or all?) of the concerns that 
Murthy raises (dynamic typing, support for multithreading, performance, 
Python2/3, encapsulation) speak to that.  He is not wrong about any of the 
points, but it could be said that he is expecting too much.  We don't expect a 
carpenter with a hammer to build an entire apartment building, and we don't 
expect a big construction company to build a coffee table.

Python does have many desirable features: it is easy to learn and the code is 
relatively clear.  It is available on most platforms (I can run it directly on 
my phone), and it is easy to port to new platforms.  There are many things that 
Mathematica can do that Python can't, and vice versa.  Right tool/right job.  I 
have often used Python to build prototypes to see if an algorithm works, but 
then I use a more efficient language (like Java or C) for the "real" 
implementation.

Out of interest, Mathematica itself is written in C, C++, and Java, and 
consists of a few million lines of code.  Python has several implementations; 
the "reference" implementation is CPython which is written in C and consists of 
 ~540,000 lines of code.  Because Python is open-source, it has the strengths 
(many contributors) and weaknesses (more difficult to coordinate development) 
that comes from this paradigm.

As far as the documentation is concerned, Python is considered a 
well-documented language.  Of course, individual libraries may not be, but as 
it happens, pyeda has good documentation 
(http://pyeda.readthedocs.io/en/latest/).  I think you may just have been 
unlucky not to have found it.

I think your case illustrates the Python/Mathematica issue well:  you found a 
job for which Mathematica was not the perfect tool and you used Python.  At the 
end of the day, both M & P have their place.  For example, we probably won't 
use either to teach Introduction Computer Science soon, because they both lack 
features that we expect our students to be familiar with at the end of their 
first year.



Prof Jaco Geldenhuys
Medeprofessor: Rekenaarwetenskap  |  Associate Professor: Computer Science
Fakulteit Natuurwetenskappe  |  Faculty of Science
e: g...@sun.ac.za  |  t: +27 21 808 4232  |  a: Algemene Ingenieurswese Gebou 
A519  |  General Engineering Building A519
  
 
 

 
 


On 2018/02/20, 19:11, "Wild, Marcel, Prof "  
wrote:

I scarcely know Python, and I have no intention delving into it further.
 I was forced to use Python because it features binary decision diagrams, 
which MATHEMATICA doesn't. Coming from Mathematica the account of Nathan Murphy 
reads like a nightmare.

The one point that stroke me the most was the schism between Python 2 and 
3. No such thing with Mathematica: All its 11 or more versions are fully 
compatible, I never experienced any problems in this regard.

Another point is the bad online help provided to "teach yourself" Python. 
For instance, it took me more than an hour to find out how to negate a Boolean 
variable, whereas in Mathematica you would just type "Negation" in the Wolfram 
Documentation search window, and get the information you need.

I know one pays for Mathematica whereas Python is open source, but I've 
come to realize now that this money is very well spent!

Question: Apart from a few commands not available in Mathematica, such as 
expr2bdd, is there really any domain of computation where Mathematica is 
inferior to Python?

Marcel

-Original Message-
From: Python-list [mailto:python-list-bounces+mwild=sun.ac...@python.org] 
On Behalf Of bartc
Sent: 19 February 2018 02:35 PM
To: python-list@python.org
Subject: Re: Are the critiques in "All the things I hate about Python" 
valid?

On 19/02/2018 02:59, Chris Angelico wrote:
> On Mon, Feb 19, 2018 at 1:14 PM, bartc  wrote:

>> How would even a type for the odd numbers from 1 to 10 inclusive work?
>> (That, a type consisting of one of the values in {1,3,5,7,9}.) Would
>> they be ordered or unordered? Can I do arithmetic with them: will 3*3
>> work, but not 3*5?
>
> The type is "positive odd number below ten" and could be written as
> int(1..9|1%2). That is an orderable type; you can say that 3 < 7, for
> instance. And yes, arithmetic would be defined just fine;


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Chris Angelico
On Wed, Feb 21, 2018 at 9:01 AM, Rick Johnson
 wrote:
> On Tuesday, February 20, 2018 at 2:51:56 PM UTC-6, Chris Angelico wrote:
> [...]
>> Nope. Even if you need the age many times per second, it's still
>> better to store the date of birth, because you eliminate boundary
>> conditions and duplicated data.
>
> You failed to provide any examples proving this assertion of
> yours. I can't imagine how either would be a problem.

https://en.wikipedia.org/wiki/Database_normalization

I'm not going to do your research for you.

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


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Steven D'Aprano
On Tue, 20 Feb 2018 10:17:12 -0700, Ian Kelly wrote:

> On Tue, Feb 20, 2018 at 8:38 AM, Steven D'Aprano
>  wrote:
>> On Tue, 20 Feb 2018 15:23:44 +0100, Antoon Pardon wrote:
>>
 Okay. Now create a constraint on a name in C++ such that it can only
 accept integers representing A.D. years which, on the Gregorian
 calendar, are leap years. (Using a dedicated integer-like type is
 permitted.) It must accept all multiples of four, except those which
 are multiples of one hundred, unless they're also multiples of four
 hundred.

 That's what Steve asked for. Can you do it? Or is the C++ type system
 not flexible enough for that?
>>>
>>> Steve had multiple contributions in this thread. I didn't react to the
>>> one where he asked for that.
>>
>> Yes you did: you refused to meet the challenge, stating (and I quote):
>>
>> "Why should this be done at compile time?"
>>
>> https://mail.python.org/pipermail/python-list/2018-February/730995.html
> 
> I really don't understand what point you're driving at here, Steven.

To be perfectly frank, neither do I any more. I fear I've been suckered 
into taking a position I didn't intend to, as often happens when I reply 
to Antoon Pardon.

Obviously both statically and dynamically typed languages are Turing 
Complete, so any constraint you can apply at run-time in one you can 
apply at run-time in the other. How *easy* that is depends on the 
language features, and particularly for older languages, statically typed 
languages tend to be harder and less convenient to write in. There's 
typically more boilerplate, and more time spent placating the type-
checker. Do I need to justify this or can we take it as a given?

So I didn't think I was taking a controversial position to say that 
dynamic languages are good for writing constraints that are enforced at 
run-time, *as opposed to trying to do so within the type-system* which 
was the topic under discussion.

I have argued in the past that the hard distinction between static and 
dynamic languages has been gradually worn away (if it ever existed at 
all!) as statically-typed languages add dynamic features, and dynamically-
typed languages add static features. For example, Java supports run-time 
method dispatch; Python added type annotations to standardise on syntax 
for static type testing.

Antoon's example of Pascal range checking is another run-time feature (a 
form of dynamic typing, in a fifty year old statically typed language no 
less!), as are Eiffel pre- and post-condition assertions (although the 
compiler can optimize them away if it can determine that they always 
hold). I've linked to Steve Yegge a lot,  e.g.:

https://
steve-yegge.blogspot.com.au/2008/05/dynamic-languages-strike-back.html

so I certainly know that there's a certain amount of convergence between 
static and dynamic features and it was never my intention to suggest that 
statically-typed code can't validate values at run-time. That would be a 
ludicrous position to take.

If Antoon was arguing in good faith surely he must have realised I 
couldn't have meant that. By all means call me out on factual 
inaccuracies, but do so in good faith. Don't assume I mean something 
ludicrous.


If you look back at my reply to Bart:

https://mail.python.org/pipermail/python-list/2018-February/730943.html

you will see that the context is a discussion comparing:

compile-time static analysis 

versus 

run-time dynamic checks

strategies. Hence my challenge to perform the same kind of check at 
compile-time using an actual, existing type-system. (Not merely say a 
sufficiently clever type-system can do it and handwave away the practical 
difficulties.)

Of course we can perform arbitrarily complex run-time checks in a 
language with static typing (it might not be as convenient or easy, 
especially if you have to declare every single temporary variable, do a 
lot of explicit casts, never re-use any variable, and use a lot of 
verbose boilerplate, but it can be done).


> The
> original claim (by you) was that dynamic languages excel at "enforcing
> constraints at run-time which are hard to enforce at compile-time". The
> counter-argument, as I understand, it was that while the constraints may
> be hard to enforce at compile-time, they are just as easy to enforce at
> run-time in a static language as in a dynamic language, so that can't
> really be considered a *strength* per se of dynamic languages.

Fair enough -- I acknowledge there's something to what you say, even if I 
wouldn't say it that way.

But in which case, if dynamically typed languages are no easier to use 
than statically typed ones, and no faster, and no more secure, why do 
people use them?

The conventional answer is that they are easier to use, hence more rapid 
prototyping and application development. But if we say that static typed 
languages are *just as easy to use* then the existence and popularity of 

[issue32540] venv docs - doesn't match behavior

2018-02-20 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

I've went ahead to initiate the backports.

--
stage: patch review -> backport needed
versions: +Python 3.6, Python 3.7

___
Python tracker 

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



[issue32540] venv docs - doesn't match behavior

2018-02-20 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

The PR was against master branch. So if backports are needed, you can add 
"needs backport to" labels on GH-5736 and the bot will take care of it.

--
nosy: +Mariatta

___
Python tracker 

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



[issue31106] os.posix_fallocate() generate exception with errno 0

2018-02-20 Thread Kubilay Kocak

Kubilay Kocak  added the comment:

I believe changeset d4b93e21c2664d6a78e0656e7a7be0807be1c352 may be the cause 
of buildbot failures on FreeBSD (at least koobs-freebsd-current, log attached), 
due to only the EBADF error being handled (not EINVAL, et al).

Unfortunately the worker was been offline for a longer than anticipated period 
of time and only recently was restored which delayed picking it up.

The issue (in this workers case) is related to the buildbot home/data directory 
being on a ZFS filesystem, who's host was recently updated (from current late 
last year to yesterday).

Initial investigation/isolation/references:

Disable posix_fallocate(2) for ZFS
https://lists.freebsd.org/pipermail/svn-src-head/2017-November/105709.html

Note: Above change will be relevant (merged) for at least FreeBSD 12 and 11, 
but perhaps even 10.

684: posix_fallocate() should be allowed to return ENOTSUP (Interp Status: 
Approved)
http://austingroupbugs.net/view.php?id=684

[HEADS UP] posix_fallocate support removed from ZFS, lld affected
https://lists.freebsd.org/pipermail/freebsd-current/2017-November/067463.html
Snip: "illumos and ZoL seem to do the same."

Gold fails when output file is lying on ZFS 
https://sourceware.org/bugzilla/show_bug.cgi?id=22540

Given the wide scope of use of zfs and both syscalls across multiple OS's, and 
possible changes to POSIX documentation/standards, changes to the underlying 
fallocate/fadvise functions may also be indicated here.

--
nosy: +koobs
versions: +Python 3.8
Added file: 
https://bugs.python.org/file47454/koobs-freebsd-current.non-debug.3.x.build.16.stdio.txt

___
Python tracker 

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



[issue32493] UUID Module - FreeBSD build failure

2018-02-20 Thread Kubilay Kocak

Change by Kubilay Kocak :


--
stage: resolved -> needs patch

___
Python tracker 

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



[issue32881] pycapsule:PyObject * is NULL pointer

2018-02-20 Thread zhaoya

zhaoya  added the comment:

FUNCTION_CALL_MODE is __stdcall i think no problem.because, if 
GetContext(PyObject  *capsule) -->GetContext() is ok. PyObject  *capsule from 
python to c unknown error occurred.

--

___
Python tracker 

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



[issue32540] venv docs - doesn't match behavior

2018-02-20 Thread Jason R. Coombs

Jason R. Coombs  added the comment:

I thought I saw the PR to the 3.6 branch. If that's not the case - a backport 
to 3.7 would be much appreciated.

--

___
Python tracker 

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



[issue32843] More revisions to test.support docs

2018-02-20 Thread Nick Coghlan

Nick Coghlan  added the comment:

For TESTFN_NONASCII vs TESTFN_UNICODE (inferred from reading the current code & 
https://github.com/python/cpython/commit/8b219b2936d767bf6c6c17618db3a7b22fc2e865):

* TESTFN_NONASCII guarantees that it can be encoded and decoded with the 
default filesystem encoding, but may be None if it can't find a suitable 
non-ASCII character that meets that constraint. This allows affected tests to 
be easily skipped on platforms where they can't work.
* TESTFN_UNICODE is always set, but may *not* be encodable with os.fsencode()

(The two could potentially be consolidated by converting the tests that use 
TESTFN_UNICODE over to TESTFN_NONASCII, but for now it makes sense to just 
document the above differences)

For the logging helpers, I'd check how they're used in test_logging: if they're 
used in logging configuration tests, they may be in test.support to avoid 
reimporting the module that defines the logging tests. If so, then they can be 
filed away in their own subsection at the end of the test.support 
documentation. If not, then yeah, moving them into test_logging would make 
sense.

Similarly, moving the distutils helper makes sense to me, *unless* there's a 
specific reason that importing it from "distutils.tests.support" instead would 
be problematic.

--

___
Python tracker 

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



Re: could use some help with this problem! (Posting On Python-List Prohibited)

2018-02-20 Thread Ben Bacarisse
Lawrence D’Oliveiro  writes:

> On Wednesday, February 21, 2018 at 3:10:25 AM UTC+13, Ben Bacarisse wrote:
>> You almost never /have/ to use nested loops.  Has the course got this
>> far without introducing the idea of a function?
>
> If you are using a function to avoid a nested loop, perhaps that’s not
> such a smart use of a function...

Agreed.  And yet it /might/ be a smart use of one.  Nothing about simply
avoiding a loop is sufficient to make the assessment.

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


[issue32008] Example suggest to use a TLSv1 socket

2018-02-20 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Christian,

Would you have any feedback on this?  Thanks!

--
nosy: +christian.heimes, csabella

___
Python tracker 

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



[issue32017] profile.Profile() has no method enable()

2018-02-20 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

I started taking a look at this and discovered a few things.  There are four 
methods in the C module `_lsprof` that are within the Profiler class - 
`enable`, `disable`, `getstats`, and `clear` and which are all available 
through cProfile.Profile.  These aren't available in profile.py.  Also, 
`getstats` and `clear` aren't in the documentation and `enable` takes two 
optional parameters that aren't mentioned in the documentation.  There are also 
many methods in profile.py that aren't documented.

What would be the preferred approach to fixing the documentation?  It seems 
that the documentation currently focuses on trying to make profile and cProfile 
as similar as possible.  Should they have separate sections that define the 
differences?  Or should `enable` and `disable` be removed since they aren't in 
profile?  The example under 
https://docs.python.org/3.8/library/profile.html#profile.Profile  uses `enable` 
and `disable` and seems to be a helpful example.

--
nosy: +csabella
stage:  -> needs patch
versions: +Python 3.8

___
Python tracker 

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



[issue32604] Expose the subinterpreters C-API in Python for testing use.

2018-02-20 Thread Eric Snow

Eric Snow  added the comment:


New changeset eed3c7af4ec520d324a55e0357f41589a66906f7 by Eric Snow (Miss 
Islington (bot)) in branch '3.7':
bpo-32604: Swap threads only if the interpreter is different. (gh-5783)
https://github.com/python/cpython/commit/eed3c7af4ec520d324a55e0357f41589a66906f7


--

___
Python tracker 

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



[issue32890] os: Some functions may report bogus errors on Windows

2018-02-20 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue32890] os: Some functions may report bogus errors on Windows

2018-02-20 Thread Alexey Izbyshev

New submission from Alexey Izbyshev :

Demo:

>>> os.execve('', ['a'], {})
Traceback (most recent call last):
  File "", line 1, in 
OSError: [WinError 0] The operation completed successfully: ''

The reason is that path_error() used throughout os module always uses 
GetLastError() on Windows, but some functions are implemented via CRT calls 
which report errors via errno. It seems that commit 292c83554 caused this issue.

--
messages: 312446
nosy: izbyshev, vstinner
priority: normal
severity: normal
status: open
title: os: Some functions may report bogus errors on Windows
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

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



Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Steven D'Aprano
On Tue, 20 Feb 2018 12:42:23 -0800, Rick Johnson wrote:

> For instance, if the age is queried many times a second, it would be a
> much wiser design to set-up an event that will advance the age at the
> end of the last second of every year

Do you really mean to say that everybody in the world has their birthday 
on January 1st? We're not racehorses you know.

Under your scheme, 99.7% of records will return the wrong age (off by 
one) at least once per year. Statistically, 50% of queries will be wrong.


-- 
Steve

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


[issue32540] venv docs - doesn't match behavior

2018-02-20 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Does this need to be backported to 3.7 and 3.6?  Or can it be closed as 
resolved?

--
nosy: +csabella

___
Python tracker 

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



Re: Python on Android?

2018-02-20 Thread Johannes Findeisen
On Wed, 21 Feb 2018 00:11:24 +0100
Johannes Findeisen wrote:

> On Tue, 20 Feb 2018 23:12:23 +1100
> Chris Angelico wrote:
> 
> > On Mon, Feb 19, 2018 at 3:57 AM, Johannes Findeisen  
> > wrote:  
> > > On Sun, 18 Feb 2018 20:57:02 +1100
> > > Chris Angelico wrote:
> > >
> > >> Does anyone have experience with running Python scripts on Android
> > >> phones? I have a brother (honestly! I'm not actually using a phone
> > >> myself!) who's trying to run one of my scripts in QPython, which
> > >> claims to be version 3.2.2. I think that really truly is a Python 3.2
> > >> implementation - probing for newer features suggests that it actually
> > >> doesn't even support the u"..." syntax that came (back) in with Python
> > >> 3.3. So... does anyone know of a Python interpreter that's compatible
> > >> with 3.4 or better and runs on Android?
> > >>
> > >
> > > There is an App for Android called "Pydroid 3". You can find it in
> > > the Google Play Store [0]. It provides a Python interpreter in version
> > > 3.6.2 in its current release.
> > >
> > > The Python binary is installed under
> > >
> > > /data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/bin/python
> > >
> > > but I can not access it in a normal terminal without being user "root"
> > > but it is usable from within the terminal included in the Pydroid App.
> > 
> > Many thanks for all the suggestions. Pydroid is the one that has
> > worked; he's now able to run stuff happily from the terminal. Next
> > step is to create an icon that invokes it, but that's looking rather
> > harder (probably means I'm going to have to learn Kivy, and I already
> > have no shortage of projects...). Everything's working in the terminal
> > (even a read-write $HOME, which we didn't have previously), and I'm
> > pretty happy with that!
> > 
> > All suggestions were read and are appreciated, even though I'm only
> > quoting the one we ended up going with. Thank you Kirill, MRAB, Abdur,
> > and Johannes!  
> 
> You're welcome!
> 
> Take a look at the "Kivy Launcher" App for Android if You don't want to
> do deep learning of Kivy. With this App You can just copy some
> Python code to the Kivy launcher directory "/sdcard/kivy/"
> and execute it with just one click without packaging your own APK file.
> 
> Don't know which Python version is included in Kivy Launcher and believe
> it is 2.7. but it think Kivy will go over to Python 3.* in the near
> future.

I forgot the link to the documentation...

https://kivy.org/docs/guide/packaging-android.html#packaging-your-application-for-kivy-launcher

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


[issue32604] Expose the subinterpreters C-API in Python for testing use.

2018-02-20 Thread Eric Snow

Eric Snow  added the comment:


New changeset f53d9f2778a87bdd48eb9030f782a4ebf9e7622f by Eric Snow in branch 
'master':
bpo-32604: Swap threads only if the interpreter is different. (gh-5778)
https://github.com/python/cpython/commit/f53d9f2778a87bdd48eb9030f782a4ebf9e7622f


--

___
Python tracker 

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



[issue32880] IDLE: Fix and update and cleanup pyparse

2018-02-20 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

StringTranslatePseudoMapping (Mapping) is an awkward and not very descriptive 
name.  It is similar to collections.defaultdict except that it uses a default 
value rather than a default factory.  The latter is so defaults can be 
mutables.  Would a subclass of similar to defaultdict be faster?

Unlike, defaultdict, the initialized default is used in get as well as 
__getitem__.  This means that STPM.get ignores a passed-in default, contrary to 
the definition of Mapping.get.  The method override is not needed.

The internal self._get is only needed because it is called in both __getitem__ 
and get.  Without the get override, it's body (with 'self.' added, can become 
the body of __getitem__.  I suspect that this would make __getitem__ faster.  
Test this.

--

___
Python tracker 

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



[issue32604] Expose the subinterpreters C-API in Python for testing use.

2018-02-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5564

___
Python tracker 

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



Re: How to transform this as a service

2018-02-20 Thread Steven D'Aprano
On Tue, 20 Feb 2018 14:41:42 -0800, Maroso Marco wrote:

> My program seems to have a problem and i don't understand which! Firstly
> it worked and now just went to run it again and it doesnt.
[...]
> Can someone please tell me how to transform it in a service to run on
> Windows?

There is absolutely no point in spending time and effort transforming it 
to a service if your program doesn't work. First you need to fix the 
program so that it can reliably and repeatedly work.


Start by explaining, what do you mean by "doesn't work"? Does it:

- raise an exception;

- silently sit and do nothing for hours;

- cause the computer to catch fire;

- something else?

Explain what you expect the script to do, and what it actually does 
instead.

If there is an exception or error, please COPY AND PASTE the EXACT error 
message, if possible. Don't retype it from memory, summarise it, or take 
a screen shot.

How are you running your script? To make it usable as a service, first 
you have to make sure it is usable from the system command prompt 
(command.com, cmd.exe, PowerShell, or whatever you use on Windows these 
days).

Are you sure you are running your script using the right Python version? 
How do you know?



-- 
Steve

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


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Steven D'Aprano
On Tue, 20 Feb 2018 22:19:13 +0100, Christian Gollwitzer wrote:

[...]
> LeapYearCheck could be implemented using template metaprogramming
> (quite horrible) or the new funky constexpr feature in C++11/C++14 (less
> horrible).

Thanks Christian. That's certainly interesting, I don't know much about 
template metaprogramming so TIL.

 

-- 
Steve

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


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Steven D'Aprano
On Tue, 20 Feb 2018 17:11:05 +, Wild, Marcel, Prof 
wrote:

> I scarcely know Python, and I have no intention delving into it further.
>  I was forced to use Python because it features binary decision
>  diagrams, which MATHEMATICA doesn't. Coming from Mathematica the
>  account of Nathan Murphy reads like a nightmare.

I dare say that was Nathan Murphy's intention. But the ironic thing is 
that by Murphy's standards, Mathematica suffers the same flaws as Python: 
it to is a dynamically typed language with little or no compile-time type 
safety.



-- 
Steve

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


Re: Python on Android?

2018-02-20 Thread Johannes Findeisen
On Tue, 20 Feb 2018 23:12:23 +1100
Chris Angelico wrote:

> On Mon, Feb 19, 2018 at 3:57 AM, Johannes Findeisen  wrote:
> > On Sun, 18 Feb 2018 20:57:02 +1100
> > Chris Angelico wrote:
> >  
> >> Does anyone have experience with running Python scripts on Android
> >> phones? I have a brother (honestly! I'm not actually using a phone
> >> myself!) who's trying to run one of my scripts in QPython, which
> >> claims to be version 3.2.2. I think that really truly is a Python 3.2
> >> implementation - probing for newer features suggests that it actually
> >> doesn't even support the u"..." syntax that came (back) in with Python
> >> 3.3. So... does anyone know of a Python interpreter that's compatible
> >> with 3.4 or better and runs on Android?
> >>  
> >
> > There is an App for Android called "Pydroid 3". You can find it in
> > the Google Play Store [0]. It provides a Python interpreter in version
> > 3.6.2 in its current release.
> >
> > The Python binary is installed under
> >
> > /data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/bin/python
> >
> > but I can not access it in a normal terminal without being user "root"
> > but it is usable from within the terminal included in the Pydroid App.  
> 
> Many thanks for all the suggestions. Pydroid is the one that has
> worked; he's now able to run stuff happily from the terminal. Next
> step is to create an icon that invokes it, but that's looking rather
> harder (probably means I'm going to have to learn Kivy, and I already
> have no shortage of projects...). Everything's working in the terminal
> (even a read-write $HOME, which we didn't have previously), and I'm
> pretty happy with that!
> 
> All suggestions were read and are appreciated, even though I'm only
> quoting the one we ended up going with. Thank you Kirill, MRAB, Abdur,
> and Johannes!

You're welcome!

Take a look at the "Kivy Launcher" App for Android if You don't want to
do deep learning of Kivy. With this App You can just copy some
Python code to the Kivy launcher directory "/sdcard/kivy/"
and execute it with just one click without packaging your own APK file.

Don't know which Python version is included in Kivy Launcher and believe
it is 2.7. but it think Kivy will go over to Python 3.* in the near
future.

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


[issue32888] Improve exception message in ast.literal_eval

2018-02-20 Thread Chris Angelico

Chris Angelico  added the comment:

(BTW, by "proposed" I mean that the change that I describe is in the PR.)

--

___
Python tracker 

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



Re: How to transform this as a service

2018-02-20 Thread Maroso Marco
Il giorno martedì 20 febbraio 2018 23:42:27 UTC+1, Maroso Marco ha scritto:
> Hi everyone, i need this program to run as a service.
> 
> This program basically check an email account (gmail) and looks if there is
> mail from a specific email account, then reads the subject line and splits 
> the text found assigning the left part (before the ; ) to the password, and 
> the right part to the comand to be executed.
> It should loop continuosly waiting a specific time given in a file called 
> timing.ini (seconds)
> 
> My program seems to have a problem and i don't understand which! Firstly it 
> worked and now just went to run it again and it doesnt. I have different 
> versions of python installed on my pc.
> 
> Can someone please tell me how to transform it in a service to run on Windows?
> 
> I found some solutions but i don't understand how to implement it correctly
> This is my code, any help is really apreciated, i'm loosing my nights on this 
> and can't get it working.
> 
> 
> 
> 
> import imaplib
> import os
> import email
> import email.header
> import time
> import subprocess
> 
> def mailcontroller():
> 
> # Set user, pass and allowed mail for giving commands
> plusmail = "anemailaddr...@gmail.com"
> googlepass = "thepassword"
> captain = "autorizedemailacco...@gmail.com"
> 
> # Set vars for IMAP access
> M = imaplib.IMAP4_SSL('imap.gmail.com')
> M.login(plusmail, googlepass)
> M.select()
> 
> # Set search on UNSEEN messages
> status, response = M.search(None, '(UNSEEN)')
> unread_msg_nums = response[0].split()
> 
> 
> # Mark as read
> for e_id in unread_msg_nums:
> M.store(e_id, '+FLAGS', '\Seen')
> 
> # cycle messages sent from autorized email address
> typ, data = M.search(None, 'From',(captain))
> 
> for num in data[0].split():
> typ, data = M.fetch(num, '(RFC822)')
> msg = email.message_from_string(data[0][1])
> decode = email.header.decode_header(msg['Subject'])[0]
> subject = unicode(decode[0])
> comando = subject
> 
> if googlepass in subject:
> 
> # print 'Message %s: %s' % (num, subject)
> # Split subject line
> googlepass,comando = subject.split(";")
> # Execute command
> #os.system(comando)
> # Execute command with alternate method
> subprocess.call(comando)
> # Delete email
> M.store(num, '+FLAGS', '\\Deleted')
> 
> M.close()
> M.logout()
> 
> # Read ini file for timer settings
> timing = open('timing.ini', 'r').read()
> # Convert timer value from string to int
> time.sleep(int(timing))
> 
> while True:
> mailcontroller()

I would like to implement my code in something like this described here : 
http://www.chrisumbel.com/article/windows_services_in_python
-- 
https://mail.python.org/mailman/listinfo/python-list


How to transform this as a service

2018-02-20 Thread Maroso Marco
Hi everyone, i need this program to run as a service.

This program basically check an email account (gmail) and looks if there is
mail from a specific email account, then reads the subject line and splits the 
text found assigning the left part (before the ; ) to the password, and the 
right part to the comand to be executed.
It should loop continuosly waiting a specific time given in a file called 
timing.ini (seconds)

My program seems to have a problem and i don't understand which! Firstly it 
worked and now just went to run it again and it doesnt. I have different 
versions of python installed on my pc.

Can someone please tell me how to transform it in a service to run on Windows?

I found some solutions but i don't understand how to implement it correctly
This is my code, any help is really apreciated, i'm loosing my nights on this 
and can't get it working.




import imaplib
import os
import email
import email.header
import time
import subprocess

def mailcontroller():

# Set user, pass and allowed mail for giving commands
plusmail = "anemailaddr...@gmail.com"
googlepass = "thepassword"
captain = "autorizedemailacco...@gmail.com"

# Set vars for IMAP access
M = imaplib.IMAP4_SSL('imap.gmail.com')
M.login(plusmail, googlepass)
M.select()

# Set search on UNSEEN messages
status, response = M.search(None, '(UNSEEN)')
unread_msg_nums = response[0].split()


# Mark as read
for e_id in unread_msg_nums:
M.store(e_id, '+FLAGS', '\Seen')

# cycle messages sent from autorized email address
typ, data = M.search(None, 'From',(captain))

for num in data[0].split():
typ, data = M.fetch(num, '(RFC822)')
msg = email.message_from_string(data[0][1])
decode = email.header.decode_header(msg['Subject'])[0]
subject = unicode(decode[0])
comando = subject

if googlepass in subject:

# print 'Message %s: %s' % (num, subject)
# Split subject line
googlepass,comando = subject.split(";")
# Execute command
#os.system(comando)
# Execute command with alternate method
subprocess.call(comando)
# Delete email
M.store(num, '+FLAGS', '\\Deleted')

M.close()
M.logout()

# Read ini file for timer settings
timing = open('timing.ini', 'r').read()
# Convert timer value from string to int
time.sleep(int(timing))

while True:
mailcontroller()










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


[issue31848] "aifc" module does not always initialize "Aifc_read._ssnd_chunk"

2018-02-20 Thread miss-islington

miss-islington  added the comment:


New changeset 2b9726eb647e856d83eafdc30cdbbc31a5920ab6 by Miss Islington (bot) 
in branch '3.6':
bpo-31848: Fix broken error handling in Aifc_read.initfp() when the SSND chunk 
is not found (GH-5240)
https://github.com/python/cpython/commit/2b9726eb647e856d83eafdc30cdbbc31a5920ab6


--

___
Python tracker 

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



[issue32874] IDLE: Add tests for pyparse

2018-02-20 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Response to msg312428: I would generally prefer to put off using 3.x feature in 
module m until after we think we are done patching m for 3.(x-1), but do so 
before 3.x.0 release.  When 3.x-1 went to security status a week after the 3.x 
release, this was not much an issue.

In this case, we could use 'isascii' freely after
3.7+: isascii = str.isascii
3.6:  def isascii(s): return all(ord(c) < 128 for c in s)

Concrete code change proposals, including in hyperparser, should go on #32880.

In #21765, I mentioned looking at ColorDelegator and UndoDelegator.  I never 
did that, but added this to my list of possible issues.

--

___
Python tracker 

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



Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Rick Johnson
On Tuesday, February 20, 2018 at 2:51:56 PM UTC-6, Chris Angelico wrote:
[...]
> Nope. Even if you need the age many times per second, it's still
> better to store the date of birth, because you eliminate boundary
> conditions and duplicated data.

You failed to provide any examples proving this assertion of
yours. I can't imagine how either would be a problem.

> But that's assuming you're storing the age of *a person*.
> If the age in question is a boundary ("motor insurance
> premiums are increased if the driver is 65 years or
> older"), then it's still sane to store the age.

The boundary problem you outline here is a simple matter of
checking the age annually and increasing the premium if the
person is 65 years or older, and has nothing to do with
whether or not the age is calculated once a year or upon
every request.

def annual_probe(self, geriatricMarker=65):
self.age += 1
if self.age >= geriatricMarker:
self.increase_premium()

But obviously this "data" should reside in a database, not be
instanced into OO objects.

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


[issue31848] "aifc" module does not always initialize "Aifc_read._ssnd_chunk"

2018-02-20 Thread miss-islington

miss-islington  added the comment:


New changeset 1d927d4feba856cacc026a9167ba38c73a4e7657 by Miss Islington (bot) 
in branch '3.7':
bpo-31848: Fix broken error handling in Aifc_read.initfp() when the SSND chunk 
is not found (GH-5240)
https://github.com/python/cpython/commit/1d927d4feba856cacc026a9167ba38c73a4e7657


--
nosy: +miss-islington

___
Python tracker 

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



[issue32874] IDLE: Add tests for pyparse

2018-02-20 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Respone to msg312353: Yes, let us restrict this to testing pyparse code as is.  
I opened issue #32880 for changing the code.  My followup post discusses parse 
variable initialization.

Putting instance variable defaults in class attributes is a known practice.  
But this is usually done when the 'default' is the most common value, not when 
the class attribute is always masked, before access, by an instance attribute 
of the same name.

One could claim that it is buggy to not create a new Parser instance for each 
subtest.  But the class appears to be designed for instance reuse, by having a 
separate set string method and by never looking at string-specific attributes 
until set from the string.

We could instead say that the bug is the test checking an undefined value. I 
rejected the option of not looking when test.lastopenbracketpos is None and 
instead suggest on the new issue that this instance attribute always be freshly 
set, like all the others.

--

___
Python tracker 

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



[issue32863] Missing support for Emojis in tkinter

2018-02-20 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

The 3.7b1 64-bit installer includes a local copy of Tcl/Tk (see 
Mac/BuildScript/build-installer.py), which could be changed as needed. That 
said, I'm not advocating changing default Tcl/Tk configuration options because 
I don't know how well full unicode builds are supported (and if that would fix 
anything).

 seems to 
indicate that at least one emoji related issue has been fixed very recently in 
Tk (later than the latest Tcl/Tk release).

--

___
Python tracker 

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



Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Christian Gollwitzer

Am 20.02.18 um 14:58 schrieb Chris Angelico:

Okay. Now create a constraint on a name in C++ such that it can only
accept integers representing A.D. years which, on the Gregorian
calendar, are leap years. (Using a dedicated integer-like type is
permitted.) It must accept all multiples of four, except those which
are multiples of one hundred, unless they're also multiples of four
hundred.

That's what Steve asked for. Can you do it? Or is the C++ type system
not flexible enough for that?


It might be possible to do that with compile-time checking for 
compile-time constants. For runtime checking, you already got the answer 
- provide a


class LeapYear {
LeapYear(int y) {
if (!condition) throw std::runtime_eror();
}
operator = (int y) { ...also test and throw... }
};

then:

LeapYear y2000 = 2000; // works
y2000 = 2004; // works
y2000 = 2001; // throws an error

The difference to Python is that "a=b" and "a+=b" are similar in C++, in 
both cases you call a method on the object "a", whereas in Python the 
first one is handled independently of the type of "a".


If you insist in compile-time checking, I think it's possible, though 
I'm not one of those C++ wizards to implement it from up my sleeve. The 
basic technique will be that you make your LeapYear 
constructible/assignable from a static type only where constructino of 
the type fails if the condition is not met. So


class LeapYear {
...
template operator = (LeapYearCheck y)
{
// at this point, we are sure that LeapYearCheck succeeded
}
};

LeapYearCheck could be implemented using template metaprogramming 
(quite horrible) or the new funky constexpr feature in C++11/C++14 (less 
horrible).


However this will throw an error whenever the compiler can't prove that 
the year is a leap year, effectively only when it can be computed at 
compile time, which certainly limits the usefulness of this type.

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


[issue32889] Valgrind suppressions need updating

2018-02-20 Thread Paul Price

New submission from Paul Price :

Using the current valgrind suppressions (Misc/valgrind-python.supp) results in 
a lot of noise, e.g.:

==2662549== Conditional jump or move depends on uninitialised value(s)
==2662549==at 0x4EFD734: address_in_range (obmalloc.c:1200)
==2662549==by 0x4EFD734: _PyObject_Free (obmalloc.c:1467)
==2662549==by 0x4FAA6A3: block_free (pyarena.c:95)
==2662549==by 0x4FAA6A3: PyArena_Free (pyarena.c:169)

The suppressions are blocking Py_ADDRESS_IN_RANGE, but this function was 
renamed in 3.6.

--
messages: 312436
nosy: Paul Price
priority: normal
pull_requests: 5563
severity: normal
status: open
title: Valgrind suppressions need updating
versions: Python 3.6, 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



[issue31848] "aifc" module does not always initialize "Aifc_read._ssnd_chunk"

2018-02-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5562

___
Python tracker 

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



[issue31848] "aifc" module does not always initialize "Aifc_read._ssnd_chunk"

2018-02-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5560

___
Python tracker 

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



[issue31848] "aifc" module does not always initialize "Aifc_read._ssnd_chunk"

2018-02-20 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5561

___
Python tracker 

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



[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-20 Thread Josh Rosenberg

Josh Rosenberg  added the comment:

First off, link to discussion: 
https://groups.google.com/d/topic/python-ideas/-3QW3cxj3ko/discussion

1. bool is already a virtual subclass of Integral since it's an actual subclass 
of int (which is a virtual subclass of Integral); no need to explicitly 
register it

2. Don't try to register numpy's types for them; doing so would mean simply 
having numpy installed forces it to be imported if you import numbers, even if 
your script never uses numpy. Let numpy add registration for the type itself.

3. If Boolean is not a subclass of Integer/Integral, why is it in the numbers 
module at all? The discussion seemed to suggest putting it in numbers when the 
idea was that Boolean would subclass Integer/Integral; if it's not numeric at 
all, then the numbers module doesn't make sense.

4. Obviously, it's impossible to overload the not behavior (__bool__ is called 
directly to get a true bool, then the result is inverted, there is no special 
method for handling the not keyword), so it looks like the proposal is to make 
__invert__ part of the interface. Except bool itself doesn't behave in a way 
that would make __invert__ make sense as a drop in substitution for not; ~True 
produces -2, ~False produces -1, in neither case does it produce a bool result, 
and the result is always truthy. Changing this is impractical, since it would 
violate the int-like behavior of bool (which has been a historical guarantee).

--
nosy: +josh.r

___
Python tracker 

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



[issue31848] "aifc" module does not always initialize "Aifc_read._ssnd_chunk"

2018-02-20 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 80d20b918bd8a882043c493a7f958333ecb41727 by Serhiy Storchaka 
(Zackery Spytz) in branch 'master':
bpo-31848: Fix broken error handling in Aifc_read.initfp() when the SSND chunk 
is not found (#5240)
https://github.com/python/cpython/commit/80d20b918bd8a882043c493a7f958333ecb41727


--
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: Any users of statistics.mode() here?

2018-02-20 Thread MRAB

On 2018-02-20 20:20, Jason Friedman wrote:

statistics.mode() currently raises an exception if there is more than one
mode.



I am an infrequent user of this package and this function.  My two cents:
* Leave the current behavior as-is.
* Continue to throw an exception for no data.
* Add an argument, named perhaps mutli=False, that if set to True causes
the function to a return a list of modes, including if there is only a
single mode.  statistics.mode((1, 2, 2, 3, 3, 4, 4, 5), multi=True) would
return [2, 3, 4].
* Would still throw StatisticsError if no data or if every element occurs
exactly the same number of times (for example,
statistics.mode(range(10), multi=True))

I think that it would be better to have a separate function instead of 
having the function sometimes return a single value and sometimes a list 
of values.


There's an interesting answer here:

http://mathforum.org/library/drmath/view/61375.html
--
https://mail.python.org/mailman/listinfo/python-list


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Chris Angelico
On Wed, Feb 21, 2018 at 7:42 AM, Rick Johnson
 wrote:
> On Tuesday, February 20, 2018 at 2:18:31 PM UTC-6, MRAB wrote:
>
>> The point he was making is that if you store a person's age, you'd have
>> to update it every year. It's far better to store the date of birth and
>> calculate the age on demand.
>
> *AHEM*
>
> At the risk of being labeled a "quibbler" (which, in the
> grander scheme is not really all that bad considering some
> of the names that have been attributed to me), i must say
> your advice is only "sound advice" in cases where the age
> will not be queried frequently.
>
> For instance, if the age is queried many times a second, it
> would be a much wiser design to set-up an event that will
> advance the age at the end of the last second of every year,
> instead of doing the age calculation many times a second.
> Heck, even if the frequency is multiple time a day, a valid
> argument could be made.

Nope. Even if you need the age many times per second, it's still
better to store the date of birth, because you eliminate boundary
conditions and duplicated data. But that's assuming you're storing the
age of *a person*. If the age in question is a boundary ("motor
insurance premiums are increased if the driver is 65 years or older"),
then it's still sane to store the age.

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


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread bartc

On 20/02/2018 20:17, MRAB wrote:

On 2018-02-20 19:17, bartc wrote:

On 20/02/2018 19:04, Dennis Lee Bieber wrote:
On Tue, 20 Feb 2018 17:11:05 +, "Wild, Marcel, Prof 
"

 declaimed the following:



So the special type of the values 65..90 might not allow the type be 
multiplied or divided, or added to itself. Because they represent 
characters A..Z. Or house numbers. Or the age of pensioners. (You'd 
need to convert to ordinary integers, is that is allowed.)



Off-hand -- if you are storing the /age of pensioners/, you have an
inappropriate data model... Age being a time varying value computed as:
    time_now - date_of_birth
and date_of_birth is the proper entity for storage...


If you wanted a scientifically exact value, maybe.

But someone who's 24.157094 years old now won't say their age is
24.157094 (and 24.157104 five minutes later). They will usually say they
are 24, until they are 25 (much older people prefer to round upwards,
for some reason).

So age is usually colloquially specified as an integer from 1 to around
100. Other than for young children where the lack of precision requires
the use of fractions or to switch to whole numbers of months or weeks.

The point he was making is that if you store a person's age, you'd have 
to update it every year. It's far better to store the date of birth and 
calculate the age on demand.


People are making too much of my example of a type consisting of a set 
of special values.


Anyway the values might not relate to an individual; they could be 
indices into a data structure so that C[65] gives you the number of 
65-year-olds or something, or 67 is the age at which someone is entitled 
to a pension.


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


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Rick Johnson
On Tuesday, February 20, 2018 at 2:18:31 PM UTC-6, MRAB wrote:

> The point he was making is that if you store a person's age, you'd have 
> to update it every year. It's far better to store the date of birth and 
> calculate the age on demand.

*AHEM*

At the risk of being labeled a "quibbler" (which, in the
grander scheme is not really all that bad considering some
of the names that have been attributed to me), i must say
your advice is only "sound advice" in cases where the age
will not be queried frequently.

For instance, if the age is queried many times a second, it
would be a much wiser design to set-up an event that will
advance the age at the end of the last second of every year,
instead of doing the age calculation many times a second.
Heck, even if the frequency is multiple time a day, a valid
argument could be made.

Of course. Outside of buggy loop that, much to the chagrin
of the code monkey who wrote it waxes infinite, i cannot
image many scenarios in which someone's age would be queried
many times a second.

But hey, this is Python-list after all. And i wouldn't be a
true pal i didn't point out an implicit corner case.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Any users of statistics.mode() here?

2018-02-20 Thread Jason Friedman
> statistics.mode() currently raises an exception if there is more than one
> mode.
>

I am an infrequent user of this package and this function.  My two cents:
* Leave the current behavior as-is.
* Continue to throw an exception for no data.
* Add an argument, named perhaps mutli=False, that if set to True causes
the function to a return a list of modes, including if there is only a
single mode.  statistics.mode((1, 2, 2, 3, 3, 4, 4, 5), multi=True) would
return [2, 3, 4].
* Would still throw StatisticsError if no data or if every element occurs
exactly the same number of times (for example,
statistics.mode(range(10), multi=True))
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29282] Fused multiply-add: proposal to add math.fma()

2018-02-20 Thread Nico Schlömer

Nico Schlömer  added the comment:

> Existing libm implementations don't work,

Okay. Is this because of the inf/NaN discrimination hiccups mentioned above or 
are there any other pitfalls?

--

___
Python tracker 

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



Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread MRAB

On 2018-02-20 19:17, bartc wrote:

On 20/02/2018 19:04, Dennis Lee Bieber wrote:

On Tue, 20 Feb 2018 17:11:05 +, "Wild, Marcel, Prof "
 declaimed the following:



So the special type of the values 65..90 might not allow the type be multiplied 
or divided, or added to itself. Because they represent characters A..Z. Or 
house numbers. Or the age of pensioners. (You'd need to convert to ordinary 
integers, is that is allowed.)



Off-hand -- if you are storing the /age of pensioners/, you have an
inappropriate data model... Age being a time varying value computed as:
time_now - date_of_birth
and date_of_birth is the proper entity for storage...


If you wanted a scientifically exact value, maybe.

But someone who's 24.157094 years old now won't say their age is
24.157094 (and 24.157104 five minutes later). They will usually say they
are 24, until they are 25 (much older people prefer to round upwards,
for some reason).

So age is usually colloquially specified as an integer from 1 to around
100. Other than for young children where the lack of precision requires
the use of fractions or to switch to whole numbers of months or weeks.

The point he was making is that if you store a person's age, you'd have 
to update it every year. It's far better to store the date of birth and 
calculate the age on demand.

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


[issue29282] Fused multiply-add: proposal to add math.fma()

2018-02-20 Thread Mark Dickinson

Mark Dickinson  added the comment:

> Do I read this thread correctly assuming that this hasn't been implemented 
> yet?

Yes. Existing libm implementations don't work, so simply wrapping the libm 
function isn't enough. And writing an implementation from scratch is 
non-trivial.

--

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2018-02-20 Thread Nico Schlömer

Nico Schlömer  added the comment:

Do I read this thread correctly assuming that this hasn't been implemented yet? 
If not, I would probably make my own little library for this -- I really need 
the feature for the precision.

--
nosy: +nschloe

___
Python tracker 

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



Re: Are the critiques in "All the things I hate about Python" valid? (Posting On Python-List Prohibited)

2018-02-20 Thread bartc

On 20/02/2018 19:35, Lawrence D’Oliveiro wrote:

On Wednesday, February 21, 2018 at 1:43:41 AM UTC+13, bartc wrote:

In Pascal (and presumably Ada) then all the
gubbins need to make this work properly:

var x: 1..10;

x = 10;
x = x + 1;   { error? }


Error on both statements. Pascal doesn’t allow a statement to just consist of 
an expression. At least, it didn’t the last time I checked.


OK, I forgot it needs := for assignment.


Besides, it’s not clear what the point is of doing a comparison between those 
terms and throwing the result away.


Many languages including Python allow exactly that.

(The ones I create make it an error. Only certain kinds of expression 
terms also have versions that can meaningfully be independent statements.)


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


[issue32500] PySequence_Length() raises TypeError on dict type

2018-02-20 Thread miss-islington

miss-islington  added the comment:


New changeset 6ae87cae091f4835090c10c1e65eb057a13fca2c by Miss Islington (bot) 
in branch '3.6':
bpo-32500: Correct the documentation for PySequence_Size() and 
PySequence_Length() (GH-5767)
https://github.com/python/cpython/commit/6ae87cae091f4835090c10c1e65eb057a13fca2c


--
nosy: +miss-islington

___
Python tracker 

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



Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Grant Edwards
On 2018-02-20, Rhodri James  wrote:

> The schism is not as wide as you are implying.  Aside from "print" 
> becoming a function, which is blindingly obvious whenever you trip over 
> it, there is relatively little reason why an ordinary Pythonista would 
> care whether he or she was running Python 2 or Python 3.

Any ordinary Pythonista to deals with raw data "bytes" cares a great
deal.  There are major differences between the Py2 and Py3 in that
area, and they're a royal PITA to deal with.

-- 
Grant Edwards   grant.b.edwardsYow! Are you mentally here
  at   at Pizza Hut??
  gmail.com

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


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread bartc

On 20/02/2018 19:04, Dennis Lee Bieber wrote:

On Tue, 20 Feb 2018 17:11:05 +, "Wild, Marcel, Prof "
 declaimed the following:



So the special type of the values 65..90 might not allow the type be multiplied 
or divided, or added to itself. Because they represent characters A..Z. Or 
house numbers. Or the age of pensioners. (You'd need to convert to ordinary 
integers, is that is allowed.)



Off-hand -- if you are storing the /age of pensioners/, you have an
inappropriate data model... Age being a time varying value computed as:
time_now - date_of_birth
and date_of_birth is the proper entity for storage...


If you wanted a scientifically exact value, maybe.

But someone who's 24.157094 years old now won't say their age is 
24.157094 (and 24.157104 five minutes later). They will usually say they 
are 24, until they are 25 (much older people prefer to round upwards, 
for some reason).


So age is usually colloquially specified as an integer from 1 to around 
100. Other than for young children where the lack of precision requires 
the use of fractions or to switch to whole numbers of months or weeks.



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


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Ben Finney
"Wild, Marcel, Prof "  writes:

> I scarcely know Python, and I have no intention delving into it
> further.

That's fine. This is a forum for those who do have an ongoing interest
in Python. I think your needs would be better served elsewhere.

-- 
 \   “Prediction is very difficult, especially of the future.” |
  `\   —Niels Bohr |
_o__)  |
Ben Finney

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


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Rhodri James

On 20/02/18 17:11, Wild, Marcel, Prof  wrote:

I scarcely know Python, and I have no intention delving into it further.
  I was forced to use Python because it features binary decision diagrams, 
which MATHEMATICA doesn't. Coming from Mathematica the account of Nathan Murphy 
reads like a nightmare.



I have to admit, I have no idea what you're talking about.  I suspect, 
though, that you would find a similar discussion of any other 
programming language at least as nightmarish.



The one point that stroke me the most was the schism between Python 2 and 3. No 
such thing with Mathematica: All its 11 or more versions are fully compatible, 
I never experienced any problems in this regard.


The schism is not as wide as you are implying.  Aside from "print" 
becoming a function, which is blindingly obvious whenever you trip over 
it, there is relatively little reason why an ordinary Pythonista would 
care whether he or she was running Python 2 or Python 3.  Python 3.5 vs 
Python 3.7 is much more likely to be a relevant question, because of 
course Python has evolved new features over time.


The statement "all its [...] versions are fully compatible" implies 
Mathematica hasn't evolved over those versions.  I sincerely doubt that 
is true.



Another point is the bad online help provided to "teach yourself" Python. For instance, 
it took me more than an hour to find out how to negate a Boolean variable, whereas in Mathematica 
you would just type "Negation" in the Wolfram Documentation search window, and get the 
information you need.


This is likely to be a personal thing.  Mathematica ties you firmly to 
its IDE; you get all the bells and whistles of that IDE, but only the 
bells and whistles of that IDE.  Python doesn't tie you to anything in 
particular, so you have to provide your own bells and whistles (but can 
provide any you can find or create).


That said, you are not making a good case for your research skills. 
Googling "python boolean negation" got me the information in under a 
minute, including the Firefox startup time.  Reading through the Boolean 
Expressions part of the online documentation at docs.python.com took 
little longer, though admittedly that isn't meant for beginners.  Even 
firing up a Python interpreter and typing


>>> help("not")

didn't take that long (and honestly, "negation" is not the first word I 
think of when inverting booleans).




I know one pays for Mathematica whereas Python is open source, but I've come to 
realize now that this money is very well spent!

Question: Apart from a few commands not available in Mathematica, such as 
expr2bdd, is there really any domain of computation where Mathematica is 
inferior to Python?


Not knowing much about Mathematica, all I can say is "almost certainly."

--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


[issue32888] Improve exception message in ast.literal_eval

2018-02-20 Thread Chris Angelico

Chris Angelico  added the comment:

Actually, it's a bit more complicated than I thought. Current proposed 
solution: Track the context of each conversion, thus allowing different errors 
to be distinguished.

--

___
Python tracker 

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



[issue32874] IDLE: Add tests for pyparse

2018-02-20 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Thanks for pointing out #21765 - very interesting reading.  :-)

Would the new str.isascii() be helpful or would it be too early to use 
something only available in 3.7?  It would seem that and combinations of `if 
isascii() and isidentifier()` might be interesting to benchmark against some of 
the current code.

--

___
Python tracker 

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



Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Richard Damon


> On Feb 20, 2018, at 8:58 AM, Chris Angelico  wrote:
> 
>> On Wed, Feb 21, 2018 at 12:53 AM, Antoon Pardon  wrote:
>> In C++ I can do something like:
>> 
>>  SomeClass MyVar;
>> 
>> And after that the kind of possible assignments to MyVar are constraint. It
>> makes the runtime throw an error when somewhere the program tries to assign
>> something to MyVar that isn't allowed by SomeClass.
>> 
>> You can't put such constraints on names in Python.
>> 
>> In C++ I can do some like:
>>Some_Class: MyVar;
>> 
>> And after that, It will be impossible to assign a value to MyVar that
>> doesn't meet the
>> constraints imposed by the constructor/copy operator. You have put
>> somekind of
>> contract on the name MyVar, that limits the kind of things assignable to
>> it. You
>> can't put such constraints on a name in Python.
> 
> Okay. Now create a constraint on a name in C++ such that it can only
> accept integers representing A.D. years which, on the Gregorian
> calendar, are leap years. (Using a dedicated integer-like type is
> permitted.) It must accept all multiples of four, except those which
> are multiples of one hundred, unless they're also multiples of four
> hundred.
> 
> That's what Steve asked for. Can you do it? Or is the C++ type system
> not flexible enough for that?
> 
> ChrisA
> -- 
> https://mail.python.org/mailman/listinfo/python-list

Such a class would be fairly trivial to write in C++, or I suspect Python.

In C++ you would have a constructor and possibilities an assignment operator 
that takes an integer, tests it for validity and throw/asserts if it is 
incorrect. (Depending on other requirements, you might allow or not implicit 
conversions)
It probably also has a constructor and an assignment operator that takes a 
‘LeapYear’ and just uses it.
To be usable, it will need something to allow you to get the integer value out, 
might be implicit or explicit.

The big issue with such a type, and why it doesn’t make much sense as a type, 
is that there is very little that can be done with such a type, as there is no 
interesting operation for which the type is at least mostly closed under, at 
best it is closed under +400*n
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread Rick Johnson
On Tuesday, February 20, 2018 at 9:40:37 AM UTC-6, Steven D'Aprano wrote:
[...]
> Yes you did: you refused to meet the challenge, stating (and I quote):

I'm always entertained by Steven's so-called "challenges". You see, Steven is
addicted to winning, and he'll do anything to win a debate, even construct a
challenge that is obviously untenable. A typical example of Steven's
absurd challenges goes something like this:


from absurd.challenges.missonimpossible import Message

body = """
MISSON: MOVE YOURSELF FROM YOUR CURRENT POSITION ON THE
ON THIS EARTH TO THE TOP OF THE EIFFEL TOWER IN PARIS,
FRANCE.

CAVEAT_1: You cannot use public or private modes of
transportation. Including, (but not limited to): planes,
trains automobiles, boats, jet-skis, roller- skates,
skate boards, kites, gliders, bicycles, tricycles,
unicycles, big- wheels, hot-air balloons, magic carpets,
etc...

CAVEAT_2: Neither may you move yourself using your own
forms of bodily locomotion. Including (but not limited
to): crawling, walking, running, jogging, rolling,
skipping, jumping, hopping, cartwheels, backflips,
etc...

CAVEAT_3: Neither may you utilize the animal kingdom to
transport yourself. Including (but not limited to):
Being carried by an army of ants, a flock of birds, a
gang of gorilla, or a pod of orca, etc...

CAVEAT_4: If you happen to be at the top of the Eiffel
tower upon learning of this challenge, it doesn't count.
But please do post a pic on Instagram, as i rather enjoy
a good view. Thanks :-)

CAVEAT_5: Teleportation is strictly forbidden! Although
it'd be a neat trick. And if you have a working
prototype i'd love to stop by for a personal
demonstration and have a chance to make copies of the
schematics and the code base. (for documentation
purposes only, of course)

This is your misson, should you choose to accept it...
"""

if __name__ == '__main__':
msg = Message(title="Loco-motion", body=body)
msg.play_async("misson_impossible.mp3")
print msg
msg.after(10, exit)
raw_input('\nThis message will self destruct in ~10 seconds...')

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


  1   2   >