Re: sigmoid function and derivative

2018-06-26 Thread Terry Reedy

On 6/26/2018 11:26 PM, Sharan Basappa wrote:

Folks,

I know this is not a machine learning forum but I wanted to see if anyone can 
explain this to me.

In artificial neural network, I can understand why sigmoid is used but I see 
that derivative of sigmoid output function is used. I am not able to understand 
why.

For example:
# convert output of sigmoid function to its derivative
def sigmoid_output_to_derivative(output):
 return output*(1-output)


Derivatives are used for backpropagation* of errors for adjusting 
weights.  The convenient form of sigmoid derivative is a reason to use 
sigmoids as transfer functions.


* You can look backpropagation as a method of training.

--
Terry Jan Reedy

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


[issue33975] IDLE: adjust DPI before Tk() for htests.

2018-06-26 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Both PRs have been merged.

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



[issue33975] IDLE: adjust DPI before Tk() for htests.

2018-06-26 Thread miss-islington


miss-islington  added the comment:


New changeset 5d2d9d7c08819c7fbdfd7906858609e5070c20dd by Miss Islington (bot) 
in branch '3.6':
bpo-33975: Avoid small type when running IDLE's htests. (GH-7944)
https://github.com/python/cpython/commit/5d2d9d7c08819c7fbdfd7906858609e5070c20dd


--
nosy: +miss-islington

___
Python tracker 

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



[issue33975] IDLE: adjust DPI before Tk() for htests.

2018-06-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7560

___
Python tracker 

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



[issue33975] IDLE: adjust DPI before Tk() for htests.

2018-06-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7559

___
Python tracker 

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



[issue33975] IDLE: adjust DPI before Tk() for htests.

2018-06-26 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 3c8043d8fac4c0d05c0ba9e4e555e2f3165f2fe0 by Terry Jan Reedy in 
branch 'master':
bpo-33975: Avoid small type when running IDLE's htests. (GH-7944)
https://github.com/python/cpython/commit/3c8043d8fac4c0d05c0ba9e4e555e2f3165f2fe0


--

___
Python tracker 

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



[issue33976] Enums don't support nested classes

2018-06-26 Thread Edward Wang


Change by Edward Wang :


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

___
Python tracker 

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



[issue32475] Add ability to query number of buffered bytes available on buffered I/O

2018-06-26 Thread Josh Snyder


Josh Snyder  added the comment:

I've opened PR #7947 with another approach to this issue.

In my use-case, an HTTP client makes a request and uses buffered I/O to parse 
the response headers. I would like to hand off the response socket to an 
extension module for use with raw I/O syscalls. The BufferedReader likely 
already contains some of the response body, which I would like to access before 
handing the socket off.

--
nosy: +josnyder

___
Python tracker 

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



[issue33976] Enums don't support nested classes

2018-06-26 Thread Edward Wang


New submission from Edward Wang :

Methods defined in Enums behave 'normally' but classes defined in Enums get 
mistaken for regular values and can't be used as classes out of the box.

```python
class Outer(Enum):
a = 1
b = 2
class Inner(Enum):
foo = 10
bar = 11
```

--
messages: 320541
nosy: edwardw
priority: normal
severity: normal
status: open
title: Enums don't support nested classes
type: behavior

___
Python tracker 

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



[issue32475] Add ability to query number of buffered bytes available on buffered I/O

2018-06-26 Thread Josh Snyder


Change by Josh Snyder :


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

___
Python tracker 

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



[issue33956] update vendored expat to 2.2.5

2018-06-26 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 468f97b4640e69b237a707a0ef9152d1c023f701 by Benjamin Peterson in 
branch '2.7':
[2.7] closes bpo-33956: update vendored expat to 2.2.5 (GH-7925)
https://github.com/python/cpython/commit/468f97b4640e69b237a707a0ef9152d1c023f701


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



[issue29514] Add a test case that prevents magic number changes in minor releases

2018-06-26 Thread Ned Deily


Ned Deily  added the comment:


New changeset f79386f669c22199e3ce99cfba2e5945c73beb47 by Ned Deily in branch 
'2.7':
bpo-29514: Make magic number test work for candidates (GH-7946)
https://github.com/python/cpython/commit/f79386f669c22199e3ce99cfba2e5945c73beb47


--

___
Python tracker 

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



[issue29514] Add a test case that prevents magic number changes in minor releases

2018-06-26 Thread Ned Deily


Ned Deily  added the comment:


New changeset 57389dbaa897fadc97de78af67d5e555e28be60b by Ned Deily in branch 
'3.6':
bpo-29514: Make magic number test work for candidates (GH-7945)
https://github.com/python/cpython/commit/57389dbaa897fadc97de78af67d5e555e28be60b


--

___
Python tracker 

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



sigmoid function and derivative

2018-06-26 Thread Sharan Basappa
Folks,

I know this is not a machine learning forum but I wanted to see if anyone can 
explain this to me.

In artificial neural network, I can understand why sigmoid is used but I see 
that derivative of sigmoid output function is used. I am not able to understand 
why.

For example:
# convert output of sigmoid function to its derivative
def sigmoid_output_to_derivative(output):
return output*(1-output)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29514] Add a test case that prevents magic number changes in minor releases

2018-06-26 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +7555

___
Python tracker 

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



[issue29514] Add a test case that prevents magic number changes in minor releases

2018-06-26 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +7554

___
Python tracker 

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



[issue29514] Add a test case that prevents magic number changes in minor releases

2018-06-26 Thread Ned Deily


Ned Deily  added the comment:


New changeset 8511b448a55929f15aa5730c9e30cbb654978ea4 by Ned Deily in branch 
'3.7':
bpo-29514: Make magic number test work for candidates
https://github.com/python/cpython/commit/8511b448a55929f15aa5730c9e30cbb654978ea4


--

___
Python tracker 

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



[issue33975] IDLE: adjust DPI before Tk() for htests.

2018-06-26 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: IDLE: adjust DPI before Tk() -> IDLE: adjust DPI before Tk() for htests.

___
Python tracker 

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



[issue33975] IDLE: adjust DPI before Tk()

2018-06-26 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Because of import caching, subsequent pyshell imports, after the first, do not 
re-call the Windows API.

Apparently, 'root.destroy()' undoes a previous 'root = Tk()', but not a 
previous pyshell import.  Since IDLE unittests always destroy roots, a unittest 
before an htest does not require anything more to work right.

Since part of the purpose of human-viewed tests is to determine that widgets 
look right, it is important that they look the same for testing
as when running IDLE.

--

___
Python tracker 

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



[issue33975] IDLE: adjust DPI before Tk()

2018-06-26 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +7553

___
Python tracker 

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



[issue33956] update vendored expat to 2.2.5

2018-06-26 Thread miss-islington


miss-islington  added the comment:


New changeset 5dc3f23b5fb0b510926012cb3732dae63cddea60 by Miss Islington (bot) 
in branch '3.6':
bpo-33956: update vendored expat to 2.2.5 (GH-7925)
https://github.com/python/cpython/commit/5dc3f23b5fb0b510926012cb3732dae63cddea60


--

___
Python tracker 

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



[issue33956] update vendored expat to 2.2.5

2018-06-26 Thread miss-islington


miss-islington  added the comment:


New changeset fb17b81fc90cb8f64fcffbada2cadb6736f6d7fd by Miss Islington (bot) 
in branch '3.7':
bpo-33956: update vendored expat to 2.2.5 (GH-7925)
https://github.com/python/cpython/commit/fb17b81fc90cb8f64fcffbada2cadb6736f6d7fd


--
nosy: +miss-islington

___
Python tracker 

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



[issue33975] IDLE: adjust DPI before Tk()

2018-06-26 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: IDLE: only adjust DPI before Tk() -> IDLE: adjust DPI before Tk()

___
Python tracker 

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



[issue29514] Add a test case that prevents magic number changes in minor releases

2018-06-26 Thread Ned Deily


Ned Deily  added the comment:


New changeset e7d3cccd8e0da93a15ca80f4b6aac2ca3435fd06 by Ned Deily in branch 
'master':
bpo-29514: Make magic number test work for candidates
https://github.com/python/cpython/commit/e7d3cccd8e0da93a15ca80f4b6aac2ca3435fd06


--
nosy: +ned.deily

___
Python tracker 

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



[issue33956] update vendored expat to 2.2.5

2018-06-26 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
pull_requests: +7552

___
Python tracker 

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



[issue33956] update vendored expat to 2.2.5

2018-06-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7551

___
Python tracker 

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



[issue33956] update vendored expat to 2.2.5

2018-06-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7550

___
Python tracker 

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



[issue33956] update vendored expat to 2.2.5

2018-06-26 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 4e21100fa7bf66e0b32146d3f46ae16afc73fee1 by Benjamin Peterson in 
branch 'master':
bpo-33956: update vendored expat to 2.2.5 (GH-7925)
https://github.com/python/cpython/commit/4e21100fa7bf66e0b32146d3f46ae16afc73fee1


--

___
Python tracker 

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



[issue33975] IDLE: only adjust DPI before Tk()

2018-06-26 Thread Terry J. Reedy


New submission from Terry J. Reedy :

#33656 patched PyShell to call SetProcessDpiAwareness on Windows nearly first 
thing, *at module level*, well before calling tkinter.Tk().  The Microsoft docs 
warn that making the Windows API call after starting the graphics system may 
not work as expected.  With tk 8.6,8, the result is sharp, but small type -- 
perhaps 7 points instead of 10.  This issue is about avoiding type shrinkage, 
both when running the htest suite as a whole and when running the test for an 
individual file after running the unittests.

To do that in any process, pyshell must be imported before Tk() is called.  The 
patch adds the following to htest.py.
import idlelib.pyshell  # Set Windows DPI awareness before Tk().

I will add the same where needed to the top of if __name__ == '__main__': 
clauses in idlelib modules, before running unittests.

--
assignee: terry.reedy
components: IDLE
messages: 320531
nosy: terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: IDLE: only adjust DPI before Tk()
type: behavior
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



[issue24137] Force not using _default_root in IDLE

2018-06-26 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The net effect of this issue:

pyshell.main calls NoDefaultRoot() when running normally, when using a 
subprocess and testing is not set.  It does not call it when in -n mode since 
that would affect users.

idle_test.htest  calls NoDefaultRoot() unconditionally.  pyshell.main is not 
called.

test.test_idle sets testing to avoid the call when run by test.regrtest, to 
avoid failing the latter's changed-environment check.  But it does call 
NoDefaultRoot when run as __main__ and the tests are run by unittest.main.

Known dependencies on a default root have been removed.  It is unlikely that 
any are left.

--

___
Python tracker 

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



[issue33973] HTTP request-line parsing splits on Unicode whitespace

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:

isspace() is also true for another non-ASCII character: U+0085 (b'\x85').

>>> ''.join(chr(i) for i in range(256) if chr(i).isspace())
'\t\n\x0b\x0c\r\x1c\x1d\x1e\x1f \x85\xa0'

--

___
Python tracker 

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



[issue33966] test_multiprocessing_spawn.WithProcessesTestPool.test_traceback() leaks 4 handles on Windows

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:

> * dump() indirectly calls reduce_connection() (ex: for SimpleQueue._reader) 
> of multiprocessing.connection
> * reduce_connection() duplicates the pipe handle

Sorry, it's reduce_pipe_connection(), not reduce_connection().

> It's unclear to me who is supposed to close the duplicated pipe handles? 
> reduce_connection() creates a "ds = resource_sharer.DupSocket(s)" object, but 
> this object doesn't seem to call CloseHandle()?

reduce_pipe_connection() creates a DupHandle object which duplicates the 
handle, and it's detach() method closes the handle.

The race condition is that sometimes the pool terminates a worker (worker() 
function of multiprocessing.pool) before the worker has time to close the 
duplicated handle.

The handle is closed by:
* rebuild_pipe_connection()
* dh.detach(), extract:

return _winapi.DuplicateHandle(
proc, self._handle, _winapi.GetCurrentProcess(),
self._access, False, _winapi.DUPLICATE_CLOSE_SOURCE)

--

___
Python tracker 

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



[issue33917] Fix and document idlelib/idle_test/template.py

2018-06-26 Thread Ned Deily


Ned Deily  added the comment:

FTR, the problem change was merged/backported after 3.7.0rc1 and 3.6.6rc1 so 
doko must have been working from a development branch and not a release tag.  
The original and its fix will first be officially released in 3.7.1 and 3.6.7 
so there's really no need for a correction NEWS entry; it doesn't hurt either.

--
priority: release blocker -> 

___
Python tracker 

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



[issue24567] random.choice IndexError due to double-rounding

2018-06-26 Thread Tim Peters


Tim Peters  added the comment:

[Victor]
> This method [shuffle()] has a weird API. What is
> the point of passing a random function,
> ... I proposed to deprecate this argument and remove it later.

I don't care here.  This is a bug report.  Making backward-incompatible API 
changes does nothing to repair existing programs.

> ...
>  return [population[_min(_int(random() * total), total)]
>for i in range(k)]
>
> Why not using _randbelow() here? For speed

Yup.


> Why not optimizing _randbelow() in this case? Like
> implementing it in C?

This is a bug report, not an invitation to redesign APIs and complicate 
implementations in non-trivial ways.  If you're keen on that, I suggest opening 
a different issue and writing the patch.

I'd personally oppose the API change (pointless thrashing), but it's possible 
the speed benefit of C acceleration of _randbelow() would outweigh the 
considerable downsides of moving code from Python source to C source.

But none of that is needed to "fix the bug" at hand, if - indeed - people still 
think it's worth fixing at all.  In the years that have passed since this 
started, I no longer do.

--

___
Python tracker 

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



[issue33966] test_multiprocessing_spawn.WithProcessesTestPool.test_traceback() leaks 4 handles on Windows

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:

* Pool._repopulate_pool() creates processes with args=(self._inqueue, ...)
* Pool._inqueue is a multiprocessing.queues.SimpleQueue
* Process.__init__() of multiprocessing.popen_spawn_win32 calls 
reduction.dump(process_obj, to_child) which indirectly contains the SimpleQueue
* A SimpleQueue object contains: self._reader, self._writer = 
connection.Pipe(duplex=False)
* dump() indirectly calls reduce_connection() (ex: for SimpleQueue._reader) of 
multiprocessing.connection
* reduce_connection() duplicates the pipe handle

It's unclear to me who is supposed to close the duplicated pipe handles? 
reduce_connection() creates a "ds = resource_sharer.DupSocket(s)" object, but 
this object doesn't seem to call CloseHandle()?

--

___
Python tracker 

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



Re: syntax difference

2018-06-26 Thread Gregory Ewing

Bart wrote:
I don't know whether there is a direct equivalent in Python (I thought 
somebody would point it out)


Not built-in, but a tiny bit of googling turns this up:

https://pypi.org/project/bitarray/

"This module provides an object type which efficiently represents an array of 
booleans. Bitarrays are sequence types and behave very much like usual lists. 
Eight bits are represented by one byte in a contiguous block of memory."


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


Re: I'm getting a spamassassin party here

2018-06-26 Thread Cameron Simpson

On 27Jun2018 08:55, Cameron Simpson  wrote:

On closer inspection it looks like a FIDONET gateway may be the cause.

I've made enquiries of ab...@news.bbs.nz and newsmas...@news.bbs.nz, and am 
awaiting a response.


I've also asked at Castle Rock BBS, based on a different header.

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: syntax difference

2018-06-26 Thread Gregory Ewing

Bart wrote:

   x = set(range(10_000_000))

This used up 460MB of RAM (the original 100M I tried exhausted the memory).

The advantage of Pascal-style sets is that that same set will occupy 
only 1.25MB, as it is a bit-map.


That's true, but they're also extremely limited compared to
the things you can do with Python sets. They're really two
quite different things, designed for different use cases.

Compact sets of integers are possible in Python, but not
as a built-in type. This suggests that they're not needed
much -- if they were used a lot, they would have become
part of the stdlib by now.

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


Re: I'm getting a spamassassin party here

2018-06-26 Thread Gregory Ewing

Cameron Simpson wrote:
> I've been noticing a swathe of messages in the past few days with From:
> headers like this:
>
>  From: "Steven D'Aprano" 

In comp.lang.python I'm seeing repeats of messages that were
posted 2 or 3 days ago, with these mangled addresses.

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


Re: I'm getting a spamassassin party here

2018-06-26 Thread Cameron Simpson

On 26Jun2018 07:44, Richard Damon  wrote:

On 6/26/18 2:50 AM, Cameron Simpson wrote:

On 24Jun2018 17:03, Gene Heskett  wrote:

Generally spamassassin only gets picky about this occasionally, but for
the past several hours its working overtime on python list messages,
with the major problem being the servers time stamp, a day or more in
the past. Anyboy ever hear of ntpd?
-- Cheers, Gene Heskett


Could you eyeball some of these problematic messages please?

I've been noticing a swathe of messages in the past few days with
From: headers like this:

 From: "Steven D'Aprano" 

where the From: has been badly mangled, I think by a usenet->list
gateway. The Path: on these messages looks like this (give or take):

 Path:
uni-berlin.de!fu-berlin.de!news.linkpendium.com!news.linkpendium.com!news.snarked.org!news.bbs.nz!.POSTED.184-155-113-241.cpe.cableone.net!not-for-mail

I'd be interested to know if there is significant overlap between my
problematic messages and yours.

Cheers,
Cameron Simpson 


I am seeing similarly mangled messages, From is mangled, but the
original added to the body, References are removed (so they don't
thread), a day or two old.

It looks like it was relayed to the list by news.bbs.nz


On closer inspection it looks like a FIDONET gateway may be the cause.

I've made enquiries of ab...@news.bbs.nz and newsmas...@news.bbs.nz, and am 
awaiting a response.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


[issue25007] Add support of copy protocol to zlib compressors and decompressors

2018-06-26 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



Re: Where's the junk coming from?

2018-06-26 Thread Cameron Simpson

On 25Jun2018 18:37, Mark Lawrence  wrote:
More of the flaming things, this time name@1261/38.remove-ij1-this.  Any ideas 
as I don't understand this stuff?


Looks like a FIDONET gateway leaking somehow. I've made an enquiry to a 
possible source for the message, we'll see what transpires.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


[issue25007] Add support of copy protocol to zlib compressors and decompressors

2018-06-26 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +7549
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



[ANN] PyYAML-4.1: YAML parser and emitter for Python

2018-06-26 Thread Ingy dot Net
===
 Announcing PyYAML-4.1
===

A new MAJOR RELEASE of PyYAML is now available:
https://pypi.org/project/PyYAML/

This is the first release of PyYAML under a new maintenance team. In August
2016, maintenance of PyYAML and LibYAML was turned over from the original
author, Kirill Simonov, to Ian Cordasco and Ingy döt Net.

The canonical source repo moved:

from: https://bitbucket.org/xi/pyyaml/
to:   https://github.com/yaml/pyyaml

The PyYAML project is now maintained by the YAML and Python communities.
Planning happens on the #yaml-dev, #pyyaml and #libyaml IRC channels on
irc.freenode.net.


Changes
===

* https://github.com/yaml/pyyaml/pull/35  -- Some modernization of the test
running
* https://github.com/yaml/pyyaml/pull/42  -- Install tox in a virtualenv
* https://github.com/yaml/pyyaml/pull/45  -- Allow colon in a plain scalar
in a flow context
* https://github.com/yaml/pyyaml/pull/48  -- Fix typos
* https://github.com/yaml/pyyaml/pull/55  -- Improve RepresenterError
creation
* https://github.com/yaml/pyyaml/pull/59  -- Resolves #57, update readme
issues link
* https://github.com/yaml/pyyaml/pull/60  -- Document and test Python 3.6
support
* https://github.com/yaml/pyyaml/pull/61  -- Use Travis CI built in pip
cache support
* https://github.com/yaml/pyyaml/pull/62  -- Remove tox workaround for
Travis CI
* https://github.com/yaml/pyyaml/pull/63  -- Adding support to Unicode
characters over codepoint 0x
* https://github.com/yaml/pyyaml/pull/65  -- Support unicode literals over
codepoint 0x
* https://github.com/yaml/pyyaml/pull/74  -- Make pyyaml safe by default.
* https://github.com/yaml/pyyaml/pull/75  -- add 3.12 changelog
* https://github.com/yaml/pyyaml/pull/76  -- Fallback to Pure Python if
Compilation fails
* https://github.com/yaml/pyyaml/pull/84  -- Drop unsupported Python 3.3
* https://github.com/yaml/pyyaml/pull/111 -- Remove commented out Psyco code
* https://github.com/yaml/pyyaml/pull/149 -- Test on Python 3.7-dev
* https://github.com/yaml/pyyaml/pull/158 -- Support escaped slash in
double quotes "\/"


Resources
=

PyYAML IRC Channel: #pyyaml on irc.freenode.net
PyYAML homepage: https://github.com/yaml/pyyaml
PyYAML documentation: http://pyyaml.org/wiki/PyYAMLDocumentation
Source and binary installers: https://pypi.org/project/PyYAML/
GitHub repository: https://github.com/yaml/pyyaml/
Bug tracking: https://github.com/yaml/pyyaml/issues

YAML homepage: http://yaml.org/
YAML-core mailing list:
http://lists.sourceforge.net/lists/listinfo/yaml-core


About PyYAML


YAML is a data serialization format designed for human readability and
interaction with scripting languages. PyYAML is a YAML parser and emitter
for
Python.

PyYAML features a complete YAML 1.1 parser, Unicode support, pickle support,
capable extension API, and sensible error messages. PyYAML supports standard
YAML tags and provides Python-specific tags that allow to represent an
arbitrary Python object.

PyYAML is applicable for a broad range of tasks from complex configuration
files to object serialization and persistence.


Example
===

>>> import yaml

>>> yaml.load("""
... name: PyYAML
... description: YAML parser and emitter for Python
... homepage: https://github.com/yaml/pyyaml
... keywords: [YAML, serialization, configuration, persistence, pickle]
... """)
{'keywords': ['YAML', 'serialization', 'configuration', 'persistence',
'pickle'], 'homepage': 'https://github.com/yaml/pyyaml', 'description':
'YAML parser and emitter for Python', 'name': 'PyYAML'}

>>> print yaml.dump(_)
name: PyYAML
homepage: https://github.com/yaml/pyyaml
description: YAML parser and emitter for Python
keywords: [YAML, serialization, configuration, persistence, pickle]


Maintainers
===

The following people are responsible for maintaining PyYAML:

* Ingy döt Net
* Ian Cordasco
* Tina Mueller
* Alex Gaynor
* Donald Stufft
* Matt Davis

and many thanks to all who have contribributed!
See: https://github.com/yaml/pyyaml/pulls


Copyright
=

Copyright (c) 2017-2018 Ingy döt Net 
Copyright (c) 2006-2016 Kirill Simonov 

The PyYAML module was written by Kirill Simonov .
It is currently maintained by the YAML and Python communities.

PyYAML is released under the MIT license.
See the file LICENSE for more details.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33873] False positives when running leak tests with -R 1:1

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:

Pablo Galindo Salgado fixed the bug in master, I backported his fix to 2.7, 3.6 
and 3.7 branches. Thanks Pablo!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 2.7, 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



[issue33718] Enhance regrtest: meta-ticket for multiple changes

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1d55888a78bcefed3723fb7e48df2a75b4f0adb0 by Victor Stinner in 
branch '3.6':
bpo-33873: Backport regrtest from master to 3.7 (GH-7935) (GH-7937)
https://github.com/python/cpython/commit/1d55888a78bcefed3723fb7e48df2a75b4f0adb0


--

___
Python tracker 

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



[issue33873] False positives when running leak tests with -R 1:1

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1d55888a78bcefed3723fb7e48df2a75b4f0adb0 by Victor Stinner in 
branch '3.6':
bpo-33873: Backport regrtest from master to 3.7 (GH-7935) (GH-7937)
https://github.com/python/cpython/commit/1d55888a78bcefed3723fb7e48df2a75b4f0adb0


--

___
Python tracker 

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



[issue24567] random.choice IndexError due to double-rounding

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:

Let me see random_double_round.diff.

In master:

def shuffle(self, x, random=None):
"""Shuffle list x in place, and return None.

Optional argument random is a 0-argument function returning a
random float in [0.0, 1.0); if it is the default None, the
standard random.random will be used.

"""

This method has a weird API. What is the point of passing a random function, 
whereas shuffle() is already a method of an object which generates random 
numbers?! The bug only affects the case when random is set. I proposed to 
deprecate this argument and remove it later.

return [population[_min(_int(random() * total), total)]
for i in range(k)]

Why not using _randbelow() here? For speed according to:

> some variant of `int(random() * someinteger)` is being used in an inner loop 
> for speed.

Why not optimizing _randbelow() in this case? Like implementing it in C?

--

___
Python tracker 

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



[issue5978] cProfile and profile don't work with pygtk/pyqt and sys.exit(0)

2018-06-26 Thread Andrés Delfino

Change by Andrés Delfino :


--
nosy: +adelfino
versions: +Python 2.7, 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



[issue5978] cProfile and profile don't work with pygtk/pyqt and sys.exit(0)

2018-06-26 Thread Andrés Delfino

Change by Andrés Delfino :


--
keywords: +patch
pull_requests: +7548
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



[issue33929] test_multiprocessing_spawn: WithProcessesTestProcess.test_many_processes() leaks 5 handles on Windows

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-33966: 
test_multiprocessing_spawn.WithProcessesTestPool.test_traceback() leaks 4 
handles on Windows.

--

___
Python tracker 

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



[issue24567] random.choice IndexError due to double-rounding

2018-06-26 Thread Tim Peters


Tim Peters  added the comment:

Victor, look at Raymond's patch.  In Python 3, `randrange()` and friends 
already use the all-integer `getrandbits()`.  He's changing three other lines, 
where some variant of `int(random() * someinteger)` is being used in an inner 
loop for speed.

Presumably the

return int(random() * n)

line in the `n >= maxsize` branch of `_randbelow_without_getrandbits()` should 
also get clamped.

--

___
Python tracker 

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



[issue33718] Enhance regrtest: meta-ticket for multiple changes

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5430c14aba319f83b18879575244ba429e8c1d81 by Victor Stinner in 
branch '2.7':
[2.7] bpo-33873: Backport regrtest from master (GH-7936)
https://github.com/python/cpython/commit/5430c14aba319f83b18879575244ba429e8c1d81


--

___
Python tracker 

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



[issue33873] False positives when running leak tests with -R 1:1

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5430c14aba319f83b18879575244ba429e8c1d81 by Victor Stinner in 
branch '2.7':
[2.7] bpo-33873: Backport regrtest from master (GH-7936)
https://github.com/python/cpython/commit/5430c14aba319f83b18879575244ba429e8c1d81


--

___
Python tracker 

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



[issue24567] random.choice IndexError due to double-rounding

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:

The error goes avoid if we stop using floating point number to generate random 
integers. Can't we drop/deprecate support of RNG only providing getrandom() but 
not getrandbits()? I'm talking about the master branch.

Things are simpler when you only manipulate integers...

--

___
Python tracker 

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



[issue33873] False positives when running leak tests with -R 1:1

2018-06-26 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +7546

___
Python tracker 

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



[issue33718] Enhance regrtest: meta-ticket for multiple changes

2018-06-26 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +7547

___
Python tracker 

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



[issue33718] Enhance regrtest: meta-ticket for multiple changes

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d1f9481b7a2d31c40fca1347ef99d819eb656ce7 by Victor Stinner in 
branch '3.7':
bpo-33873: Backport regrtest from master to 3.7 (GH-7935)
https://github.com/python/cpython/commit/d1f9481b7a2d31c40fca1347ef99d819eb656ce7


--

___
Python tracker 

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



[issue33873] False positives when running leak tests with -R 1:1

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d1f9481b7a2d31c40fca1347ef99d819eb656ce7 by Victor Stinner in 
branch '3.7':
bpo-33873: Backport regrtest from master to 3.7 (GH-7935)
https://github.com/python/cpython/commit/d1f9481b7a2d31c40fca1347ef99d819eb656ce7


--

___
Python tracker 

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



[issue33718] Enhance regrtest: meta-ticket for multiple changes

2018-06-26 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +7545

___
Python tracker 

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



[issue33873] False positives when running leak tests with -R 1:1

2018-06-26 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +7544

___
Python tracker 

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



[issue33974] _stringify handles quoted strings incorrectly

2018-06-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

How did you find this bug?

--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33466] Distutils does not support the compilation of Objective-C++ (“.mm”) files

2018-06-26 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Eric,

Thanks. 

See the pull request for why this might qualify for a back port: other parts of 
distutils recognise '.mm' as a valid extension, but '.mm' doesn't work yet 
because UnixCCompiler doesn't support this yet. 

On the other hand this is effectively a new feature because '.mm' has never 
worked, and there is an easy workaround (monkey patching the compiler class).

And writing this I agree that this patch should not be back ported.

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



[issue24567] random.choice IndexError due to double-rounding

2018-06-26 Thread Tim Peters


Tim Peters  added the comment:

[Mark]
> If we do this, can we also persuade Guido to Pronounce that
> Python implementations assume IEEE 754 format and semantics
> for floating-point?

On its own, I don't think a change to force 53-bit precision _on_ 754 boxes 
would justify that.  That's just changing oddball boxes that already implement 
754 to do so in the way most other 754 boxes currently do it (and in the way 
all future 754 platforms are expected to do it).

To go beyond that seems to require addressing bigger questions, like:

- _Are_ there currently, or expected to be, non-754 Python platforms?  There 
have been in the past.

- What does "754 semantics" actually mean?  For example, as these bug reports 
point out, 754 is silent about whether the possibility of double rounding - 
even in primitive atomic operations - is "a bug" or "a feature" :-(  Would we 
insist that Python may not work on platforms that flush denorms to 0?  Etc.

- What, concretely, would change in CPython if the Pronouncement were made?  As 
I recall, we inherit most fp behaviors from the platform C compiler and 
libraries.  That is, how would the Pronouncement benefit CPython?  For example, 
do we have significant blobs of code that are trying to cater to non-754 boxes?

Not that I'm asking for answers here.  If there's something to be pursued here, 
I'd suggest it's better as a topic in python-ideas or python-dev.

--

___
Python tracker 

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



[issue33873] False positives when running leak tests with -R 1:1

2018-06-26 Thread STINNER Victor


STINNER Victor  added the comment:

Since I didn't backport yet the commit 4ffe9c2b251f6e027b26250b7a2618e78d4edd22 
(format duration) from master to other branches, I will backport the commit 
58ed7307ea0b5c5aa052291ebc3030f314f938d8 (-R fix) manually to other branches 
with other recent regrtest changes.

--

___
Python tracker 

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



[issue33718] Enhance regrtest: meta-ticket for multiple changes

2018-06-26 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +7543

___
Python tracker 

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



[issue33873] False positives when running leak tests with -R 1:1

2018-06-26 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +7542

___
Python tracker 

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



[issue33873] False positives when running leak tests with -R 1:1

2018-06-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7541

___
Python tracker 

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



[issue33873] False positives when running leak tests with -R 1:1

2018-06-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7540

___
Python tracker 

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



Re: syntax difference

2018-06-26 Thread Mark Lawrence

On 26/06/18 12:39, Chris Angelico wrote:

On Tue, Jun 26, 2018 at 9:30 PM, Bart  wrote:

On 19/06/2018 11:33, Steven D'Aprano wrote:


On Tue, 19 Jun 2018 10:19:15 +0100, Bart wrote:




* Integer sets (Pascal-like sets)

Why do you need them if you have real sets?



I tried Python sets for the first time. They seemed workable but rather
clunky to set up. But here is one problem on my CPython:

x = set(range(10_000_000))

This used up 460MB of RAM (the original 100M I tried exhausted the memory).

The advantage of Pascal-style sets is that that same set will occupy only
1.25MB, as it is a bit-map.

While sets will not usually be that big, there might be lots of small sets
and they all add up.


Cool. Make me a bitset that can represent this Python set:

{-5, -4, 6, 10, 1.5, "spam", print}

ChrisA



Please stop feeding this troll, it's getting very tedious.

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

Mark Lawrence

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


[issue33930] Segfault with deep recursion into object().__dir__

2018-06-26 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

@victor: thanks for confirming my analysis.  

The trashcan API does fix this issue, although I did have to change 
"_PyObject_GC_UNTRACK(m);" to "PyObject_GC_UnTrack(m);" as well. I haven't 
checked yet why that's necessary.

--

___
Python tracker 

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



[issue33973] HTTP request-line parsing splits on Unicode whitespace

2018-06-26 Thread Tim Burke


Change by Tim Burke :


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

___
Python tracker 

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



[issue27777] cgi.FieldStorage can't parse simple body with Content-Length and no Content-Disposition

2018-06-26 Thread Chris Eykamp


Chris Eykamp  added the comment:

I don't know if you've read the dialog on the PR (there was also some offline 
between Ned and myself), but the patch breaks a test when running under a fresh 
build of Python.  I can't reproduce it here without setting up a build system, 
which I haven't had time to do, and won't be able to do at leat through the end 
of next week.

If you can run the tests on a fresh build of Python, and confirm that they 
break, that would be helpful.

--

___
Python tracker 

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



Re: Where's the junk coming from?

2018-06-26 Thread José María Mateos
On Mon, Jun 25, 2018, at 13:37, Mark Lawrence wrote:
> More of the flaming things, this time name@1261/38.remove-ij1-this.  Any 
> ideas as I don't understand this stuff?

I've contacted the list admin about this. It doesn't seem like it's going to go 
away on its own. I just received another batch, for what it's worth.

Cheers,

-- 
José María (Chema) Mateos
https://rinzewind.org/blog-es || https://rinzewind.org/blog-en
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Mark Lawrence
From: Mark Lawrence 

On 25/06/18 17:15, jkn wrote:
> On Monday, June 25, 2018 at 4:23:57 PM UTC+1, Chris Angelico wrote:
>> On Mon, Jun 25, 2018 at 11:15 PM, jkn  wrote:
>>> (as well as pedanticism ;-o).
>>
>> Pedantry.
>>
>> ChrisA
>> (You know I can't let that one pass.)
>
> I was chanel[l]ing the TimBot, as any fule kno...
>

Ritten by a troo Molesworth fann.

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

Mark Lawrence

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Mark Lawrence
From: Mark Lawrence 

On 25/06/18 10:10, Alister via Python-list wrote:
> On Mon, 25 Jun 2018 11:36:25 +0400, Abdur-Rahmaan Janhangeer wrote:
>
>> i think he means like for a loop to iterate over a list you might do
>>
>> list = [1,2,3]
>> for i in range(len(list)):
>>  print(list[i])
>>
>>
>> but the you might as well go for the simpler :
>>
>>
>> for elem in list:
>>
>>   print(elem)
>>
>> Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ
>>
>>
>>
>
> for i in range(len(list)): is a python anti-pattern it is almost a 100%
> guarantee that you are doing something wrong*
>
> *as with all rules of thumb there is probably at least 1 exception that
> the python experts will now point out.
>
>

The exception is that if you really do need the index, you write:-

for i, elem in enumerate(list):

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

Mark Lawrence

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Where's the junk coming from?

2018-06-26 Thread Mark Lawrence
From: Mark Lawrence 

Hi folks,

In the last hour or so I've seen via thunderbird and gmane around 15 emails
from various people where the from field is name@1261/38.remove-r7u-this.  The
part after the @ symbol never changes.  I've seen the contents previously,
apart from one from the RUE.  Users' complete email addresses are given right
at the top.  What
gives?

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

Mark Lawrence

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Anyone here on Python-Dev mailing list?

2018-06-26 Thread Mark Lawrence
From: Mark Lawrence 

On 24/06/18 17:07, Steven D'Aprano wrote:
> Anyone on the Python-Dev mailing list, are you getting private emails
> containing nothing but stream of consciousness word-salad from somebody
> (some bot?) calling himself "Chanel Marvin" with a gmail address?
>
> Typical example:
>
>  "I refuse to create my environment on a computer. Stalls and static
>  and it always looks fake unless I can afford all the cool fast stuff
>  like Prometheus speed but for dummies in plain white english"
>
> in reply to an email I posted to the list.
>
> I don't want to ask there, yet, in case it isn't a bot but some nutter
> with an attitude emailing me privately.
>

I see nothing like this reading python-dev via gmane.  I rarely get anything in
 my private email inboxes about Python.

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

Mark Lawrence

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33973] HTTP request-line parsing splits on Unicode whitespace

2018-06-26 Thread Tim Burke

New submission from Tim Burke :

This causes (admittedly, buggy) clients that would work with a Python 2 server 
to stop working when the server upgrades to Python 3. To demonstrate, run 
`python2.7 -m SimpleHTTPServer 8027` in one terminal and `curl -v 
http://127.0.0.1:8027/你好` in another -- curl reports

*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8027 (#0)
> GET /你好 HTTP/1.1
> Host: 127.0.0.1:8027
> User-Agent: curl/7.54.0
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 404 File not found
< Server: SimpleHTTP/0.6 Python/2.7.10
< Date: Tue, 26 Jun 2018 17:23:25 GMT
< Content-Type: text/html
< Connection: close
<

Error response


Error response
Error code 404.
Message: File not found.
Error code explanation: 404 = Nothing matches the given URI.

* Closing connection 0

...while repeating the experiment with `python3.6 -m http.server 8036` and 
`curl -v http://127.0.0.1:8036/你好` gives

*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8036 (#0)
> GET /你好 HTTP/1.1
> Host: 127.0.0.1:8036
> User-Agent: curl/7.54.0
> Accept: */*
>
http://www.w3.org/TR/html4/strict.dtd;>



Error response


Error response
Error code: 400
Message: Bad request syntax ('GET /ä½\xa0好 HTTP/1.1').
Error code explanation: HTTPStatus.BAD_REQUEST - Bad request 
syntax or unsupported method.


* Connection #0 to host 127.0.0.1 left intact

Granted, a well-behaved client would have quoted the UTF-8 '你好' as 
'%E4%BD%A0%E5%A5%BD' (in which case everything would have behaved as expected), 
but RFC 7230 is pretty clear that the request-line should be SP-delimited. 
While it notes that "recipients MAY instead parse on whitespace-delimited word 
boundaries and, aside from the CRLF terminator, treat any form of whitespace as 
the SP separator", it goes on to say that "such whitespace includes one or more 
of the following octets: SP, HTAB, VT (%x0B), FF (%x0C), or bare CR" with no 
mention of characters like the (ISO-8859-1 encoded) non-breaking space that 
caused the 400 response.

FWIW, there was a similar unicode-separators-are-not-the-right-separators bug 
in header parsing a while back: https://bugs.python.org/issue22233

--
components: Library (Lib), Unicode
messages: 320507
nosy: ezio.melotti, tburke, vstinner
priority: normal
severity: normal
status: open
title: HTTP request-line parsing splits on Unicode whitespace
type: behavior
versions: Python 3.4, Python 3.5, 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



[issue33974] _stringify handles quoted strings incorrectly

2018-06-26 Thread Gauchj


New submission from Gauchj :

_stringify escapes special characters so they can be processed by tcl/tk. To 
that end, two different escaping techniques are implemented: put a backslash in 
front of every special character or put the entire string in curly braces.

However, a string like the following one:

'"C:\\Windows\\System32\\notepad.exe" "afile.txt"'

will be incorrectly escaped to

'"C:WindowsSystem32notepad.exe"\\ "afile.txt"'

Tcl/TK will interpret this as a quoted string, but with a backslash after it 
(the one escaping the space between the quoted strings), throwing this 
exception:
TclError('list element in quotes followed by "\\" instead of space',)

The attached patch escapes this to

'{"C:WindowsSystem32notepad.exe" "afile.txt"}'

I am not 100% sure that this is correct since double backslashes seem to be 
displayed now.

--
components: Tkinter
files: 0001-improve-escaping-of-quoted-strings.patch
keywords: patch
messages: 320508
nosy: gauchj
priority: normal
severity: normal
status: open
title: _stringify handles quoted strings incorrectly
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8
Added file: 
https://bugs.python.org/file47654/0001-improve-escaping-of-quoted-strings.patch

___
Python tracker 

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



Re: syntax difference

2018-06-26 Thread Mark Lawrence
From: Mark Lawrence 

On 24/06/18 00:44, boB Stepp wrote:
> I imagine that the
> transition from version 2 to 3 was not undertaken halfheartedly, but
> only after much thought and discussion since it did break backwards
> compatibility.
>

So much so that a specific mailing list was set up just to discus the
transition, archives here https://mail.python.org/pipermail/python-3000/

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

Mark Lawrence

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: moving to Python from Java/C++/C

2018-06-26 Thread Chris Angelico
From: Chris Angelico 

On Tue, Jun 26, 2018 at 2:35 AM, Dan Stromberg  wrote:
> On Mon, Jun 25, 2018 at 3:40 AM,  wrote:
>
>> Hey,
>> I already have quite an experience in programming, and I wish to study
>> Python as well. I need to study it before I continue with my comp. science
>> academic studies.
>> How do you recommend studying it? As mentioned in the headline, I already
>> know Java, C++ and C.
>>
> I recommend https://wiki.python.org/moin/BeginnersGuide/Programmers
>
> Full disclosure: I wrote the "Intro to Python" slide deck.
>
> And yes, in 2018, you probably should study Python 3, not Python 2.

Yes. I'd upgrade the "probably" to "definitely".

ChrisA

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I'm getting a spamassassin party here

2018-06-26 Thread Vincent Vande Vyvre

Le 26/06/18 à 15:50, Gene Heskett a écrit :

On Tuesday 26 June 2018 02:50:01 Cameron Simpson wrote:


On 24Jun2018 17:03, Gene Heskett  wrote:

Greetings list;

Generally spamassassin only gets picky about this occasionally, but
for the past several hours its working overtime on python list
messages, with the major problem being the servers time stamp, a day
or more in the past. Anyboy ever hear of ntpd?
-- Cheers, Gene Heskett

Could you eyeball some of these problematic messages please?

I've been noticing a swathe of messages in the past few days with
From: headers like this:

   From: "Steven D'Aprano" 

where the From: has been badly mangled, I think by a usenet->list
gateway. The Path: on these messages looks like this (give or take):

   Path:
uni-berlin.de!fu-berlin.de!news.linkpendium.com!news.linkpendium.com!n
ews.snarked.org!news.bbs.nz!.POSTED.184-155-113-241.cpe.cableone.net!no
t-for-mail

I'd be interested to know if there is significant overlap between my
problematic messages and yours.

Cheers,
Cameron Simpson 

Stevens messages are among the most frequent spamassassin triggers. The
scoring diff that tips the scales is the time error:
  1.0 DATE_IN_PAST_12_24 Date: is 12 to 24 hours before Received: date

There is also this:
0.5 APOSTROPHE_FROMFrom address contains an apostrophe

This list commits a whole menu of errors that spamassassin doesn't like.

The whole list from a different message:

Content analysis details:   (5.6 points, 5.1 required)

  pts rule name  description
 -- --
  3.5 BAYES_99   BODY: Bayes spam probability is 99 to 100%
 [score: 1.]
  0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail
 domains are different
  1.0 DATE_IN_PAST_12_24 Date: is 12 to 24 hours before Received: date
  0.2 BAYES_999  BODY: Bayes spam probability is 99.9 to 100%
 [score: 1.]
  0.8 RDNS_NONE  Delivered to internal network by a host with
no rDNS
  0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid

Some of these should be fixable by proper configuration of the
listserver, but don't confuse me with an expert. I am subscribed to the
list.


Same for me since yesterday.

Two examples:

The 2018-05-18 17:20
---
From: "Peter J. Holzer" 


--prnws536gtytpj5v
[ following the message ]

Same day, same hour but arrived today

From: "Peter J. Holzer" 

From: "Peter J. Holzer" 


--prnws536gtytpj5v
[ following the same message ]



Or again:
The 2018-06-23 18:46

From: Steven D'Aprano 

On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote:
[ following the message ]

Same day, same hour but arrived today

From: "Steven D'Aprano" 

From: Steven D'Aprano 

On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote:
[ following the same message ]


I've re-received 22 old duplicated messages like this today.

Vincent
Send Tue, 26 Jun 2018 19:53:46 +0200

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


Re: syntax difference

2018-06-26 Thread Bart
  To: boB Stepp
From: "Bart" 

  To: boB Stepp
From: Bart 

On 24/06/2018 16:37, boB Stepp wrote:
> On Sun, Jun 24, 2018 at 5:21 AM Bart  wrote:

> "... And of course, you would have to know how to use Python properly in
> idiomatic style.

No. I want to program in /my/ style, one more like the pseudo-code that was
mentioned elsewhere, and that is universally understood. Even if people here
don't think much of it.

(eg. https://pastebin.com/0EygJzFR, raw text:https://pastebin.com/raw/0EygJzFR)

   Why not choose this positive approach?  I think it
> would be a win-win for both you and Python."
>
> Just show you genuinely care about the language and the community.
> Use and understand the language as well as you can before jumping into
> criticisms.  Adopt the path of the humble learner, who does not know
> everything about Python.  Is this too much to ask?

Sorry, I tried a few replies but they all got too long and too much about me.
So I'll have to leave it.

I think people know enough about my ideas by now anyway.

--
bart

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue21914] Create unit tests for Turtle guionly

2018-06-26 Thread Lita Cho


Lita Cho  added the comment:

Feel free.

On Tue, Jun 26, 2018, 3:21 AM RAJALAKSHMI V  wrote:

>
> RAJALAKSHMI V  added the comment:
>
> Hey, I am a new contributor here. Could I take this issue up?
>
> --
> nosy: +RAJALAKSHMI V
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



Re: syntax difference

2018-06-26 Thread Bart
  To: Chris Angelico
From: "Bart" 

  To: Chris Angelico
From: Bart 

On 24/06/2018 15:46, Chris Angelico wrote:
> On Sun, Jun 24, 2018 at 8:40 PM, Steven D'Aprano
>  wrote:
>> On Sun, 24 Jun 2018 11:18:37 +0100, Bart wrote:
>>
>>> I wonder why it is just me that constantly needs to justify his
>>> existence in this group?
>>
>> Because its just you who spends 90% of his time here complaining about
>> how Python does it wrong.
>
> ... and spends 95% of that time demonstrating his utter lack of
> understanding of how Python does it at all. It's wrong even though you
> don't understand how it actually works.

More like utter disbelief at how it works. Surely it cannot work like that
because it would be too inefficient? Apparently, yes it can...

And all to support extreme dynamism which is only really needed a tiny
proportion of the time (feel free to correct me).

I know I'm going to get flak for bringing this up this old issue, but remember
when you used to write a for-loop and it involved creating an actual list of N
integers from 0 to N-1 in order to iterate through them? Crazy.

But that has long been fixed - or so I thought. When I wrote, today:

for i in range(1): pass  # 100 million

on Python 2, it used up 1.8GB, up to the limit of my RAM, and it took several
minutes to regain control of my machine (and it never did finish). You don't
expect that in 2018 when executing a simple empty loop.

On Py 2 you have to use xrange for large ranges - that was the fix.

Somebody however must have had to gently and tactfully point out the issue. I'm
 afraid I'm not very tactful.

--
bart

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Rick Johnson
  To: Steven D'Aprano
From: Rick Johnson 

On Monday, June 25, 2018 at 5:56:04 AM UTC-5, Steven D'Aprano wrote:

> Nearly everybody misses the fact that the Zen is a joke,
> not to be taken *too* seriously. A particularly subtle
> joke, but still a joke.

The Python Zen is not merely a joke. But it does outline the philosophy of a
Python programmer in a humorous and self- contradicting manner. So while you
shouldn't read the Zen as some sort of religious law, you shouldn't dismiss it
as a joke either. Like a Monty Python skit, the Zen exposes the hypocrisy of
reality and does so in a humorous way.

> Not satisfied with those two ways, Tim invented his own.
>
> https://bugs.python.org/issue3364

BS! If there is one skill that we pythonista's all share, it is an uncanny
ability to glaze over our obvious mistakes with beautiful, sweet lies.

"A bug???"

"Whaddya mean a bug?"

"That's not a bug!"

"It's a feature!"

"Here, allow me to explain..."

[...snip two hours of monologue...]

Alas!

If only we had followed our _true_ calling and became lawyers.

(at least we would have been forced to dress respectively) ;-)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: syntax difference

2018-06-26 Thread Rick Johnson
  To: Steven D'Aprano
From: "Rick Johnson" 

  To: Steven D'Aprano
From: Rick Johnson 

On Sunday, June 24, 2018 at 10:05:14 AM UTC-5, Steven D'Aprano wrote: [...]
> Be fair. It's more like 50% of the time. Let's not dogpile
> onto Bart. He asked a question, I answered it, we don't all
> need to sink the boot in as well.

And why am i _not_ surprised to learn that Steven defines "community" as
kicking and dogpiling others 50% of the time.

Well, at least it wasn't 100%...

Eh? o_O

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread Stefan Ram
  To: Steven D'Aprano
From: "Stefan Ram" 

  To: Steven D'Aprano
From: r...@zedat.fu-berlin.de (Stefan Ram)

Steven D'Aprano  writes:
>It has been a long, long time since Python has been a "simple" language
>suitable for rank beginners, if it ever was. Python is not Scratch.

  Python is simpler insofar as you can write on a higher level
  than with C. Python has a GC and an intuitive syntax for
  lists, tuples and dictionaries.

  main.c

#include 
int main( void ){ printf( "%d\n", 6 * 6 ); }

  transcript

-694967296

  Above, a beginner has to take care to use Γ╗%dΓ½ and remember
  to change this to Γ╗%gΓ½ when necessary. He also needs to
  understand why the result is negative, and that the result
  is /implementation-dependent/. Surely,

|>>> print( 6 * 6 )
|36

  is easier to read, write, and understand.

  Still, one must not forget that learning Python encompasses
  all the hard work it takes to learn how to program in every
  language.

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Bart
  To: Ben Bacarisse
From: "Bart" 

  To: Ben Bacarisse
From: Bart 

On 24/06/2018 01:53, Ben Bacarisse wrote:
> Bart  writes:

>> Wow. (Just think of all the times you write a function containing a
>> neat bunch of local functions, every time it's called it has to create
>> a new function instances for each of those functions, even if they are
>> not used.)
>
> I am surprised that this surprises you, and equally surprised that you
> seem to think it's going to be in some way grossly inefficient.

Steven D'Aprano's reply suggests there /is/ some inefficiency which is why
[according to him] nested functions are rarely used that way.

--
bartc

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: syntax difference

2018-06-26 Thread Bart
  To: boB Stepp
From: "Bart" 

  To: boB Stepp
From: Bart 

On 24/06/2018 00:44, boB Stepp wrote:
> On Sat, Jun 23, 2018 at 5:35 PM Bart  wrote:

>> I'm not a user...
>
> Then I am truly puzzled, Bart.  Why do you even bother to hang out on
> this list?  If you do not want to use Python and you do not want to
> improve Python's design and implementation, what is your point of
> being here?

I wonder why it is just me that constantly needs to justify his existence in
this group?

Does someone need to be that much of a user of a language in order to discuss
its design or its features or its efficiency, or how it compares with any
other? You can do that from without as well as from within.

Anyway I'm not here that often, I pop in from time to time when something
interesting comes that I feel I can comment about. And yes I sometimes do that
as a diversion because I enjoy this discussing this stuff. Why, is that
allowed?

As for why Python, it's the dynamic language I'm most familiar with, and I've
been following it since the 1990s.

Here's a small selection of threads I've posted in:

  Why not allow empty code blocks

  Python and the need for speed

  Building CPython

  What is a function parameter =[] for

  Considering migrating to Python from Visual Basic...

  How to read from a file to an arbitrary delimiter efficiently

  Python 2.x or 3.x, which is faster?

  The cost of Dynamism

  Case Statements  [15-Mar-2016]

The last is interesting. The OP there follows up with:

  "You have apparently mistaken me for someone who's worried.
  I don't use Python, I was just curious as to why a construct
  that is found, not only to be useful in 95% of other languages,
  but is generally considered more flexible and readable than the
  if-elif, was missing in Python.  (your link 'Switch Statement
  Code Smell' not withstanding)"

Many of the posters are explaining why Python doesn't have it, why they think
the feature is so poor, and ways to get around the lack of it. Mine defend the
feature.

You're saying I shouldn't be allowed to put an alternative point of view
because I don't use Python enough? I would say that because I
/implement/ such features all the time in other languages, that my
opinion is worthwhile.

But people do seem to like to wind me up, and I like to defend my corner, so
posts tend to proliferate.

--
bart.

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: syntax difference

2018-06-26 Thread Gregory Ewing
  To: Bart
From: "Gregory Ewing" 

  To: Bart
From: Gregory Ewing 

Bart wrote:
> But 40 years
> ago it was just 'readln a,b,c'; it was just taken for granted.

The problem with something like that is that it's really only useful for
throwaway code. For any serious application, you need to deal with the
possibility of malformed input, producing helpful diagnostics, etc. And often
the input isn't going to be in such a uniform format that you know exactly what
 to expect next.

So it's debable whether it's a good idea to put something with such limited
applicability into the core language or standard library.

Handling input well is fundamentally much more complicated than producing
output. I don't think this is as "basic" as you make out.

--
Greg

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Gregory Ewing
  To: Bart
From: "Gregory Ewing" 

  To: Bart
From: Gregory Ewing 

Bart wrote:
> Wow. (Just think of all the times you write a function containing a neat
> bunch of local functions, every time it's called it has to create a new
> function instances for each of those functions, even if they are not used.)

Fortunately, function objects are small and cheap, essentially just a couple of
 object references. The overhead of creating one is probably about the same as
creating an empty list. If your function is complicated enough to benefit from
local functions, the cost is going to be swamped by the rest of the work being
done.

--
Greg

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: syntax difference

2018-06-26 Thread Bart
  To: boB Stepp
From: "Bart" 

  To: boB Stepp
From: Bart 

On 23/06/2018 20:52, boB Stepp wrote:
> I've finally found time to examine this rather long, rambling thread.

>> There is a place for various levels of programming language. I'm saying that
Python which is always touted as a 'simple' language suitable for beginners, is
 missing a surprising number of basics.

> I still feel like a rank beginner, but on the Tutor list some
> disagree.

The first programming exercise I ever did involved asking for three numbers,
then determining whether those numbers could form the sides of a triangle.

Then [40 years ago], the easy part was reading the three numbers. Now that
would be the more challenging part.

This is one of the basics that is missing. Getting around it is not hard, but
it's some messing about and it's a distraction. But 40 years ago it was just
'readln a,b,c'; it was just taken for granted.

(It make seem quaint in these days of GUIs, gestures, and voice recognition to
be reading a line at a time, but you will need it still for text file i/o.)

> Anyway, so far Python has not lacked for anything I have needed so
> far.

I'd be surprised if Python lacked anything; there can't be anything that
someone has thought of that is either built-in or bolted on, if not always that
 elegantly or that efficiently.

However, imagine having to use a language which didn't have assignments as you
are used to, and that you would expect to exist. Then you might well remark
that it's missing something that you regard as a basic, while the proponents of
 that language point out that it doesn't stop you writing programs; it just
needs a different approach.

(I believe that you can write any program using just IF-GOTO statements and
ASSIGNMENT statements, and no other flow control (given suitable data-types and
 means of I/O). But if you wanted to try out an interesting experiment along
those lines (eg. transcribe any flowchart to code), a large number of
languages, including Python, make it hard because 'goto' is missing.)

> All I can say is I have yet to find much at all in Python cumbersome
> or bewildering.

No? How many ways are there in Python, including third party add-ons, of
working with record-like objects?

> As an aside to Bart, if you strongly feel that Python is missing a
> really useful feature, then why don't you do the usual thing, start a
> very specific thread about just that feature (Not just a collection of
> things you like in one of your languages.), and if you manage to
> persuade the community of its usefulness, then write up a PEP about
> it?  Just saying ... ~(:>))

I'm not a user. My interest is in design and implementation, especially of
interpreters, and especially of efficient ones. A lot of things that Python
could do with are made very difficult by the existing design of that language.
Being so dynamic has a lot to answer for.

So I don't envy the job of the people who really have to move the language
forward. That doesn't mean I can't argue with people who say that Python
doesn't really need (say) Switch. (I guess the Blub paradox works both ways...)

--
bart

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Ben Bacarisse
  To: Bart
From: "Ben Bacarisse" 

  To: Bart
From: Ben Bacarisse 

Bart  writes:

> On 23/06/2018 23:25, Ben Bacarisse wrote:
>> Bart  writes:
>>
>>> On 23/06/2018 21:13, Chris Angelico wrote:
 On Sat, Jun 23, 2018 at 10:41 PM, Bart  wrote:
>>>
> (At what point would that happen anyway; if you do this:
>>>
 NONE of your examples are taking copies of the function. They all are
 making REFERENCES to the same function. That is all.
>>>
>>> This is about your notion that invocations of the same function via
>>> different references, should maintain their own versions of the
>>> function's 'static' data.
>>>
>>> Since these references are created via the return g statement here:
>>>
>>>  def f():
>>>  def g():
>>>  
>>>  return g
>>>
>>> (say to create function references i and j like this:
>>>
>>>  i = f()
>>>  j = f()
>>> )
>>>
>>> I'm assuming that something special must be happening. Otherwise, how
>>> does f() know which reference it's being called via?
>>>
>>> What is different, what extra bit of information is provided when f()
>>> is invoked via i() or j()?
>>
>> f is not being invoked by either i() or j().  i = f() binds i to the
>> function returned by f.  That's a newly minted function.  In languages
>> like Python, executing def creates a function.
>
> Do you mean that if the same 'def' block is re-executed, it will
> create a different instance of the function? (Same byte-code, but a
> different set of everything else the function uses.)

Logically, yes.

> Wow. (Just think of all the times you write a function containing a
> neat bunch of local functions, every time it's called it has to create
> a new function instances for each of those functions, even if they are
> not used.)

I am surprised that this surprises you, and equally surprised that you seem to
think it's going to be in some way grossly inefficient.

--
Ben.

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Ben Bacarisse
  To: Bart
From: "Ben Bacarisse" 

  To: Bart
From: Ben Bacarisse 

Bart  writes:

> On 23/06/2018 21:13, Chris Angelico wrote:
>> On Sat, Jun 23, 2018 at 10:41 PM, Bart  wrote:
>
>>> (At what point would that happen anyway; if you do this:
>
>> NONE of your examples are taking copies of the function. They all are
>> making REFERENCES to the same function. That is all.
>
> This is about your notion that invocations of the same function via
> different references, should maintain their own versions of the
> function's 'static' data.
>
> Since these references are created via the return g statement here:
>
> def f():
> def g():
> 
> return g
>
> (say to create function references i and j like this:
>
> i = f()
> j = f()
> )
>
> I'm assuming that something special must be happening. Otherwise, how
> does f() know which reference it's being called via?
>
> What is different, what extra bit of information is provided when f()
> is invoked via i() or j()?

f is not being invoked by either i() or j().  i = f() binds i to the function
returned by f.  That's a newly minted function.  In languages like Python,
executing def creates a function.  In your example, i and j refer to different
functions.  If the function temporarily named g has "own" variables ("static"
in C), then each such function should have its own.  That was the point of the
example much further up.

The effect can simulated like this:

def make_counter():
def c():
c.x += 1
return c.x
c.x = 0
return c

i = make_counter()
j = make_counter()

print(i(), i(), j(), i())


--
Ben.

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Bart
  To: Ben Bacarisse
From: "Bart" 

  To: Ben Bacarisse
From: Bart 

On 23/06/2018 23:25, Ben Bacarisse wrote:
> Bart  writes:
>
>> On 23/06/2018 21:13, Chris Angelico wrote:
>>> On Sat, Jun 23, 2018 at 10:41 PM, Bart  wrote:
>>
 (At what point would that happen anyway; if you do this:
>>
>>> NONE of your examples are taking copies of the function. They all are
>>> making REFERENCES to the same function. That is all.
>>
>> This is about your notion that invocations of the same function via
>> different references, should maintain their own versions of the
>> function's 'static' data.
>>
>> Since these references are created via the return g statement here:
>>
>>  def f():
>>  def g():
>>  
>>  return g
>>
>> (say to create function references i and j like this:
>>
>>  i = f()
>>  j = f()
>> )
>>
>> I'm assuming that something special must be happening. Otherwise, how
>> does f() know which reference it's being called via?
>>
>> What is different, what extra bit of information is provided when f()
>> is invoked via i() or j()?
>
> f is not being invoked by either i() or j().  i = f() binds i to the
> function returned by f.  That's a newly minted function.  In languages
> like Python, executing def creates a function.

Do you mean that if the same 'def' block is re-executed, it will create a
different instance of the function? (Same byte-code, but a different set of
everything else the function uses.)

Wow. (Just think of all the times you write a function containing a neat bunch
of local functions, every time it's called it has to create a new function
instances for each of those functions, even if they are not used.)

Anyway just for regular statics, the following appears to work. Not ideal, but
simpler than some alternatives:

def f():
 if not hasattr(f,'x'): f.x=0
 f.x += 1
 return f.x

--
bart.

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Static variables [was Re: syntax difference]

2018-06-26 Thread Bart
  To: Chris Angelico
From: "Bart" 

  To: Chris Angelico
From: Bart 

On 23/06/2018 21:13, Chris Angelico wrote:
> On Sat, Jun 23, 2018 at 10:41 PM, Bart  wrote:

>> (At what point would that happen anyway; if you do this:

> NONE of your examples are taking copies of the function. They all are
> making REFERENCES to the same function. That is all.

This is about your notion that invocations of the same function via different
references, should maintain their own versions of the function's 'static' data.

Since these references are created via the return g statement here:

 def f():
 def g():
 
 return g

(say to create function references i and j like this:

 i = f()
 j = f()
)

I'm assuming that something special must be happening. Otherwise, how does f()
know which reference it's being called via?

What is different, what extra bit of information is provided when f() is
invoked via i() or j()?

--
bart

-+- BBBS/Li6 v4.10 Toy-3
 + Origin: Prism bbs (1:261/38)

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: moving to Python from Java/C++/C

2018-06-26 Thread Dan Stromberg
From: Dan Stromberg 

On Mon, Jun 25, 2018 at 3:40 AM,  wrote:

> Hey,
> I already have quite an experience in programming, and I wish to study
> Python as well. I need to study it before I continue with my comp. science
> academic studies.
> How do you recommend studying it? As mentioned in the headline, I already
> know Java, C++ and C.
>
I recommend https://wiki.python.org/moin/BeginnersGuide/Programmers

Full disclosure: I wrote the "Intro to Python" slide deck.

And yes, in 2018, you probably should study Python 3, not Python 2.

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python for beginners or not? [was Re: syntax difference]

2018-06-26 Thread jkn
  To: Chris Angelico
From: jkn 

On Monday, June 25, 2018 at 4:23:57 PM UTC+1, Chris Angelico wrote:
> On Mon, Jun 25, 2018 at 11:15 PM, jkn  wrote:
> > (as well as pedanticism ;-o).
>
> Pedantry.
>
> ChrisA
> (You know I can't let that one pass.)

I was chanel[l]ing the TimBot, as any fule kno...

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   3   >