[issue28556] typing.py upgrades

2018-05-17 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi :


--
pull_requests: +6624

___
Python tracker 

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



[issue33522] Enable CI builds on Visual Studio Team Services

2018-05-17 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

Your PRs made modifications to code and did not include a useful commit message 
or appropriate NEWS entries for the code modifications.

Further, VSTS is unreliable.  core-workflow made a premature decision to turn 
off Travis and AppVeyor and make VSTS blocking.

--
nosy: +gregory.p.smith
resolution: fixed -> 
stage: resolved -> 

___
Python tracker 

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



[issue33519] Should MutableSequence provide .copy()?

2018-05-17 Thread Jelle Zijlstra

Change by Jelle Zijlstra :


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

___
Python tracker 

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



Re: what does := means simply?

2018-05-17 Thread Ben Finney
Steven D'Aprano  writes:

> If you want to *really* see code that is hard to port, you should try
> porting an Inform 7 program to another language. Any other language.

Does porting Inform 7 code to Inform 6 count? They are very different
languages :-)

-- 
 \  “Puritanism: The haunting fear that someone, somewhere, may be |
  `\ happy.” —Henry L. Mencken |
_o__)  |
Ben Finney

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


[issue33564] IDLE: add 'async' to codecontext block openers

2018-05-17 Thread Terry J. Reedy

Change by Terry J. Reedy :


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

___
Python tracker 

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



Re: what does := means simply?

2018-05-17 Thread Ian Kelly
On Thu, May 17, 2018, 7:50 PM Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:

>
> If you want to *really* see code that is hard to port, you should try
> porting an Inform 7 program to another language. Any other language.
>

How about Z-code?

*ducks*

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


[issue33565] strange tracemalloc results

2018-05-17 Thread Alexander Mohr

Change by Alexander Mohr :


--
type:  -> behavior

___
Python tracker 

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



[issue33565] strange tracemalloc results

2018-05-17 Thread Alexander Mohr

New submission from Alexander Mohr :

while investigating https://github.com/boto/botocore/issues/1464 I used 
tracemalloc (like I've done before in 3.5.2) to try to figure out where the 
leak was.  To my surprise tracemalloc listed stacks that didn't make any sense.


Strangest example is the top result when running the attached script against 
python 3.6.5 in the following manner: PYTHONMALLOC=malloc /valgrind/bin/python3 
/tmp/test.py head_object

The top hit is listed as:

21 memory blocks: 4.7 KiB
  File "/tmp/test.py", line 28
raise
  File "/tmp/test.py", line 47
test(s3_client)
  File "/tmp/test.py", line 65
main()

how is it that the "raise" is a leak?  It doesn't make any sense to me 
specially given that no contexts are used in that call.  Further that line is 
never hit because the exception is not re-thrown.


Further a bunch of regular expression allocs don't make any sense either given 
that I've cleared the cache before doing snapshots.

if someone could shed some light on why this is/isn't a bug that would be 
great.  It seems to me that the callstacks are not related at all to the leak.

--
components: Library (Lib)
files: tracemalloc_test.py
messages: 317002
nosy: thehesiod
priority: normal
severity: normal
status: open
title: strange tracemalloc results
versions: Python 3.6
Added file: https://bugs.python.org/file47600/tracemalloc_test.py

___
Python tracker 

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



[issue33556] leftover thread crumb in threading.ident docstring

2018-05-17 Thread Skip Montanaro

Change by Skip Montanaro :


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



Re: why does list's .remove() does not return an object?

2018-05-17 Thread Abdur-Rahmaan Janhangeer
ah there's no return question then

that precisely returned the discussion to the first answer

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

On Thu, 17 May 2018, 23:35 Tobiah,  wrote:

> On 05/17/2018 09:25 AM, Ned Batchelder wrote:
> > On 5/17/18 11:57 AM, Abdur-Rahmaan Janhangeer wrote:
> >> x = [0,1]
> >> x.remove(0)
> >> new_list = x
>
> Just call the original list 'new_list' to begin with.
>
>new_list = [0, 1]
>new_list.remove(0)
>
>
> There you are!
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33564] IDLE: add 'async' to codecontext block openers

2018-05-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:


New changeset b2a02b9d88db04c12f800bc088afea0ef6862673 by Terry Jan Reedy (Miss 
Islington (bot)) in branch '3.7':
bpo-33564: Add async to IDLE's code context block openers. (GH-6960) (#6961)
https://github.com/python/cpython/commit/b2a02b9d88db04c12f800bc088afea0ef6862673


--

___
Python tracker 

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



[issue33547] Relative imports do not replace local variables

2018-05-17 Thread Rolf Campbell

Rolf Campbell  added the comment:

Thanks David, I agree that my assumption that the local valiables were not 
being replaced is not really what was going on there.

I also agree that, while this might not strictly classify as a bug, it's 
probably not the most helpful/useful way that "from ." could be implemented for 
__main__. Why does it act different than in modules?

I have reproduced my original ploblem in a simplified scenario, for which I 
will raise a new bug.

Thanks

--

___
Python tracker 

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



Re: what does := means simply?

2018-05-17 Thread Steven D'Aprano
On Fri, 18 May 2018 02:17:39 +0100, bartc wrote:

> Normally you'd use the source code as a start point. In the case of
> Python, that means Python source code. But you will quickly run into
> problems because you will often see 'import lib' and be unable to find
> lib.py anywhere.

Seriously? There's a finite number of file extensions to look for:

.py .pyc .pyo .pyw .dll .so

pretty much is the lot, except on some obscure platforms which few people 
use.

To successful port anything but the most trivial code, you actually have 
to understand *both* languages -- including the syntax, semantics, built-
in language features, AND libraries.


> That's one problem. Others might involve how to deal with something like
> __globals__ which doesn't have an equivalent in the target language. And
> we haven't started on features that are specific to Python.

How about features which are specific to C, or Scheme, or Forth, or APL, 
or bash, or Fortran, or Intercal, or Java, or Javascript, or Ruby, or 
Smalltalk, or Rust, or Go, or any of hundreds of other languages?

Since every language has features that some other languages don't have, 
is it your position that it is impossible to port code from any language 
to any other?

If you want to *really* see code that is hard to port, you should try 
porting an Inform 7 program to another language. Any other language.



-- 
Steve

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


[issue33531] test_asyncio: test_subprocess test_stdin_broken_pipe() failure on Travis CI

2018-05-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The Travis retest (for 3.7 backport) just failed with the same errors.  Why 
can't we disable this tests.  It now takes hours to do a merge with two 
backports.

--

___
Python tracker 

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



[issue33564] IDLE: add 'async' to codecontext block openers

2018-05-17 Thread miss-islington

miss-islington  added the comment:


New changeset eb4590e4d9abecdbbc91c3531df83e1f9bed50f1 by Miss Islington (bot) 
in branch '3.6':
bpo-33564: Add async to IDLE's code context block openers. (GH-6960)
https://github.com/python/cpython/commit/eb4590e4d9abecdbbc91c3531df83e1f9bed50f1


--
nosy: +miss-islington

___
Python tracker 

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



[issue28418] Raise Deprecation warning for tokenize.generate_tokens

2018-05-17 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Thanks Thomas.  I've been a long term user of tokenize.generate_tokens() and 
would be sad to see it go.  

The underlying _tokenize() functionality is used else within the module, so 
there the no benefit to removing the API.

--
nosy: +rhettinger

___
Python tracker 

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



Re: what does := means simply?

2018-05-17 Thread bartc

On 17/05/2018 18:19, Steven D'Aprano wrote:

On Thu, 17 May 2018 15:50:17 +0100, bartc wrote:



Of course, full-on Python code is pretty much impossible to port
anywhere else anyway.


*rolls eyes*



Any pair of languages will have code that is hard to port from one to the
other without jumping through hoops. Try porting C code with lots of
dynamic memory allocations and pointer accesses to COBOL, or Scheme code
using continuations to Python, or Hyperscript text chunking code to
Fortran.

But hard does not mean "pretty much impossible".



Normally you'd use the source code as a start point. In the case of 
Python, that means Python source code. But you will quickly run into 
problems because you will often see 'import lib' and be unable to find 
lib.py anywhere.


That's one problem. Others might involve how to deal with something like 
__globals__ which doesn't have an equivalent in the target language. And 
we haven't started on features that are specific to Python.


But most non-esoteric languages will have functions, variables, 
assignments, expressions, loops and so on. The basics. Algorithms 
expressed using those will be simplest to port.


When I was looking at benchmarks involving multiple languages and wanted 
to port one to a new language, I usually ended up working from Pascal or 
Lua because they tended not to use advanced features that made the job 
harder.


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


[issue22552] ctypes.CDLL returns singleton objects, resulting in usage conflicts

2018-05-17 Thread Ivan Pozdeev

Change by Ivan Pozdeev :


--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue31645] openssl build fails in win32 if .pl extension is not associated with Perl

2018-05-17 Thread Ivan Pozdeev

Change by Ivan Pozdeev :


--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue33531] test_asyncio: test_subprocess test_stdin_broken_pipe() failure on Travis CI

2018-05-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I just got the two broken pipe error on Travis.

--

___
Python tracker 

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



[issue33531] test_asyncio: test_subprocess test_stdin_broken_pipe() failure on Travis CI

2018-05-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I have also gotten test_async errors on AppVeyor and MSTS Windows.

ERROR: test__sock_sendfile_native_failure 
(test.test_asyncio.test_base_events.BaseLoopSockSendfileTests)
--
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1881, in test__sock_sendfile_native_failure
sock, proto = self.prepare()
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1866, in prepare
self.run_loop(self.loop.sock_connect(sock, (support.HOST, port)))
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1846, in run_loop
return self.loop.run_until_complete(coro)
  File "C:\projects\cpython\lib\asyncio\base_events.py", line 566, in 
run_until_complete
return future.result()
  File "C:\projects\cpython\lib\asyncio\selector_events.py", line 475, in 
sock_connect
return await fut
  File "C:\projects\cpython\lib\asyncio\selector_events.py", line 505, in 
_sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 10061] Connect call failed ('127.0.0.1', 6284)
==
ERROR: test_sock_sendfile_fallback 
(test.test_asyncio.test_base_events.BaseLoopSockSendfileTests)
--
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1903, in test_sock_sendfile_fallback
sock, proto = self.prepare()
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1866, in prepare
self.run_loop(self.loop.sock_connect(sock, (support.HOST, port)))
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1846, in run_loop
return self.loop.run_until_complete(coro)
  File "C:\projects\cpython\lib\asyncio\base_events.py", line 566, in 
run_until_complete
return future.result()
  File "C:\projects\cpython\lib\asyncio\selector_events.py", line 475, in 
sock_connect
return await fut
  File "C:\projects\cpython\lib\asyncio\selector_events.py", line 505, in 
_sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 10061] Connect call failed ('127.0.0.1', 6303)
==
ERROR: test_sock_sendfile_fallback_offset_and_count 
(test.test_asyncio.test_base_events.BaseLoopSockSendfileTests)
--
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1914, in test_sock_sendfile_fallback_offset_and_count
sock, proto = self.prepare()
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1866, in prepare
self.run_loop(self.loop.sock_connect(sock, (support.HOST, port)))
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1846, in run_loop
return self.loop.run_until_complete(coro)
  File "C:\projects\cpython\lib\asyncio\base_events.py", line 566, in 
run_until_complete
return future.result()
  File "C:\projects\cpython\lib\asyncio\selector_events.py", line 475, in 
sock_connect
return await fut
  File "C:\projects\cpython\lib\asyncio\selector_events.py", line 505, in 
_sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 10061] Connect call failed ('127.0.0.1', 6308)
==
ERROR: test_sock_sendfile_no_fallback 
(test.test_asyncio.test_base_events.BaseLoopSockSendfileTests)
--
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1892, in test_sock_sendfile_no_fallback
sock, proto = self.prepare()
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1866, in prepare
self.run_loop(self.loop.sock_connect(sock, (support.HOST, port)))
  File "C:\projects\cpython\lib\test\test_asyncio\test_base_events.py", line 
1846, in run_loop
return self.loop.run_until_complete(coro)
  File "C:\projects\cpython\lib\asyncio\base_events.py", line 566, in 
run_until_complete
return future.result()
  File "C:\projects\cpython\lib\asyncio\selector_events.py", line 475, in 
sock_connect
return await fut
  File "C:\projects\cpython\lib\asyncio\selector_events.py", line 505, in 
_sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 10061] Connect call failed ('127.0.0.1', 6338)
--
Ran 1729 tests in 89.932s

Before that, for Brett
test_popen 

[issue33554] Optimize PyDictObject

2018-05-17 Thread INADA Naoki

INADA Naoki  added the comment:

> A little performance optimization, but I think the key is not in
performance optimization.
> The semantics of the dictresize function are not uniform, and it is
inconvenient for others to read. The dictresize function should be split to
make it just resize. What do you think?

I can't understand.
What dictresize does now other than resize?
Could you show how dictresize can be simplified when clear_dummy_keys() is
added?

Anyway, current my opinion is -1 on this.
We can add similar function when fixing Issue31954.

--

___
Python tracker 

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



Re: syntax oddities

2018-05-17 Thread Steven D'Aprano
On Fri, 18 May 2018 08:38:31 +1000, Chris Angelico wrote:

> On Fri, May 18, 2018 at 8:31 AM, Dennis Lee Bieber
>  wrote:
>> On Thu, 17 May 2018 07:18:32 -0700, Tobiah  declaimed
>> the following:
>>
>>>Top posting is awesome for the reader plowing through a thread in
>>>order.  In that case the cruft at the bottom is only for occasional
>>>reference.
>>>
>>>
>> That concept is meaningful only email between two parties,
>> where the
>> quoted material is a "courtesy copy" for content the other party likely
>> provided a week earlier (snail mail).
> 
> And I'm not sure it's of value there either. If I emailed someone a week
> ago and s/he responds today, proper quote trimming is of great value,
> just as it is with newsgroups/mailing lists. The only time it wouldn't
> much matter is if we're going back and forth with extreme rapidity, and
> then you may as well bottom-post because it makes little difference.

Bottom-posting is infinitely more evil than top-posting.

The next time I have to scroll past fifteen pages of quoted text twelve 
layers deep, only to read "Me too!!!1!" or "LOL!!!" as the sole addition 
to the conversation, I'm going to go all Jack Nicholson in The Shining.

What we want is *inline* posting, which follows the *trimmed* posting. If 
there happens to be only a single quoted section left untrimmed (as in 
this email) it may superficially look like bottom-posting, but it isn't.

Top-posting is good for real-time rapid-fire conversations between two 
parties where the context is self-evident and you will never, ever need 
to look through the archives again.

But bottom-posting without trimming combines the worst of both strategies.


-- 
Steve

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


[issue33564] IDLE: add 'async' to codecontext block openers

2018-05-17 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6621

___
Python tracker 

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



[issue33564] IDLE: add 'async' to codecontext block openers

2018-05-17 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6620

___
Python tracker 

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



[issue33564] IDLE: add 'async' to codecontext block openers

2018-05-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:


New changeset d89ca94847d943b883ebcc68e4f0a18cb042ed0d by Terry Jan Reedy in 
branch 'master':
bpo-33564: Add async to IDLE's code context block openers. (GH-6960)
https://github.com/python/cpython/commit/d89ca94847d943b883ebcc68e4f0a18cb042ed0d


--

___
Python tracker 

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



[issue33564] IDLE: add 'async' to codecontext block openers

2018-05-17 Thread Terry J. Reedy

Change by Terry J. Reedy :


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



[issue32831] IDLE: Add docstrings and tests for codecontext

2018-05-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Because BLOCKOPENERS is sufficiently distant from the changes for this issue, I 
will add 'async' now, without tests, in #33564.

Some of my comments for this issue are ideas for future changes in 
codecontext.py.

--

___
Python tracker 

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



Re: object types, mutable or not?

2018-05-17 Thread Mike McClain
On Thu, May 17, 2018 at 07:28:44PM +1000, Chris Angelico wrote:
> On Thu, May 17, 2018 at 7:16 PM, Anders Wegge Keller  wrote:
> > P?? Wed, 16 May 2018 14:48:27 +0100
> > Paul Moore  skrev:
> >
> >> C++ called that an "rvalue". And then went on to define things that
> >> could go on the left hand side of an assignment as "lvalues". And now
> >> we have two confusing concepts to explain - see what happens when you
> >> let a standards committee define your language? :-)
> >
> >  I'm not sure the C++ committee has to bear the responsibility for those
> > terms. They are pretty well defined in the C world, so I think you need to
> > point the finger of accusation at either Brian or Dennis.
> >
>
> Let's be fair and blame one of them for each.
>

Let's be fair and make that accolades.
We stand on their shoulders.

I like telling a computer what to do.
Don't you?

Enjoy,
Mike
--
Once you can accept the universe as matter expanding into nothing
that is something, wearing stripes with plaid comes easy.
- Albert Einstein
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33564] IDLE: add 'async' to codecontext block openers

2018-05-17 Thread Terry J. Reedy

New submission from Terry J. Reedy :

I am just going to add 'async' to BLOCKOPENERS.  I don't think this needs a 
particular test, as most of the openers are not used in the new tests added by 
#32831.  We could eventually expand the sample to have one of each opener.

--
assignee: terry.reedy
components: IDLE
messages: 316991
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE: add 'async' to codecontext block openers
type: enhancement
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



[issue33355] Windows 10 buildbot: 15 min timeout on test_mmap.test_large_filesize()

2018-05-17 Thread Paul Goins

Paul Goins  added the comment:

I don't know enough about those tests and how important they are considered.  
My only concern would be with the increased risk of undetected breakage caused 
by removing them from CI, but if people think the risk is negligible and/or 
acceptable, it's fine by me.

Anything to change in git, or is this purely build agent stuff at this point?

--

___
Python tracker 

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



Re: syntax oddities

2018-05-17 Thread Chris Angelico
On Fri, May 18, 2018 at 8:44 AM, Paul  wrote:
>>
>>
>> That concept is meaningful only email between two parties, where
>> the
>> quoted material is a "courtesy copy" for content the other party likely
>> provided a week earlier (snail mail).
>>
>> But mailing lists/newsgroups are the equivalent of a bulletin board
>> open to anyone walking past. Bottom posting (or better, trim and
>> intersperse) allows someone who has no prior knowledge of the message chain
>> to read it from top-down, picking up the relevant points as they go...
>> Rather than having to flip through a stack of pages looking for information
>> being referenced by the top-most sheet of paper.
>>
>>
>> --
>> Wulfraed Dennis Lee Bieber
>
>
> I've been using email for thirty years, including thousands of group emails
> at many tech companies, and no one has ever suggested, let alone insisted
> on, bottom posting.  If someone's late to a thread they can read from it
> the bottom up.

Remind me which direction text is usually written in English?

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


Re: syntax oddities

2018-05-17 Thread Paul
>
>
> That concept is meaningful only email between two parties, where
> the
> quoted material is a "courtesy copy" for content the other party likely
> provided a week earlier (snail mail).
>
> But mailing lists/newsgroups are the equivalent of a bulletin board
> open to anyone walking past. Bottom posting (or better, trim and
> intersperse) allows someone who has no prior knowledge of the message chain
> to read it from top-down, picking up the relevant points as they go...
> Rather than having to flip through a stack of pages looking for information
> being referenced by the top-most sheet of paper.
>
>
> --
> Wulfraed Dennis Lee Bieber


I've been using email for thirty years, including thousands of group emails
at many tech companies, and no one has ever suggested, let alone insisted
on, bottom posting.  If someone's late to a thread they can read from it
the bottom up. But, for everyone who has been  keeping up, not having to
scroll is a big advantage.
   I'm not suggesting that the convention on this list be changed, but it's
by no means the only option which makes sense.
  Paul C.

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


Re: syntax oddities

2018-05-17 Thread Chris Angelico
On Fri, May 18, 2018 at 8:31 AM, Dennis Lee Bieber
 wrote:
> On Thu, 17 May 2018 07:18:32 -0700, Tobiah  declaimed the
> following:
>
>>Top posting is awesome for the reader plowing through
>>a thread in order.  In that case the cruft at the bottom
>>is only for occasional reference.
>>
>
> That concept is meaningful only email between two parties, where the
> quoted material is a "courtesy copy" for content the other party likely
> provided a week earlier (snail mail).

And I'm not sure it's of value there either. If I emailed someone a
week ago and s/he responds today, proper quote trimming is of great
value, just as it is with newsgroups/mailing lists. The only time it
wouldn't much matter is if we're going back and forth with extreme
rapidity, and then you may as well bottom-post because it makes little
difference.

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


[issue33459] Fix "tuple display" mention in Expressions

2018-05-17 Thread Andrés Delfino

Andrés Delfino  added the comment:

I'm restoring the original title since we are not sure it was incorrect after 
all.

I have also updated the PR to remove the tuple display entry from the index.

--
title: Define "tuple display" in the docs -> Fix "tuple display" mention in 
Expressions
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



[issue33563] fileinput input's and Fileinput's bufsize=0 do not remit deprecationWarnings

2018-05-17 Thread Matthias Bussonnier

New submission from Matthias Bussonnier :

In Lib/fileinput.py, passing bufsize=0 does not raise any DeprecationWarning.

Also when using `input` the stacklevel could be better as it passes bufsize 
directly for FileInput.

in Lib/test/test_fileinput.py ; MockFileInput does not reflect the changes of 
FileInput. Presumably MockFielInput was made to make sure that `input` was 
passing the parameters as is and should be update accordingly.

--
messages: 316988
nosy: mbussonn
priority: normal
severity: normal
status: open
title: fileinput input's and Fileinput's bufsize=0 do not remit 
deprecationWarnings

___
Python tracker 

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



[issue33563] fileinput input's and Fileinput's bufsize=0 do not remit deprecationWarnings

2018-05-17 Thread Matthias Bussonnier

Change by Matthias Bussonnier :


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

___
Python tracker 

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



file download using django and javascript

2018-05-17 Thread Xristos Xristoou


i have create a django app with REST JSON API and i fill html table in web page 
from my JSON.

here some examples

javascript snippets :

var field22=document.getElementById('f22');
field22.innerHTML=e.target.feature.properties.id;

var field23=document.getElementById('f23');
field23.innerHTML=e.target.feature.properties.file_1;

html :

 

  
  id :
  
   
   file :
  
   

i have parse my JSON in table with success but in the file field now i have a 
simple text from image path.

Now i want in this path to have some hyperlink(or button) for download this 
file.

any idea how to do this because i stack ?i dont know how to connection 
javasscript with my download or how to download this file using javascript

django app code

models.py:

class MyModel(models.Model):
file_1 = models.FileField(upload_to='documents/',blank=True, null=True)

simple test django donwload :

def download(request, id):
product_file=MyModel.objects.get(pk=id)
f = StringIO()
zip = zipfile.ZipFile(f, 'w')
product_file_url = product_file.file_1.url
file_url = settings.MEDIA_ROOT + product_file_url[6:]
filename = product_file_url[6:].split('/')[-1]
zip.write(file_url,filename)
zip.close()
response = HttpResponse(f.getvalue(), content_type="application/zip")
response['Content-Disposition'] = 'attachment; filename=file-download.zip'
return response

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


Aw: Re: why does list's .remove() does not return an object?

2018-05-17 Thread Karsten Hilbert
>new_list = list(x.remove(0))
>new_list = x.remove(0)[:]

Please disregard :)

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


Re: Re: why does list's .remove() does not return an object?

2018-05-17 Thread Ian Kelly
On Thu, May 17, 2018 at 3:27 PM, Karsten Hilbert
 wrote:
>> On 5/17/18 11:57 AM, Abdur-Rahmaan Janhangeer wrote:
>> > x = [0,1]
>> > x.remove(0)
>> > new_list = x
>> >
>> > instead i want in one go
>> >
>> > x = [0,1]
>> > new_list = x.remove(0) # here a way for it to return the modified list by
>> > adding a .return() maybe ?
>>
>> There isn't a way to do that in one line.
>
>new_list = list(x.remove(0))
>new_list = x.remove(0)[:]
>
> ?
>
> No one said x can't be modified, only that new_list is
> to contain the modified list after one line of code :)

Did you actually run either of those?
-- 
https://mail.python.org/mailman/listinfo/python-list


Aw: Re: why does list's .remove() does not return an object?

2018-05-17 Thread Karsten Hilbert
> On 5/17/18 11:57 AM, Abdur-Rahmaan Janhangeer wrote:
> > x = [0,1]
> > x.remove(0)
> > new_list = x
> >
> > instead i want in one go
> >
> > x = [0,1]
> > new_list = x.remove(0) # here a way for it to return the modified list by
> > adding a .return() maybe ?
> 
> There isn't a way to do that in one line.

   new_list = list(x.remove(0))
   new_list = x.remove(0)[:]

?

No one said x can't be modified, only that new_list is
to contain the modified list after one line of code :)

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


[issue32831] IDLE: Add docstrings and tests for codecontext

2018-05-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

After this is merged, we should immediately add 'async' to the list of block 
openers.

With complete tests, we can more confidently cleanup the code a bit, as well as 
change behavior.  The fourth field of info tuples, block keyword, is never used 
as part of info tuples.  (It is used before being added in get_context.)

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



[issue33562] Check that the global settings for asyncio are not changed by tests

2018-05-17 Thread Brett Cannon

Change by Brett Cannon :


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

___
Python tracker 

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



[issue33355] Windows 10 buildbot: 15 min timeout on test_mmap.test_large_filesize()

2018-05-17 Thread David Bolen

David Bolen  added the comment:

A longer timeout might be another workaround, but for myself, I tend to favor 
Zachary's original suggestion of eliminating largefile tests for the moment as 
simplest and most robust.  It would also reduce the overall percentage of test 
time currently spent on a small number of tests.

Time (and budget) permitting, I do hope to try some tests on newer Azure 
machine types to see if they behave differently, which might be a longer term 
option.

--

___
Python tracker 

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



[issue33562] Check that the global settings for asyncio are not changed by tests

2018-05-17 Thread Brett Cannon

New submission from Brett Cannon :

There were not checks in test.libregrtest.save_env to make sure tests were not 
mucking with the default event loop. The settings to check seem to be:

'asyncio.get_event_loop_policy', 'asyncio.get_event_loop',
'asyncio_get_exception_handler', 'asyncio_get_debug',
'asyncio_get_child_watcher',

I have a PR that I'm working on that checks these things and it looks like the 
following tests are being a little sloppy:

test_asyncgen
test_contextlib_async
test_coroutines
test_socket
test_sys_settrace

And test_asyncio never seems to complete.

--
components: Tests
messages: 316985
nosy: asvetlov, brett.cannon, giampaolo.rodola, yselivanov
priority: normal
severity: normal
status: open
title: Check that the global settings for asyncio are not changed by tests
type: behavior
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



[issue28418] Raise Deprecation warning for tokenize.generate_tokens

2018-05-17 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

I've opened a PR moving in the other direction (making this public rather than 
deprecating it):

https://github.com/python/cpython/pull/6957

--
nosy: +takluyver

___
Python tracker 

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



[issue9969] tokenize: add support for tokenizing 'str' objects

2018-05-17 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

I've opened a PR for issue #12486, which would make the existing but 
undocumented 'generate_tokens' function public:

https://github.com/python/cpython/pull/6957

I agree that it would be good to design a nicer API for this, but the perfect 
shouldn't be the enemy of the good.

--

___
Python tracker 

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



[issue12486] tokenize module should have a unicode API

2018-05-17 Thread Thomas Kluyver

Change by Thomas Kluyver :


--
pull_requests: +6616

___
Python tracker 

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



[issue12486] tokenize module should have a unicode API

2018-05-17 Thread Matthias Bussonnier

Matthias Bussonnier  added the comment:

> Why not just bless the existing generate_tokens() function as a public API, 

Yes please, or just make the private `_tokenize` public under another name. The 
`tokenize.tokenize` method try to magically detect encoding which may be 
unnecessary.

--
nosy: +mbussonn

___
Python tracker 

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



[issue33559] Exception's repr change not documented

2018-05-17 Thread miss-islington

miss-islington  added the comment:


New changeset efa642779739b5af028b0f6ebb9033395e124273 by Miss Islington (bot) 
in branch '3.7':
bpo-33559: Attribute changed repr of exceptions (GH-6954)
https://github.com/python/cpython/commit/efa642779739b5af028b0f6ebb9033395e124273


--
nosy: +miss-islington

___
Python tracker 

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



[issue25478] Consider adding a normalize() method to collections.Counter()

2018-05-17 Thread Vedran Čačić

Vedran Čačić  added the comment:

As I said above, if we're going to go down that route, it seems much more 
reasonable to me that total should be a cached property, that's updated on 
every Counter update (in __setitem__, increased by a difference of a new value 
and an old one for that key).

And normalization should just provide a view over the Counter, that just passes 
the values through division with the above cached property. The view should of 
course be immutable by itself, but should reflect the changes of the underlying 
counter, just as already existing views (e.g. dict_values) do.

--

___
Python tracker 

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



logging date format with milliseconds and timezone

2018-05-17 Thread Skip Montanaro
It seems that the logging.Formatter class uses two formats by default to
format a time, default_time_format (%Y-%m-%d %H:%M:%S) and
default_msec_format (%s,%03d). The former is a format string for
time.strftime (and thus can't represent fractions of a second). The latter
accomplishes that, but expanding %s with the output of (I believe)
time.strftime and %03d with the milliseconds in the current time. Users can
pass a datefmt arg to logging.basicConfig, or override the aforementioned
default_*_format attributes. Is there some way to format the timestamp with
both fractions of a second and timezone in a way similar to
datetime.strftime? In particular, I'd be happy with this format:
%Y-%m-%dT%H:%M:%S.%f%z. Maybe there is some magic flag to tell the system
I'm want to use datetime.strftime instead of time.strftime?

Thx,

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


ANN: Wing Python IDE 6.0.12 released

2018-05-17 Thread Wingware

Hi,

We've just released Wing 6.0.12 , 
which adds wxPython 4 as a supported matplotlib backend, fixes remote 
development with Python 3.7, improves PEP287 docstring formatting 
errors, correctly updates the Source Assistant for remote files, fixes 
display glitches in the Remote Hosts dialog, adds minor updates of the 
French localization, and makes about 20 other improvements.  For 
details, see https://wingware.com/pub/wingide/6.0.12/CHANGELOG.txt


Download Now 

About Wing

Wing is a family of cross-platform 
 Python IDEs with 
powerful integrated editing, debugging, unit testing, and project 
management features. Wing runs on Windows, Linux, and OS X, and can be 
used to develop any kind of Python code for web, desktop, embedded 
scripting, and other applications.


Wing 101  and Wing Personal 
 omit some features and 
are free to download and use without a license. Wing Pro 
 requires purchasing 
 or upgrading 
 a license, or obtaining a 30-day 
trial at startup.


Version 6 introduces many new features, including improved 
multi-selection, much easier remote development 
, debugging from the Python 
Shell, recursive debugging, PEP 484 and 526 type hinting, support for 
Python 3.6 and 3.7, Vagrant , 
Jupyter , and Django 
 1.10+, easier Raspberry Pi 
 development, optimized 
debugger, OS X full screen mode, One Dark color palette, Russian 
localization (thanks to Alexandr Dragukin), expanded free product line, 
and much more. For details, see What's New in Wing Version 6 
.


Wing 6 works with Python versions 2.5 through 2.7 and 3.2 through 3.7, 
including also Anaconda, ActivePython, EPD, Stackless, and others 
derived from the CPython implementation.


For more product information, please visit wingware.com 



Upgrading

You can try Wing 6 without removing older versions. Wing 6 will read and 
convert your old preferences, settings, and projects. Projects should be 
saved to a new name since previous versions of Wing cannot read Wing 6 
projects.


See also Migrating from Older Versions 
 and Upgrading 
.


Links

Release notice: https://wingware.com/news/2018-05-15
Downloads and Free Trial: https://wingware.com/downloads
Buy: https://wingware.com/store/purchase
Upgrade: https://wingware.com/store/upgrade

Questions?  Don't hesitate to email us at supp...@wingware.com.

Thanks,

--

Stephan Deibel
Wingware | Python IDE

The Intelligent Development Environment for Python Programmers

wingware.com

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


Re: why does list's .remove() does not return an object?

2018-05-17 Thread Tobiah

On 05/17/2018 09:25 AM, Ned Batchelder wrote:

On 5/17/18 11:57 AM, Abdur-Rahmaan Janhangeer wrote:

x = [0,1]
x.remove(0)
new_list = x


Just call the original list 'new_list' to begin with.

  new_list = [0, 1]
  new_list.remove(0)


There you are!
--
https://mail.python.org/mailman/listinfo/python-list


Re: why does list's .remove() does not return an object?

2018-05-17 Thread David Stanek
On 17-May-2018 12:37, Ned Batchelder wrote:
> On 5/17/18 12:28 PM, Dan Strohl via Python-list wrote:
> > On 2018-05-17 11:26 AM, Abdur-Rahmaan Janhangeer wrote:
> > > I don't understand what this would return? x? You already have x.  Is
> > > it meant to make a copy? x has been mutated, so I don't understand the
> > > benefit of making a copy of the 1-less x.  Can you elaborate on the
> > > problem you are trying to solve?
> > >
> > > --Ned.
> > >
> > >
> > > assignment to another var
> > >
> > Though I don’t know what the OP was specifically looking for I could see a 
> > benefit to returning the item deleted.
>
> Notice that this is not the thing the OP wanted returned.  I believe they
> are looking to return the list, not the item.
>

I'm guessing that they want to be able to do some sort of method
chaining like:

  the_list.remove(x).remove(y)

Although the clarifying example was contrived and confusing. A more
concrete example would be greatly appreciated.

-- 
david stanek
web: https://dstanek.com
twitter: https://twitter.com/dstanek
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33558] Python has no icon in taskbar and in start screen

2018-05-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

For me, 3.6.5 IDLE has the same Python app icon (white notebook page with 
blue/yellow snakes) as always.  But I upgraded from 3.6.4, etc, so my Win10 
machine already had the icon.

Filip, which Windows (in case it makes a difference)?  Which *exact* installer 
(there are two you could have used).

--
assignee: terry.reedy -> 
components: +Installation

___
Python tracker 

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



[issue33559] Exception's repr change not documented

2018-05-17 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6615

___
Python tracker 

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



[issue25478] Consider adding a normalize() method to collections.Counter()

2018-05-17 Thread Allen Downey

Allen Downey  added the comment:

I'd like to second Raymond's suggestion.  With just a few additional methods, 
you could support a useful set of operations.  One possible API:

def scaled(self, factor)
"""Returns a new Counter with all values multiplied by factor."""

def normalized(self, total=1)
"""Returns a new Counter with values normalized so their sum is total."""

def total(self)
"""Returns the sum of the values in the Counter."""

These operations would make it easier to use a Counter as a PMF without 
subclassing.

I understand two arguments against this proposal

1) If you modify the Counter after normalizing, the result is probably nonsense.

That's true, but it is already the case that some Counter methods don't make 
sense for some use cases, depending on how you are using the Counter (as a bag, 
multiset, etc)

So the new features would come with caveats, but I don't think that's fatal.

2) PMF operations are not general enough for core Python; they should be in a 
stats module.

I think PMFs are used (or would be used) for lots of quick computations that 
don't require full-fledged stats.

Also, stats libraries tend to focus on analytic distributions; they don't 
really provide this kind of light-weight empirical PMF.

I think the proposed features have a high ratio of usefulness to implementation 
effort, without expanding the API unacceptably.


Two thoughts for alternatives/extensions:

1) It might be good to make scaled() available as __mul__, as Peter Norvig 
suggests.

2) If the argument of scaled() is a mapping type, it might be good to support 
elementwise scaling.  That would provide an elegant implementation of Raymond's 
chi-squared example and my inspection paradox example 
(http://greenteapress.com/thinkstats2/html/thinkstats2004.html#sec33)

Thank you!
Allen

--
nosy: +Allen Downey

___
Python tracker 

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



[issue33559] Exception's repr change not documented

2018-05-17 Thread Steve Dower

Steve Dower  added the comment:


New changeset fb9dd8915314d857161de89fcbbb041f2b49fc22 by Steve Dower (Miro 
Hrončok) in branch 'master':
bpo-33559: Attribute changed repr of exceptions (GH-6954)
https://github.com/python/cpython/commit/fb9dd8915314d857161de89fcbbb041f2b49fc22


--

___
Python tracker 

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



[issue33554] Optimize PyDictObject

2018-05-17 Thread b@n

b@n  added the comment:

A little performance optimization, but I think the key is not in performance 
optimization.
The semantics of the dictresize function are not uniform, and it is 
inconvenient for others to read. The dictresize function should be split to 
make it just resize. What do you think?

--

___
Python tracker 

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



[issue33561] Add .tostring() method to xml.etree.ElementTree.Element

2018-05-17 Thread Stefan Behnel

Stefan Behnel  added the comment:

Sorry, but you are proposing an API extension here that provides no benefits 
but duplicates existing functionality in a less versatile place. This is not 
going to happen.

The second proposal (str(xml)) is actually not very helpful as it does not 
allow any kind of configuration, so it breaks backwards compatibility without 
benefit. Also not going to happen.

--
nosy: +scoder

___
Python tracker 

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



[issue33559] Exception's repr change not documented

2018-05-17 Thread Steve Dower

Steve Dower  added the comment:


New changeset 54fc49737a6a79f6e2ece16e22b233858b836567 by Steve Dower (Miss 
Islington (bot)) in branch '3.7':
bpo-33559: Document changed repr of exceptions (GH-6943) (GH-6950)
https://github.com/python/cpython/commit/54fc49737a6a79f6e2ece16e22b233858b836567


--

___
Python tracker 

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



[issue33559] Exception's repr change not documented

2018-05-17 Thread Steve Dower

Steve Dower  added the comment:

It's worth documenting. I'll merge the next PR with the attribution.

--

___
Python tracker 

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



[issue33559] Exception's repr change not documented

2018-05-17 Thread Miro Hrončok

Miro Hrončok  added the comment:

I was bit by this, so that's why I think this is worth documenting. 
https://github.com/testing-cabal/testtools/issues/270

--

___
Python tracker 

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



[issue33559] Exception's repr change not documented

2018-05-17 Thread Miro Hrončok

Change by Miro Hrončok :


--
pull_requests: +6614

___
Python tracker 

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



[issue33559] Exception's repr change not documented

2018-05-17 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This was done in issue30399, and I was not sure that this change is worth 
adding in What's New. Add a reference to the issue.

--
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: what does := means simply?

2018-05-17 Thread Chris Angelico
On Fri, May 18, 2018 at 3:48 AM, Steven D'Aprano
 wrote:
> On Fri, 18 May 2018 03:44:25 +1000, Chris Angelico wrote:
>
>> I'm morbidly curious as to what "half-on Python code" would look like.
>
> Writing Java in Python. Or C in Python. Or Lisp in Python. Or ...
>

Ah. I was wondering if this was more like "Python code written when
the programmer's brain was half-on" (which, for many, is any time
prior to the third cup of coffee).

Actually, probably not all that different, come to think of it.

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


[issue33355] Windows 10 buildbot: 15 min timeout on test_mmap.test_large_filesize()

2018-05-17 Thread Paul Goins

Paul Goins  added the comment:

Also, to be clear, I understand what David is saying and don't disagree at all. 
 And if this really is Spectre related, it may be difficult to "go back" and 
test a before case, so my last comment about "digging in" may be rather moot.

Does tweaking the timeout sound right (or good enough)?  Or are there other 
things we ought to try first?

--

___
Python tracker 

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



Re: what does := means simply?

2018-05-17 Thread Steven D'Aprano
On Fri, 18 May 2018 03:44:25 +1000, Chris Angelico wrote:

> I'm morbidly curious as to what "half-on Python code" would look like.

Writing Java in Python. Or C in Python. Or Lisp in Python. Or ...


-- 
Steve

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


[issue33559] Exception's repr change not documented

2018-05-17 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6613

___
Python tracker 

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



[issue33559] Exception's repr change not documented

2018-05-17 Thread Steve Dower

Steve Dower  added the comment:


New changeset 631753fcc5e88bbbad402933e77295675cfe1fee by Steve Dower (Miro 
Hrončok) in branch 'master':
bpo-33559: Document changed repr of exceptions (GH-6943)
https://github.com/python/cpython/commit/631753fcc5e88bbbad402933e77295675cfe1fee


--
nosy: +steve.dower

___
Python tracker 

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



[issue33561] Add .tostring() method to xml.etree.ElementTree.Element

2018-05-17 Thread Steven Vascellaro

Steven Vascellaro  added the comment:

Alternatively, the most intuitive solution would be to give `Element` an 
explicit `__str__` method.

The current behavior of `str(Element)` is to return the object's location in 
memory.

```
from xml.etree import ElementTree

xml = ElementTree.Element('Person', Name='John')
print(str(xml))
# Output: 
```

Unfortunately, changing this behavior could cause issues with backwards 
compatibility.

--

___
Python tracker 

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



Package DLL or SO in wheel

2018-05-17 Thread Chris Nyland
Hello,

We have several internal modules we have developed that are used mostly to
read different types of data files. Most of the time the different data
file formats come with some sort of DLL or SO files that gives a standard
interface to read the files. Our design pattern is to create a python
library that uses ctypes to interface with the shared library.

To be clear we are not building the shared libraries these are usually
provided by another group or distributed by a  third party.

So the issue is I want to bundle these share libraries with the module into
a wheel or sdist package to server off our local PyPiServer. I have combed
though the documentation on the setup.py and setuptools and I cannot figure
out a simple way to do this. Currently we are just adding them as datafiles
but this means that the wheels are not named with a particular platform and
thus we need to bundle all the different possible shared libraries with it.

Additionally using the data files method always puts the share library in
the same directory as the Python source while this works I wasn't certain
if there is a more appropriate place for the libraries in the Python
installation.

So in summary:
1. How do I create a setup.py to bundle the appropriate share library into
a wheel for a given platform and name the wheel properly.
2. Where is the most appropriate spot to stick these shared libraries?

Most of our work is done in Windows but we have some modules that we use on
Linux as well. We have both 32 and 64 bit environments. We are currently
using Python 3.6.

Thanks

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


Re: what does := means simply?

2018-05-17 Thread Chris Angelico
On Fri, May 18, 2018 at 3:34 AM, Steven D'Aprano
 wrote:
> On Thu, 17 May 2018 15:50:17 +0100, bartc wrote:
>
>> Of course, full-on Python code is pretty much impossible to port
>> anywhere else anyway.
>
> Oh, I forgot to mention... given that Python is frequently used to
> prototype applications before the production-ready application is written
> in C, C++ or Java, the idea that Python code (whether "full on" or
> otherwise) cannot be ported is especially silly.
>

I'm morbidly curious as to what "half-on Python code" would look like.

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


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

2018-05-17 Thread Emily Morehouse

Change by Emily Morehouse :


--
nosy: +emilyemorehouse

___
Python tracker 

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



Re: object types, mutable or not?

2018-05-17 Thread Ben Bacarisse
Anders Wegge Keller  writes:

> På Wed, 16 May 2018 14:48:27 +0100
> Paul Moore  skrev:
>
>> C++ called that an "rvalue". And then went on to define things that
>> could go on the left hand side of an assignment as "lvalues". And now
>> we have two confusing concepts to explain - see what happens when you
>> let a standards committee define your language? :-)
>
>  I'm not sure the C++ committee has to bear the responsibility for those
> terms. They are pretty well defined in the C world, so I think you need to
> point the finger of accusation at either Brian or Dennis.

The terms are much older than that.  The first BCPL (1967) reference
manual uses the terms, and I don't think Martin Richards invented them.

(And C++ has added glvalue and prvalue to lvalue and rvalue.)

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


Re: what does := means simply?

2018-05-17 Thread Steven D'Aprano
On Thu, 17 May 2018 15:50:17 +0100, bartc wrote:

> Of course, full-on Python code is pretty much impossible to port
> anywhere else anyway.

Oh, I forgot to mention... given that Python is frequently used to 
prototype applications before the production-ready application is written 
in C, C++ or Java, the idea that Python code (whether "full on" or 
otherwise) cannot be ported is especially silly.


-- 
Steve

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


Re: what does := means simply?

2018-05-17 Thread Steven D'Aprano
On Thu, 17 May 2018 17:50:22 +0300, Marko Rauhamaa wrote:

> bartc :
>> Anyway, try this:
>>
>> def showarg(x): print(x)
>>
>> def dummy(*args,**kwargs): pass
>>
>> dummy(a=showarg(1),*[showarg(2),showarg(3)])
>>
>> This displays 2,3,1 showing that evaluation is not left to right.
> 
> Nice one!

I'm fairly sure that both you and Bart know full well I was talking about 
positional arguments. My example used only positional arguments, and my 
reply to Serhiy explicitly referenced positional arguments.

But don't bother responding to what I *actually* said, it's much more fun 
to attack a strawman, right?

And besides, Bart's "showarg" function is a waste of space: it could be 
simply replaced by print.

py> dummy(a=print(1), *[print(2), print(3)])
2
3
1

You want some more examples of non-left to right evaluation order?

Comprehensions.

Ternary if.

Are there any others? Could be. So what? The existence of odd corner 
cases in the language doesn't invalidate my example that doesn't go 
anywhere near those odd corners.


-- 
Steve

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


[issue33555] No SyntaxError raised for `return` with argument inside generator

2018-05-17 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

See also What’s New In Python 3.3:

https://docs.python.org/3/whatsnew/3.3.html#pep-380-syntax-for-delegating-to-a-subgenerator

And PEP 380 itself.

--

___
Python tracker 

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



Re: what does := means simply?

2018-05-17 Thread Steven D'Aprano
On Thu, 17 May 2018 15:50:17 +0100, bartc wrote:

> On 17/05/2018 15:03, Chris Angelico wrote:
>> On Thu, May 17, 2018 at 9:58 PM, bartc  wrote:
>>> On 17/05/2018 04:54, Steven D'Aprano wrote:

 On Thu, 17 May 2018 05:33:38 +0400, Abdur-Rahmaan Janhangeer wrote:

> what does := proposes to do?
>>>
>>>
 A simple example (not necessarily a GOOD example, but a SIMPLE one):

 print(x := 100, x+1, x*2, x**3)
>>>
>>>
>>> It's also not a good example because it assumes left-to-right
>>> evaluation order of the arguments. Even if Python guarantees that, it
>>> might be a problem if the code is ever ported anywhere else.
>>>
>>>
>> Python DOES guarantee it, and nobody cares about your personal toy
>> language other than you. :)
> 
> As I said, it's poor form.

"... to rely on a language's guaranteed features, because, well, for no 
reason really."


> Of course, full-on Python code is pretty much impossible to port
> anywhere else anyway.

*rolls eyes*

You know what "Turing Complete" means, don't you? Either:

- Python is the only Turing Complete programming language in the universe;

- Python is the only programming language in the universe which is
  strictly more powerful than a Turing Machine; or

- you're talking nonsense on stilts.


I know where I'd put my money.


Of course it may sometimes be tricky to mechanically port certain Python 
programs to languages which are less powerful (in the Blub sense). But 
this is nothing new: mechanically porting from one language to another is 
always fraught with problems, unless the languages are designed for that 
(e.g. Coffeescript and Javascript).

Any pair of languages will have code that is hard to port from one to the 
other without jumping through hoops. Try porting C code with lots of 
dynamic memory allocations and pointer accesses to COBOL, or Scheme code 
using continuations to Python, or Hyperscript text chunking code to 
Fortran.

But hard does not mean "pretty much impossible".




-- 
Steve

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


[issue33561] Add .tostring() method to xml.etree.ElementTree.Element

2018-05-17 Thread Steven Vascellaro

New submission from Steven Vascellaro :

In Python 3.6, converting an xml `xml.etree.ElementTree.Element` to a string is 
done using `xml.etree.ElementTree.tostring()`.

```
from xml.etree import ElementTree

xml = ElementTree.Element('Person', Name='John')
print(ElementTree.tostring(xml, encoding='unicode', method='xml')
# Output: 
```

I would like to propose adding a `tostring()` function to the `Element` class, 
so that `ElementTree.tostring(xml)` could be replaced with the more intuitive 
`xml.tostring()`.

```
from xml.etree import ElementTree

xml = ElementTree.Element('Person', Name='John')
print(xml.tostring(encoding='unicode', method='xml'))
# Output: 
```

Benefits:

- Doesn't require importing `xml.etree.ElementTree`
- Allows writing more concise code
- Makes `tostring` part of the `Element` class
- Maintains backwards compatibility

--
components: XML
messages: 316966
nosy: Stevoisiak
priority: normal
severity: normal
status: open
title: Add .tostring() method to xml.etree.ElementTree.Element
type: enhancement
versions: Python 3.6

___
Python tracker 

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



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

2018-05-17 Thread Yury Selivanov

Change by Yury Selivanov :


--
nosy:  -yselivanov

___
Python tracker 

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



[issue33558] Python has no icon in taskbar and in start screen

2018-05-17 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
assignee:  -> terry.reedy
components: +IDLE, Windows
nosy: +paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware
type: performance -> behavior
versions: +Python 3.6 -Python 3.5

___
Python tracker 

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



[issue33548] tempfile._candidate_tempdir_list should consider common TEMP locations

2018-05-17 Thread Steve Dower

Steve Dower  added the comment:

Merged as part of the VSTS PR (it was needed to fix some tests on the Windows 
build machine)

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



[issue33560] tuple.index() could return a more explicit error message

2018-05-17 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This is a duplicate of issue13349.

--
nosy: +serhiy.storchaka
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
superseder:  -> Non-informative error message in index() and remove() functions

___
Python tracker 

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



[issue33533] Provide an async-generator version of as_completed

2018-05-17 Thread Yury Selivanov

Yury Selivanov  added the comment:

I like the idea. Let's revisit it after Python 3.7 is released.

--

___
Python tracker 

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



[issue33544] Asyncio Event.wait() is a hold over from before awaitable, and should be awaitable

2018-05-17 Thread Yury Selivanov

Yury Selivanov  added the comment:

> Deprecating Event.wait would be incorrect because Event was designed to mimic 
> the threading.Event class which has a (blocking) wait() method[1].

This is rather important. I'd like to continue maintaining this similarity. 
Adding 'await event' would be similar (in a way) to making instances of 
threading.Event callable.  So deprecation of '.wait()' isn't something we will 
do.

Having *both* 'await event.wait()' and 'await event' worries me.  IMO the 
slight readability improvement isn't worth the added complexity.

--

___
Python tracker 

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



Re: why does list's .remove() does not return an object?

2018-05-17 Thread Ned Batchelder

On 5/17/18 12:28 PM, Dan Strohl via Python-list wrote:

On 2018-05-17 11:26 AM, Abdur-Rahmaan Janhangeer wrote:

I don't understand what this would return? x? You already have x.  Is
it meant to make a copy? x has been mutated, so I don't understand the
benefit of making a copy of the 1-less x.  Can you elaborate on the
problem you are trying to solve?

--Ned.


assignment to another var


Though I don’t know what the OP was specifically looking for I could see a 
benefit to returning the item deleted.


Notice that this is not the thing the OP wanted returned.  I believe 
they are looking to return the list, not the item.


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


[issue33403] asyncio.tasks.wait does not allow to set custom exception when return_when=FIRST_EXCEPTION

2018-05-17 Thread Yury Selivanov

Yury Selivanov  added the comment:

This isn't a priority now, so let's postpone the discussion on this until 3.7 
is released.

--

___
Python tracker 

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



[issue33560] tuple.index() could return a more explicit error message

2018-05-17 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



RE: why does list's .remove() does not return an object?

2018-05-17 Thread Dan Strohl via Python-list
On 2018-05-17 11:26 AM, Abdur-Rahmaan Janhangeer wrote:
> I don't understand what this would return? x? You already have x.  Is 
> it meant to make a copy? x has been mutated, so I don't understand the 
> benefit of making a copy of the 1-less x.  Can you elaborate on the 
> problem you are trying to solve?
>
> --Ned.
>
>
> assignment to another var
>

Though I don’t know what the OP was specifically looking for I could see a 
benefit to returning the item deleted.

So, lets take as an example I have an object like:

class ListItem(object):
def __init__(self, key, data):
self.key = key
self.data = data
def __eq__(other):
return other == self.key

and I do something like:

i1 = ListItem('hello', 'foobar')
l2 = ListItem('goodby', 'snafu')

l = [i1, i2]

So, lets say I have a need where I want to do something like a remove, but I 
also want to be able to get the .data variable from the object I am removing, 
it would be nice to be able to simply do

x = l.remove('hello')
print(x.data)

Yes, I could do a index/pop to get this, or I could keep a separate dict of the 
objects as well for lookups, or a number of other techniques, but it would be 
easier to simply get it back during the remove().

Dan Strohl

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


Re: why does list's .remove() does not return an object?

2018-05-17 Thread Ned Batchelder

On 5/17/18 11:57 AM, Abdur-Rahmaan Janhangeer wrote:

x = [0,1]
x.remove(0)
new_list = x

instead i want in one go

x = [0,1]
new_list = x.remove(0) # here a way for it to return the modified list by
adding a .return() maybe ?


There isn't a way to do that in one line.  I often find myself splitting 
long statements into more, shorter, statements to express myself more 
clearly.


I don't know if you have a real piece of code in mind, so I don't know 
if you can tell us:  why is it useful to have another variable referring 
to the same list?


--Ned.


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

On Thu, 17 May 2018, 19:54 Alexandre Brault,  wrote:


On 2018-05-17 11:26 AM, Abdur-Rahmaan Janhangeer wrote:

I don't understand what this would return? x? You already have x.  Is it
meant to make a copy? x has been mutated, so I don't understand the

benefit

of making a copy of the 1-less x.  Can you elaborate on the problem you

are

trying to solve?

--Ned.


assignment to another var


You already have access to the list before removal, the list after
removal and the element to be removed.

Do need a copy of the list before removing x?

old_list = list[:]
list.remove(x)

Do you need the list after removing x?

list.remove(x)  # list is the modified list

Do you need x?

list.remove(x)  # x is x

What else would need to be assigned to another var?
--
https://mail.python.org/mailman/listinfo/python-list



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


[issue33499] Environment variable to set alternate location for pycache tree

2018-05-17 Thread Nick Coghlan

Nick Coghlan  added the comment:

I believe the main argument for -X options is the fact that cmd on Windows 
doesn't offer a nice way of setting environment variables as part of the 
command invocation (hence "-X utf8", for example).

As far as setting values for X options goes, `sys._xoptions` in CPython is a 
str:Union[bool,str] dict, with the command args split on "=":

$ python3 -X arg=value -c "import sys; print(sys._xoptions)"

  
{'arg': 'value'}

If no value is given for the arg, then it's just set to the boolean True.

The _xoptions entry shouldn't be the public API though - it's just a way of 
shuttling settings from the command line through to CPython-specific 
initialisation code.

--

___
Python tracker 

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



[issue33537] Help on importlib.resources outputs the builtin open description

2018-05-17 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:


New changeset 6417d33633a3979d996015e52e4ff6c7a88e93e5 by Barry Warsaw (Miss 
Islington (bot)) in branch '3.7':
bpo-33537: Add an __all__ to importlib.resources (GH-6920) (#6941)
https://github.com/python/cpython/commit/6417d33633a3979d996015e52e4ff6c7a88e93e5


--

___
Python tracker 

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



[issue33499] Environment variable to set alternate location for pycache tree

2018-05-17 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

Honestly, I don't think there's a strong argument for a CLI option.  I'm 
perfectly happy with just an environment variable.

--

___
Python tracker 

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



[issue33559] Exception's repr change not documented

2018-05-17 Thread Miro Hrončok

Change by Miro Hrončok :


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

___
Python tracker 

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



[issue19251] bitwise ops for bytes of equal length

2018-05-17 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le 17/05/2018 à 18:20, Nick Coghlan a écrit :
> 
> The question is whether we might be able to avoid some 
> bytes->Python-objects->bytes cycles if there were a few more 
> contiguous-binary-data-centric operations on bytes and/or memoryview (similar 
> to the way the ASCII-centric operations on bytes and bytearray help to avoid 
> bytes->text->bytes cycles).

Can you elaborate on your question?

--

___
Python tracker 

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



[issue19251] bitwise ops for bytes of equal length

2018-05-17 Thread Nick Coghlan

Nick Coghlan  added the comment:

Thanks for the link Serhiy (I'd forgotten about the struct changes proposed in 
PEP 3118), but the existing struct formatting codes are fine for my purposes.

The question is whether we might be able to avoid some 
bytes->Python-objects->bytes cycles if there were a few more 
contiguous-binary-data-centric operations on bytes and/or memoryview (similar 
to the way the ASCII-centric operations on bytes and bytearray help to avoid 
bytes->text->bytes cycles).

--

___
Python tracker 

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



[issue33560] tuple.index() could return a more explicit error message

2018-05-17 Thread Cyril Roelandt

New submission from Cyril Roelandt :

The tuple.index() method returns an error message that does not allow users to 
know what element was being looked for inside the tuple:

>>> ().index(1)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: tuple.index(x): x not in tuple

The list.index() method has a much better error message:

>>> [].index(1)   
Traceback (most recent call last):
  File "", line 1, in 
ValueError: 1 is not in list

We could improve tuple.index() so that its behaviour becomes similar to that of 
list.index().

--
messages: 316955
nosy: Cyril Roelandt
priority: normal
severity: normal
status: open
title: tuple.index() could return a more explicit error message
type: enhancement
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



RE: Request for comments: use-cases for delayed evaluation

2018-05-17 Thread Dan Strohl via Python-list


I could easily see using all of the examples;  I run into this pretty regularly.

What about something like the following (which, honestly is really a 
combination of other examples).

If I have a function that has multiple parameters, each of which might be 
expensive, but it might break out earlier depending on how each one is 
evaluated... for example:

(pretending that "$" is a flag that says "evaluate later", and $(arg) is how 
you say "evaluate now")

def combine_unless_none(*$args, sep=', '):
""" if any arg evaluates to None, return '', otherwise join"""
for arg in args:
tmp_arg = $(arg)
If tmp_arg is None:
return "
return sep.join(args)

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


  1   2   3   >