[issue35868] Support ALL_PROXY environment variable in urllib

2019-01-31 Thread SilentGhost


SilentGhost  added the comment:

This sounds like an extension of existing functionality and fairly minor at 
that, that's why we have "enhancement" type of issue, not everything needs to 
be a bug.

--
nosy: +SilentGhost

___
Python tracker 

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



[issue35866] concurrent.futures deadlock

2019-01-31 Thread Jakub Wilk


Jakub Wilk  added the comment:

You're right that sys.stdout.flush() is missing in my code; but on Linux it 
doesn't make a big difference, because multiprocessing flushes stdout before 
fork()ing.

And yes, it really hangs.

--

___
Python tracker 

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



[issue12822] NewGIL should use CLOCK_MONOTONIC if possible.

2019-01-31 Thread Matt Joiner


Change by Matt Joiner :


--
nosy:  -anacrolix

___
Python tracker 

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



[issue35862] Change the environment for a new process

2019-01-31 Thread Tobias Däullary

Tobias Däullary  added the comment:

Because sometimes when a process is implicitly started by some 3rd party 
library (i.e. COM via pythonwin here) the "old", unchanged environment is 
retained as the process itself doesn't care if os.environ was changed or not, 
the original environment cannot be modified.

This solution would give a lot of flexibility in that regard.

I think pythonwin is actually a special case as the problem here lies somewhere 
in the dispatch(.) call. The process creation should be handled somewhere 
within the COM interface, pywin does nothing there. 

But this solution effectively circumvents that issue.

--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue35862] Change the environment for a new process

2019-01-31 Thread Josh Rosenberg


Change by Josh Rosenberg :


Removed file: https://bugs.python.org/file48088/bq-nix.snapshot.json

___
Python tracker 

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



[issue35862] Change the environment for a new process

2019-01-31 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Why is not having the target assign to the relevant os.environ keys before 
doing whatever depends on the environment not an option?

--
nosy: +josh.r

___
Python tracker 

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



[issue35862] Change the environment for a new process

2019-01-31 Thread Josh Rosenberg


Change by Josh Rosenberg :


Removed file: https://bugs.python.org/file48087/core-nix.snapshot.json

___
Python tracker 

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



[issue35862] Change the environment for a new process

2019-01-31 Thread Josh Rosenberg


Change by Josh Rosenberg :


Removed file: https://bugs.python.org/file48089/bq-nix.manifest

___
Python tracker 

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



[issue35862] Change the environment for a new process

2019-01-31 Thread Josh Rosenberg


Change by Josh Rosenberg :


--
Removed message: https://bugs.python.org/msg334593

___
Python tracker 

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



[issue35871] Pdb NameError in generator param and list comprehension

2019-01-31 Thread Jayanth Raman


Jayanth Raman  added the comment:

Thanks for the "interact" tip.

FWIW, I see this issue in 2.7.10 as well.  Although the list comprehension 
works.

$ python
Python 2.7.10 (default, Oct  6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D

$ python /tmp/test2.py
> /tmp/test2.py(5)main()
-> for ii in range(nn):
(Pdb) n
> /tmp/test2.py(6)main()
-> num = sum(xx[jj] for jj in range(nn))
(Pdb) sum(xx[jj] for jj in range(nn))
*** NameError: global name 'xx' is not defined
(Pdb) [xx[jj] for jj in range(nn)]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
(Pdb) c
('xx', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

# test2.py

def main(nn=10):
xx = list(range(nn))
import pdb; pdb.set_trace()
for ii in range(nn):
num = sum(xx[jj] for jj in range(nn))
print('xx', xx)

if __name__ == '__main__':
main()

--

___
Python tracker 

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



[issue35866] concurrent.futures deadlock

2019-01-31 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

I've only got 3.7.1 Ubuntu bash on Windows (also amd64) immediately available, 
but I'm not seeing a hang, nor is there any obvious memory leak that might 
eventually lead to problems (memory regularly drops back to under 10 MB shared, 
24 KB private working set). I modified your code to add a sys.stdout.flush() 
after the write so it would actually echo the dots as they were written instead 
of waiting for a few thousand of them to build up in the buffer, but otherwise 
it's the same code.

Are you sure you're actually hanging, and it's not just the output getting 
buffered?

--
nosy: +josh.r

___
Python tracker 

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



Re: Bringing Order to programming

2019-01-31 Thread Ben Bacarisse
r...@zedat.fu-berlin.de (Stefan Ram) writes:

> source = \
> 'Python is an easy to learn, powerful programming language. It has' + \
> ' efficient high-level data structures and a simple but effective' + \
> ' approach to object-oriented programming. Python's elegant syntax' + \

You have an unexscped ' in there.

> ' and dynamic typing, together with its interpreted nature, make it' + \
> ' an ideal language for scripting and rapid application development' + \
> ' in many areas on most platforms. ';


>   transcript
>
> a 0.0680 s,  a 1.2040 s,  a 9.5823 s,  a 81.9688 s,

My times are very nearly linear:

a 0.0280 s,  a 0.2931 s,  a 2.9006 s,  a 29.4318 s,

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


[issue35871] Pdb NameError in generator param and list comprehension

2019-01-31 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the report. This seems related to issue21161 and issue26072 that 
contain explanation about scope where exec is called with the code and patches 
that fix this issue. As a possible workaround in the issues you can use 
"interact" command to get to a REPL where you can evaluate and exit back to pdb.

--
nosy: +xdegaye, xtreak

___
Python tracker 

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



Re: Bringing Order to programming

2019-01-31 Thread Chris Angelico
On Fri, Feb 1, 2019 at 2:00 PM MRAB  wrote:
>
> On 2019-02-01 00:28, Avi Gross wrote:
> > The second variant is to use the newer bytearray data structure very
> > carefully as it is to a first approximation a mutable string. Adding to the
> > end of a new one should be quick. WARNING: I said be careful. A bytearray is
> > more like a list of 8-bit ints. With care you can handle ASCII text.
> >
> If you're replacing anything within the ASCII range, it'll also work for
> UTF-8!

It'll work if you represent the string as UTF-8 bytes, yes. Perhaps it
would be better to represent a string as a sequence of 21-bit integers
instead of 8-bit integers?

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


Re: Bringing Order to programming

2019-01-31 Thread MRAB

On 2019-02-01 00:28, Avi Gross wrote:

The discussion moved on to debating if an algorithm is O(N) or O(N**2).

For small amounts of text, on fast machines, it really is not worth worrying
about the cost of appending to the end of a growing string resulting in
multiple copies and lots of garbage collection. Many computer textbooks love
to tell you that nothing should be modifiable as a paradigm and endless
copying is good for you since you never change existing data so fewer
mistakes ...

But, for any programmers that happily want to read in entire books and for
some reason then replace all spaces with newlines, may I suggest the
following.

Convert your "text" to/from a list of individual characters. Copy the
non-space characters to the end of an empty list and append a newline when
you see a space. This part should be O(N) as lists have a fast way to append
in constant time. At the end, use str(listname) to do what is needed to get
back a string. Also O(N).

I won't supply the code for obvious reasons but it looks like:

final_list = []
for character in initial_text:
# Add carefully to the end of final_list
final_text = str(final_list)

The second variant is to use the newer bytearray data structure very
carefully as it is to a first approximation a mutable string. Adding to the
end of a new one should be quick. WARNING: I said be careful. A bytearray is
more like a list of 8-bit ints. With care you can handle ASCII text.

If you're replacing anything within the ASCII range, it'll also work for 
UTF-8!

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


[issue34003] csv.DictReader can return basic dict instead of OrderedDict

2019-01-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> not a bug
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



[issue34003] csv.DictReader can return basic dict instead of OrderedDict

2019-01-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution: not a bug -> fixed

___
Python tracker 

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



[issue35863] email.headers wraps headers badly

2019-01-31 Thread R. David Murray


R. David Murray  added the comment:

The rules are: lines should be less than 78 characters; and that lines may be 
broken only at FWS (folding whitespace), not in the middle of words.  Putting 
these rules together, you get the result that the email library produces.  
"Conservative in what you send" means *following the RFC rules*, which is what 
the code does.  The failure here is on the Outlook side, which is supposed to 
be being "liberal in what you accept".  Which it is clearly not doing.

In case you want to read the RFCs, which I just reviewed, Content-ID is defined 
to have the same syntax as Message-ID, and Message-Id is defined as 
"Message-ID:" msg-id CRLF, while 'msg-id' is defined as:

msg-id  =   [CFWS] "<" id-left "@" id-right ">" [CFWS]

Which means that a fold is permitted before the id itself.

We could consider an "enhancement" request to cater to Outlook's deficiency, 
since email clients that are actually limited to 78 character lines are 
vanishingly rare these days.  The change would only be made in the new API 
folder, and I myself wouldn't have the time (or desire :) to work on it, but if 
you want to submit an issue as see what the other email team members think and 
produce a PR if the vote is positive, that's fine by me.

Do you know if it is all headers that Outlook has this problem with, or only 
some?  I will admit that it has been long enough since I implemented this that 
I can't confirm that I made sure it was legal to fold *every* header after the 
colon, but I'm pretty sure I did.

--

___
Python tracker 

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



[issue35858] Consider adding the option of running shell/console commands inside the REPL

2019-01-31 Thread Windson Yang


Windson Yang  added the comment:

Hello, jcrmatos. Maybe you can submit your idea to python-ideas mail-list.

--
nosy: +Windson Yang

___
Python tracker 

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



[issue35868] Support ALL_PROXY environment variable in urllib

2019-01-31 Thread Windson Yang


Windson Yang  added the comment:

This is not a bug, it would be better to submit your ideas to python-ideas 
mail-list

--
nosy: +Windson Yang

___
Python tracker 

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



[issue35846] Incomplete documentation for re.sub

2019-01-31 Thread Windson Yang


Windson Yang  added the comment:

I wonder if possible that c not in ASCIILETTERS when we get KeyError?

if c in ASCIILETTERS:
raise s.error('bad escape %s' % this, len(this))

--
nosy: +Windson Yang

___
Python tracker 

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



[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2019-01-31 Thread Chris Langton


Chris Langton  added the comment:

interestingly, while it is expected Process or Queue would actually close 
resource file descriptors and doesn't because a dev decided they prefer to 
defer to the user how to manage gc themselves, the interesting thing is if you 
'upgrade' your code to use a pool, the process fd will be closed as the pool 
will destroy the object (so it is gc more often);

Say you're limited to a little over 1000 fd in your o/s you can do this

###

import multiprocessing
import json


def process(data):
with open('/tmp/fd/%d.json' % data['name'], 'w') as f:
f.write(json.dumps(data))
return 'processed %d' % data['name']

if __name__ == '__main__':
pool = multiprocessing.Pool(1000)
try:
for _ in range(1000):
x = {'name': _}
pool.apply(process, args=(x,))
finally:
pool.close()
del pool

###

only the pool fd hangs around longer then it should, which is a huge 
improvement, and you might not find a scenario where you need many pool objects.

--

___
Python tracker 

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



[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2019-01-31 Thread Chris Langton


Chris Langton  added the comment:

@pitrou I am interested in a fix for Python 2.7 because in Python 3.x the 
manner in which arithmetic is output is not arbitrary precise.

So I will continue using Python 2.7 until another language I am familiar with 
that has superior arbitrary precise arithmetic compared to python 3.x reaches a 
point where the lib ecosystem is as mature as python 2.7

I heavily use multiprocessing and have many use cases where i work around this 
issue, because i encounter it almost every time i find i need multiprocessing, 
basically i decide i need multiprocessing when i have too many external 
resources being processed by 1 CPU, meaning that multiprocessing will be 
managing thousands of external resources on immediate use!

I work around this issue with this solution instead of the Queue with always 
failed!



#!/usr/bin/env python  

import multiprocessing, time

ARBITRARY_DELAY = 10

processes = []
for data in parse_file(zonefile_path, regex):
t = multiprocessing.Process(target=write_to_json, args=(data, ))
processes.append(t)

i = 0
for one_process in processes:
i += 1
if i % 1000 == 0:
time.sleep(ARBITRARY_DELAY)
one_process.start()

for one_process in processes:
one_process.join()



At the time (years ago) i don't think i knew enough about fd to be good enough 
to solve the root cause (or be elegant) and i've reused this code every time 
Queue failed me (every time i use Queue basically)

To be frank, i ask anyone and they say Queue is flawed.

Now, I am older, and I had some free time, I decided to fix my zonefile parsing 
scripts and use more elegant solutions, i finally looked at the old code i 
reused in many projects and identified it was actually a fd issue (yay for 
knowledge) and was VERY disappointed to see here that you didn't care to solve 
the problem for python 2.7.. very unprofessional..

Now i am disappointed to by unpythonic and add to my script gc... you're 
unprofessionalism now makes me be unprofessional

--
nosy: +Chris Langton

___
Python tracker 

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



Bringing Order to programming

2019-01-31 Thread Avi Gross
The discussion moved on to debating if an algorithm is O(N) or O(N**2).

For small amounts of text, on fast machines, it really is not worth worrying
about the cost of appending to the end of a growing string resulting in
multiple copies and lots of garbage collection. Many computer textbooks love
to tell you that nothing should be modifiable as a paradigm and endless
copying is good for you since you never change existing data so fewer
mistakes ...

But, for any programmers that happily want to read in entire books and for
some reason then replace all spaces with newlines, may I suggest the
following.

Convert your "text" to/from a list of individual characters. Copy the
non-space characters to the end of an empty list and append a newline when
you see a space. This part should be O(N) as lists have a fast way to append
in constant time. At the end, use str(listname) to do what is needed to get
back a string. Also O(N).

I won't supply the code for obvious reasons but it looks like:

final_list = []
for character in initial_text:
# Add carefully to the end of final_list
final_text = str(final_list)

The second variant is to use the newer bytearray data structure very
carefully as it is to a first approximation a mutable string. Adding to the
end of a new one should be quick. WARNING: I said be careful. A bytearray is
more like a list of 8-bit ints. With care you can handle ASCII text. 





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


[issue35871] Pdb NameError in generator param and list comprehension

2019-01-31 Thread Jayanth Raman


New submission from Jayanth Raman :

I get a NameError for a variable in the generator param of a function or in a 
list comprehension.  See example below.  The variable is available to the 
program, but not to the interactive Pdb shell.

# Test file:

def main(nn=10):
xx = list(range(nn))
breakpoint()
for ii in range(nn):
num = sum(xx[jj] for jj in range(nn))
print(f'xx={xx}')

if __name__ == '__main__':
main()


$ python3
Python 3.7.2 (default, Jan 13 2019, 12:50:15)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

$ python3 /tmp/test.py
> /tmp/test.py(5)main()
-> for ii in range(nn):
(Pdb) n
> /tmp/test.py(6)main()
-> num = sum(xx[jj] for jj in range(nn))
(Pdb) sum(xx[jj] for jj in range(nn))
*** NameError: name 'xx' is not defined
(Pdb) [xx[jj] for jj in range(nn)]
*** NameError: name 'xx' is not defined
(Pdb) c
xx=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]


FWIW python3 is a homebrew installation.  I had the same issue with 3.7.0 as 
well (also homebrew):
Python 3.7.0 (default, Sep 18 2018, 18:47:22)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin

--
components: Interpreter Core
messages: 334639
nosy: jayanth
priority: normal
severity: normal
status: open
title: Pdb NameError in generator param and list comprehension
versions: Python 3.7

___
Python tracker 

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



[issue35870] readline() specification is unclear

2019-01-31 Thread Martin Panter


Martin Panter  added the comment:

I agree that the documentation should be clearer about the first two points. 
Considering that the "input" function and by default the "str.splitlines" 
method both behave differently, I often had to re-learn this when I had less 
Python experience.

The expected behaviour as I understand is the line terminator is included if it 
was read. It is not included if the size limit or EOF was reached first. The 
Python 2 documentation 
 is clear about 
both the newline being included and EOF behaviour.

Regarding text files, if you mean the "TextIOWrapper.readline" method, I think 
it is reasonable to assume you get the translated line endings as specified by 
the constructor's "newline" argument: 
. Newline='' and 
newline='\r\n' would keep the '\r\n' terminators, and newline=None would 
translate them to '\n'.

--
nosy: +martin.panter

___
Python tracker 

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



Re: Trying to figure out the data type from the code snippet

2019-01-31 Thread Terry Reedy

On 1/31/2019 3:31 PM, Chupo via Python-list wrote:

In article , Chris
Angelico  says...

There are stupid questions, but I enjoy answering those too. You don't
need to apologize for asking these questions. All you need to do is
ignore the trolls like Rick. In fact, if you abandon Google Groups and
instead read the mailing list python-list@python.org, you can just
leave behind all the people who've been blocked.



Thank you for the tip.

I am in fact not using Google Groups but am accessing comp.lang.python
via nntp:// by using a newsreader.


Then point your newsreader, as I have, to news.gmane.org and subscribe 
to gmane.comp.python.general, which mirrors python-list.


--
Terry Jan Reedy

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


[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11579, 11580

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11579, 11580, 11581

___
Python tracker 

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



Re: How to replace space in a string with \n

2019-01-31 Thread Terry Reedy

On 1/31/2019 1:36 PM, Grant Edwards wrote:

On 2019-01-31, Grant Edwards  wrote:

On 2019-01-31, Terry Reedy  wrote:

On 1/31/2019 11:19 AM, Ian Clark wrote:

text = "The best day of my life!"
output = ''

for i in text:
   if i == ' ':
output +='\n'
   else:
output += i

print(output)



But this is an awful, O(n*n) way to solve an inherently O(n) problem,


How is it O(n^2)?

It loops through the input sequence exactly once.  That looks like
O(n) to me.


Doh!

The 'output +=' operation is also O(n), and it's executed n times.


It is like bubble sort doing n x O(n) operations.  This does not mean 
that O(n*n) is always bad as it may beat O(n*logn) or even O(n) in terms 
of real time when the neglected multiplier and other terms are 
considered*. I regularly write use + to catenate a few, fixed number of 
terms.  But I just read a blogger who used += in a loop like the above 
where there could also be 1000s or more strings to be added together.


* timsort (Tim Peters), used for list.sort and other language sorts, 
uses 'O(n*n)' binary insert sort for 'short' subarrays.  Tim empirically 
selected 64 as the boundary between 'short' and 'long' for Python.  On 
modern CPUs, the O(n*n), shifting part of an array, is done (relatively 
fast) with a single machine instruction.


--
Terry Jan Reedy

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


[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11579

___
Python tracker 

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



[issue35863] email.headers wraps headers badly

2019-01-31 Thread Jon Ribbens


Jon Ribbens  added the comment:

It is not correct folding. It might not be explicitly forbidden, but it is 
clearly unwise, and is breaking 'conservative in what you send'. Outlook will 
not be the only program that fails to parse Python's output.

--

___
Python tracker 

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



Re: Trying to figure out the data type from the code snippet

2019-01-31 Thread DL Neil

On 1/02/19 9:00 AM, Chris Angelico wrote:

On Fri, Feb 1, 2019 at 6:56 AM Chupo via Python-list
 wrote:

In article <67d5c4bc-7212-43d0-b44f-7f22efffa...@googlegroups.com>,
Rick Johnson  says...




I was thought there aren't stupid questions, just stupid answers and I
for sure won't apologize for asking any question. If someone things the
question I asked is stupid they can ignore it. I am not affraid of
losing my reputation by asking a question.



There are stupid questions, but I enjoy answering those too. You don't

...

(TLDR?: the are "stupid questions", here's why, and some ideas with 
which to frame/consider responses)



Many years ago, gulp, decades ago; when I first started-out in 
vocational training, I also thought 'there are no stupid questions, only 
stupid answers'. Possibly I was?am idealistic in other ways too.


Whilst this phrase 'sounds good', is it logical? It seems to assume that 
a questioner can never ask something in a stupid fashion, whilst at the 
same time assuming/insulting a respondent with the opposite assumption. 
(notwithstanding that it can be difficult to find the right words with 
which to phrase a question - particularly someone learning Python's 
concepts. Also, we should never forget that many 'here' are not 
communicating in their primary/home language - thank you for making that 
effort!)



Back when we rode dinosaurs to school, the maxim was "children should be 
seen and not heard". The teacher was 'the sage on the stage' and 
questions had to be invited/were not encouraged - talking to others was 
either "behind the teacher's back" or "cheating", and thus subject to 
discipline (yes, there was such a thing, once upon a time). Today, there 
is a more social approach to learning, where questions, of the teacher 
or of peers are encouraged - and if you'll permit me to disappear into 
cognitive psychology for a moment, it is a much more efficient way to 
learn! However, it also requires that whereas we didn't 'interfere' with 
others' learning by keeping silent, the members of such a 'modern' 
society find new levels of respect for each other, when it is (not) 
acceptable to do such things, etc, etc.


Contrarily, we also live in 'the Internet Age' which includes the rise 
of a sense (?right) of "immediacy". In short: we want it now! Sadly, 
this engenders an apparent motivation to rush 'in' (see also "panic"), 
rather than holding-fire and thinking first - or as the old dinosaur 
used to say "put brain into gear, before mouth into motion"!


I should also mention that the above is very much a description of how 
things are 'in the west' (ie 'western world', 'western culture'). 
Younger colleagues educated in India and China (per example only) tell 
me that their educational modus 'today' is much closer to my own 'back 
then'. Accordingly, until friendships are establish, preparedness to ask 
questions is low - is thought to reveal ignorance, even lack of respect 
of 'teacher'.



There are 'bad questions':

- someone unable to immediately solve a problem, turns to his 
colleague/this list and garbles:

- there may be facts, but are they sufficient?
	- there is often no background to understand the motivation for the 
question
	- there is usually a component of 'how do I fix my solution' cf here is 
the (actual) problem to be solved


- laziness, ie asking someone else to exert effort to save self
- eg no evidence of an attempted solution
- no reference to web or book research

- learning avoidance (even 'destruction'):
	- see current conversation on list where student has clearly said that 
he is dealing with a teacher-directed assignment



So the definition of 'bad question' may boil-down to the motivation of 
the questioner being 'good' or 'bad', rather than the wording itself. 
Why are you asking this question?



Amusingly enough, that's amongst the training given to anyone learning 
training (if you follow): always try to (first) understand why the 
person is asking you this question, then try to answer in similar mode!


- a question asked on-impulse pretty much implies that a direct/complete 
answer will be taken similarly. In which case, it is extremely unlikely 
that the questioner will *learn* from the experience - thus will be 
forced to ask again 'next time'. "Give a man a fish and he eats today. 
Teach a man to fish and he eats every day!" (only an aphorism, sadly not 
literal fact!) Accordingly, 'answering' the original question with 
clarification questions is not a 'silly answer'. Indeed neuroscience 
shows that taking a break from a problem allows the brain to move 'the 
facts' from "working memory" into 'the back of my mind' and/or more 
permanent memory (ie learning); and possibly more important to 
problem-solving, from the logico-cortex into other parts of the brain 
where 'the facts' become associated with "prior knowledge" and other 
components of 'intelligence' may be brought to bear. How often have you 
taken a 

[issue35863] email.headers wraps headers badly

2019-01-31 Thread R. David Murray


R. David Murray  added the comment:

Also note that you might want to switch to the new API, the folder it uses is 
smarter, although in this case I think it will produce the same result because 
it is the "best" rendering of the header under the circumstances.

--

___
Python tracker 

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



[issue35863] email.headers wraps headers badly

2019-01-31 Thread R. David Murray


R. David Murray  added the comment:

That is correct folding.  The word is too long to fit within the 78 character 
default if put on the same line as the label, but does fit on a line by itself.

If Outlook can't understand such a header it is even more broken than I thought 
it was :(  You can work around the outlook but by specifying a 
longer-than-standard (but still RFC compliant) line length when serializing the 
message.

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

___
Python tracker 

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



[issue20767] Some python extensions can't be compiled with clang 3.4

2019-01-31 Thread R. David Murray


Change by R. David Murray :


--
nosy:  -r.david.murray

___
Python tracker 

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



Re: Trying to figure out the data type from the code snippet

2019-01-31 Thread Chupo via Python-list
In article , 
Rick Johnson  says...
> You know _all_ that


What I mentioned is just a small excerpt of what I know :-)


> yet... you didn't know about the built-in `type()` method?

Exactly :-)

> Well, that's just great. We can only hope you don't try your hand at any 
> mission-critical code. And i suppose when the plane crashes you can always 
> fall back on the "beautiful plumage" of your resume, eh chap?
> 

Now that you are saying that, I thing I should abandon my 150 km/h 
racing quadcopter flight controller project :-O

Especially because my idea was to use PYTHON for analyzing the data 
from onboard black box flash in order to fine tune PIDs. Hahah

LOL :-)
-- 
Let There Be Light
Custom LED driveri prema specifikacijama
http://tinyurl.com/customleddriver

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


[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +11576, 11577

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +11576

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +11576, 11577, 11578

___
Python tracker 

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



Re: Trying to figure out the data type from the code snippet

2019-01-31 Thread Chupo via Python-list
In article , Chris 
Angelico  says...
> Ah okay. You may want to killfile a few people then, since you're
> using an actual real newsreader and have that capability.
> 

Yes, Gravity has Bozo Bin for that purpose :-) But although I've been 
using newsgroups for 20 years I've never blocked a single person by 
using a filter because it is not hard to just not open certain messages 
posted by known authors. Especially nowadays when post count is so low.
-- 
Let There Be Light
Custom LED driveri prema specifikacijama
http://tinyurl.com/customleddriver

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


Re: Trying to figure out the data type from the code snippet

2019-01-31 Thread Chupo via Python-list
In article , Chris 
Angelico  says...
> There are stupid questions, but I enjoy answering those too. You don't
> need to apologize for asking these questions. All you need to do is
> ignore the trolls like Rick. In fact, if you abandon Google Groups and
> instead read the mailing list python-list@python.org, you can just
> leave behind all the people who've been blocked.
> 

Thank you for the tip.

I am in fact not using Google Groups but am accessing comp.lang.python 
via nntp:// by using a newsreader.

I think Google Groups destroyed usenet.
-- 
Let There Be Light
Custom LED driveri prema specifikacijama
http://tinyurl.com/customleddriver

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


[issue35431] Add a function for computing binomial coefficients to the math module

2019-01-31 Thread Jakub Wilk


Change by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



Re: Trying to figure out the data type from the code snippet

2019-01-31 Thread Chris Angelico
On Fri, Feb 1, 2019 at 7:36 AM Chupo via Python-list
 wrote:
>
> In article , Chris
> Angelico  says...
> > There are stupid questions, but I enjoy answering those too. You don't
> > need to apologize for asking these questions. All you need to do is
> > ignore the trolls like Rick. In fact, if you abandon Google Groups and
> > instead read the mailing list python-list@python.org, you can just
> > leave behind all the people who've been blocked.
> >
>
> Thank you for the tip.
>
> I am in fact not using Google Groups but am accessing comp.lang.python
> via nntp:// by using a newsreader.

Ah okay. You may want to killfile a few people then, since you're
using an actual real newsreader and have that capability.

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


Re: Trying to figure out the data type from the code snippet

2019-01-31 Thread Chupo via Python-list
> I was thought
> 

I meant: 'I was taught'.
-- 
Let There Be Light
Custom LED driveri prema specifikacijama
http://tinyurl.com/customleddriver

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


Re: Trying to figure out the data type from the code snippet

2019-01-31 Thread Chris Angelico
On Fri, Feb 1, 2019 at 6:56 AM Chupo via Python-list
 wrote:
>
> In article <67d5c4bc-7212-43d0-b44f-7f22efffa...@googlegroups.com>,
> Rick Johnson  says...
>
> 
>
> > I'm impressed! But you're asking basic questions that someone with your 
> > resume should either (1) already know, or (2) be competent enough to find 
> > on their own. Now don't get me wrong. My intention is not to ridicule you. 
> > But, with your resume, you should be embarrassed to ask such basic 
> > questions. You are obviously not an idiot. If you can do what you claim you 
> > can do, then you are intelligent and driven
> person. There are redeemable qualities. Don't waste them. And don't undercut 
> your reputation by appearing to be a hapless rube.
>
>
> I was thought there aren't stupid questions, just stupid answers and I
> for sure won't apologize for asking any question. If someone things the
> question I asked is stupid they can ignore it. I am not affraid of
> losing my reputation by asking a question.
>
>

There are stupid questions, but I enjoy answering those too. You don't
need to apologize for asking these questions. All you need to do is
ignore the trolls like Rick. In fact, if you abandon Google Groups and
instead read the mailing list python-list@python.org, you can just
leave behind all the people who've been blocked.

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


Re: Trying to figure out the data type from the code snippet

2019-01-31 Thread Chupo via Python-list
In article <67d5c4bc-7212-43d0-b44f-7f22efffa...@googlegroups.com>, 
Rick Johnson  says...



> I'm impressed! But you're asking basic questions that someone with your 
> resume should either (1) already know, or (2) be competent enough to find on 
> their own. Now don't get me wrong. My intention is not to ridicule you. But, 
> with your resume, you should be embarrassed to ask such basic questions. You 
> are obviously not an idiot. If you can do what you claim you can do, then you 
> are intelligent and driven 
person. There are redeemable qualities. Don't waste them. And don't undercut 
your reputation by appearing to be a hapless rube.


I was thought there aren't stupid questions, just stupid answers and I 
for sure won't apologize for asking any question. If someone things the 
question I asked is stupid they can ignore it. I am not affraid of 
losing my reputation by asking a question.

 
> Hmm. I don't see anything here that a child couldn't be taught to do.

You failed to see the point of the code snippet I pasted, let me 
explain what was my intention to show with that code:

Since I said I wrote a driver for 3D printer and since there is:

from Printer3D import Head

at the beginning of the code and there is:

hd = Head(layer)

below - from just those two lines you could conclude I wrote Head class 
meaning I *am* aware what object is. And since hd.printLayer() 
obviously does print a layer of the material, that means my 3D printer 
driver is working well. I assumed you could imagine that the driver for 
driving the head of 3D printer is not just a few lines of code, that it 
works in real-time and that it interacts with the hardware.
 
> Your reseme may be impressive... 


What I mentioned is not my resume, I just mentioned what I, knowing 
only Python basics, did using Python. My resume includes:

Embedded devices for industry process control automation (temperature, 
fluid level, time, data from PID controller, ?); VFD control systems with 
complex menu structure, user friendly interface, failsafe and data retention; 
IoT 
applications; multi-channel sound generation; bike computer; remote data 
acquisition 
over RF; data logging; ERP software coding (C#); client service sw for 
warehouse 
handheld data acquisition system (SOAP requests), software for CNC machines 
duty 
simplifications and many more

I am an expert on embedded systems design with more than 50,000 lines of C code 
built-in in various working firmwares. I both designed and built many embedded 
electronic devices based on various microcontrollers doing all the production 
stages, 
designing circuit schematics, calculating the elements, designing printed 
circuit boards, 
generating Gerber files according to the manufacturing requirements, soldering 
components (both TH and SMD) and coding the firmwares. By utilizing 
GCC 
based toolchain and Bare Metal Programming, developing my own libraries and 
optimizing the most critical routines by writing them in assembler I can often 
design the 
devices based on 16 MHz or even just 8 MHz Atmel AVR line of microcontrollers, 
where 
others would resort to using 72 MHz ARM or even more powerful processors. 
Although 
my carefully optimized devices usually outperform the devices based on even 
much 
more powerful hardware, I am using the newest generation of microcontrollers 
such as 
ESP8266 and ESP32 as well. I learnt Z80 assembler when I was 10 and after years 
of 
coding in both Z80 and 6502 assembler it was easy to start using Microchip's 
PIC 
microcontrollers. Later on I switched to Atmel's (now Microchip) 
microcontrollers and to 
the newest ones I mentioned before.

I can start using completely new family of microcontrollers and completely new 
toolchains in a matter of days. I coded all sorts of SPI, I2C, UART, 1-Wire 
etc. and 
custom communication routines, both using the hardware peripherals and/or bit 
banging 
algorithms, hardware/software PWM, efficient debounce algorithms, multitasking 
environments, routines for precise measuring of pulse lengths, complex ISR 
routines 
with carefully calculated T-states (cycles) per pass, DDS algorithms, graphic 
display 
libraries, libraries for communicating with various devices (e.g. NRF24L01+), 
EEPROM 
wear leveling routines and many more. Furthermore, I have a vast experience 
with 
reverse engineering .hex files extracted from microcontrollers which allows me 
to easily 
proof the assembly code generated by the compiler in order to - if necessary - 
rewrite 
the code in a more efficient way, while my deep understanding of serial and 
parallel 
programming protocols, bootloaders, JTAG debugging and inner workings of a 
microcontroller allows me to cope with all kinds of problems that could be met 
while 
developing embedded devices (e.g. noisy environments, black-outs, brown-outs, 
BUS 
contention, contact bounce, ?). Additionally, I have a reasonable knowledge of 
Genetic 
and other AI algorithms (pathfinding, game AI, ?).

To 

Re: How to replace space in a string with \n

2019-01-31 Thread Neil Cerutti
On 2019-01-31, ^Bart  wrote:
> Hello everybody! :)
>
> I got a text and I should replace every space with \n without to use 
> str.replace, I thought something like this:
>
> text = "The best day of my life!"
>
> space = (' ')
>
> if text.count(' ') in text:
>  space=\n
>
> rightText = text-space
>
>  print(rightText)

Your code resembles Python code, but it isn't close enough for me
to offer reasonable help.

You should figure out how to solve your problem *before* you
start to write code. A paper and pencil will be required!

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


Re: How to replace space in a string with \n

2019-01-31 Thread Grant Edwards
On 2019-01-31, ^Bart  wrote:
> Hello everybody! :)
>
> I got a text and I should replace every space with \n without to use 
> str.replace, I thought something like this:
>
> text = "The best day of my life!"

[...]

> I should have an output like this:
> The
> best
> day
> of
> my
> life!

Here's a solution. But don't turn it in. You're not supposed to know
how to do this yet, and your instructor will know you copied it from the
internet:

print(''.join('\n' if c == ' ' else c for c in text))

-- 
Grant Edwards   grant.b.edwardsYow! over in west
  at   Philadelphia a puppy is
  gmail.comvomiting ...

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


Re: How to replace space in a string with \n

2019-01-31 Thread Chris Angelico
On Fri, Feb 1, 2019 at 5:34 AM Grant Edwards  wrote:
>
> On 2019-01-31, Terry Reedy  wrote:
> > On 1/31/2019 11:19 AM, Ian Clark wrote:
> >> text = "The best day of my life!"
> >> output = ''
> >>
> >> for i in text:
> >>   if i == ' ':
> >>output +='\n'
> >>   else:
> >>output += i
> >>
> >> print(output)
>
> > But this is an awful, O(n*n) way to solve an inherently O(n) problem,
>
> How is it O(n^2)?
>
> It loops through the input sequence exactly once.  That looks like
> O(n) to me.
>

Appending onto an immutable string means copying the entire string and
adding the new character.

(CPython does have an optimization that can sometimes improve this
specific case, but in general, this algorithm runs in quadratic time.)

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


Re: How to replace space in a string with \n

2019-01-31 Thread Grant Edwards
On 2019-01-31, Grant Edwards  wrote:
> On 2019-01-31, Terry Reedy  wrote:
>> On 1/31/2019 11:19 AM, Ian Clark wrote:
>>> text = "The best day of my life!"
>>> output = ''
>>> 
>>> for i in text:
>>>   if i == ' ':
>>>output +='\n'
>>>   else:
>>>output += i
>>> 
>>> print(output)
>
>> But this is an awful, O(n*n) way to solve an inherently O(n) problem,
>
> How is it O(n^2)?
>
> It loops through the input sequence exactly once.  That looks like
> O(n) to me.

Doh!

The 'output +=' operation is also O(n), and it's executed n times.

-- 
Grant Edwards   grant.b.edwardsYow! I hope something GOOD
  at   came in the mail today so
  gmail.comI have a REASON to live!!

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


Re: How to replace space in a string with \n

2019-01-31 Thread Grant Edwards
On 2019-01-31, Terry Reedy  wrote:
> On 1/31/2019 11:19 AM, Ian Clark wrote:
>> text = "The best day of my life!"
>> output = ''
>> 
>> for i in text:
>>   if i == ' ':
>>output +='\n'
>>   else:
>>output += i
>> 
>> print(output)

> But this is an awful, O(n*n) way to solve an inherently O(n) problem,

How is it O(n^2)?

It loops through the input sequence exactly once.  That looks like
O(n) to me.

-- 
Grant Edwards   grant.b.edwardsYow! Not SENSUOUS ... only
  at   "FROLICSOME" ... and in
  gmail.comneed of DENTAL WORK ... in
   PAIN!!!

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


Re: How to replace space in a string with \n

2019-01-31 Thread Terry Reedy

On 1/31/2019 11:19 AM, Ian Clark wrote:

text = "The best day of my life!"
output = ''

for i in text:
  if i == ' ':
   output +='\n'
  else:
   output += i

print(output)

throwing my hat in the ring, not only is it .replace free it is entirely
method free


But this is an awful, O(n*n) way to solve an inherently O(n) problem, 
which I think should not be taught to beginners unless they are 
simultaneously taught to never do this for indefinitely large n.


--
Terry Jan Reedy

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


[issue35870] readline() specification is unclear

2019-01-31 Thread Victor Porton


New submission from Victor Porton :

In https://docs.python.org/3/library/io.html it is forgotten to say whether 
'\n' is appened to the return value of readline().

It is also unclear what happens if the last line not terminated by '\n' is read.

It is also unclear what is returned if a text file (say with '\r\n' 
terminators) is read. Is it appended to the return value '\n', '\r\n' or 
nothing?

--
assignee: docs@python
components: Documentation
messages: 334634
nosy: docs@python, porton
priority: normal
severity: normal
status: open
title: readline() specification is unclear
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: How to replace space in a string with \n

2019-01-31 Thread Avi Gross
It is amazing to watch what happens when a fairly simple question is asked
to see how people answer.

In an effort not to ramble, I will summarize my thoughts. The student wanted
to know how to solve a problem using only what they already should know and
that specifically they should not use a method. In effect, they are being
asked to write the kind of code that might be used to make such a method.

There were many answers including some that absurdly suggested even more
advanced methods they should not know. Frankly, the question belongs more in
the sister list for tutoring and even there, the goal is NOT to supply an
answer but point out flaws in code provided as an attempt or suggest an
outline of a method and let the student fill it out and learn.

This is not only a public forum but one that is searchable indefinitely into
the future. Providing a full-blown answer not only hands a solution to one
student but to their classmates and any future takers.

I note another poster asking questions turns out to be not a student but
someone quite advanced who likes to learn just in time as they search for
what is needed. They require a very different approach and can learn well
from being handed a more detailed solution they can interpolate into their
project. 

So, how do you replace? I think a loop answer is probably best for this
student. For the second type of questioner, many of the others would be
great including suggesting they just use replace as there is nothing wrong
with that!

NOTE: It is great when we have an exact set of requirements. I note that the
requirement here might not require making a new string at all. If you just
need to PRINT the words on multiple lines, one solution is to call "print"
on each character in the loop using the appropriate method to suppress
printing a newline except when you see a blank.


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


[issue35773] test_bdb fails on AIX bot (regression)

2019-01-31 Thread Michael Felt


Michael Felt  added the comment:

Update:
buildbot@x064:[/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue]./python 
-m test -v test_bdb
== CPython 3.8.0a0 (heads/master-dirty:0785889468, Jan 30 2019, 16:16:31) [C]
== AIX-1-00C291F54C00-powerpc-32bit big-endian
== cwd: 
/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/build/test_python_11862246
== CPU count: 8
== encodings: locale=ISO8859-15, FS=iso8859-15
Run tests sequentially
0:00:00 [1/1] test_bdb
test_down (test.test_bdb.StateTestCase) ... ok
...
test_step_at_return_with_no_trace_in_caller (test.test_bdb.IssuesTestCase) ... 
ok

==
FAIL: test_skip (test.test_bdb.StateTestCase)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/test/test_bdb.py", 
line 731, in test_skip
tracer.runcall(tfunc_import)
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/test/test_bdb.py", 
line 448, in __exit__
self.test_case.fail(err_msg)
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/issue/Lib/test/test_bdb.py", 
line 582, in fail
raise self.failureException(msg) from None
AssertionError: encoding with 'iso8859-15' codec failed (BdbNotExpectedError: 
Wrong event type at expect_set item 2, got 'call'
  Expected: ('line', 3, 'tfunc_import')
  Got:  ('call', 11, 'encode'), ('quit',),)

--

Ran 31 tests in 0.392s

Is this somehow related to "encoding" as in AIX is not using utf-8 as default?

--

___
Python tracker 

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



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-01-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue35766] Merge typed_ast back into CPython

2019-01-31 Thread Guido van Rossum


Change by Guido van Rossum :


--
pull_requests: +11573, 11574, 11575

___
Python tracker 

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



[issue35766] Merge typed_ast back into CPython

2019-01-31 Thread Guido van Rossum


Change by Guido van Rossum :


--
pull_requests: +11573, 11574

___
Python tracker 

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



[issue35766] Merge typed_ast back into CPython

2019-01-31 Thread Guido van Rossum


Change by Guido van Rossum :


--
pull_requests: +11573

___
Python tracker 

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



Re: How to replace space in a string with \n

2019-01-31 Thread Ian Clark
text = "The best day of my life!"
output = ''

for i in text:
 if i == ' ':
  output +='\n'
 else:
  output += i

print(output)

throwing my hat in the ring, not only is it .replace free it is entirely
method free

On Thu, Jan 31, 2019 at 3:41 AM ^Bart  wrote:

> [Solved by myself and I'm happy!!! :)]
>
> text = "The best day of my life!"
>
> space = text[3]
>
> print (text.replace(space, "\n"))
>
> [Like what I said in another message, in the afternoon I'll ask to the
> teacher if for this exercise we're able to use .replace]
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue35869] io.BufferReader.read() returns None

2019-01-31 Thread Steve Palmer


Steve Palmer  added the comment:

The description of read in io.BufferedReader.read function states "Read and 
return size bytes, or if size is not given or negative, until EOF or if the 
read call would block in non-blocking mode."  This does mention the non-block 
mode scenario, but I can't parse this sentence.

--

___
Python tracker 

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



[issue35855] IDLE squeezer: improve unsqueezing and autosqueeze default

2019-01-31 Thread Tal Einat


Tal Einat  added the comment:

In my opinion, everything here is relatively minor compared to some other 
current issues with IDLE, e.g. some of those mentioned by Raymond Hettinger in 
his comments on #35196.

That being said, a few comments:

> E1. Add 'Expand' at the top of the context menu.  (I sometimes right click 
> instead of double-clicking the squeeze label.)  (And add 'Help' at the 
> bottom, to display an explanation of Squeezer.)

I agree. If you create an issue, I'll make a PR.

> E2. Add a hot key to expand when the text cursor is on the line with the 
> squeeze label.

This existed in previous versions of Squeezer, but I removed it to keep things 
simple. It can easily be added.

> U1. If the squeeze label is near the bottom of the window, only the top few 
> lines are made visible.

Scrolling the screen for the user should usually be avoided. With scrolling 
being easy these days (scroll wheels, native scrolling in touchpads, touch 
screens) I vote to leave this up to the user.

> U2. *Perhaps* we should put the text cursor at the beginning of the output, 
> instead of leaving it at the next prompt, so nagivation keys work.

This would be the case when done via keyboard as suggested in E2. I'm strongly 
against moving the cursor upon un-squeezing text in general.


Regarding A1-A3 and the rest, I fail to see the point, but have nothing 
constructive to say.

--

___
Python tracker 

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



[issue35869] io.BufferReader.read() returns None

2019-01-31 Thread Steve Palmer


New submission from Steve Palmer :

class io.BufferedIOBase states "In addition, those methods [read(), readinto() 
and write()] can raise BlockingIOError if the underlying raw stream is in 
non-blocking mode and cannot take or give enough data; unlike their RawIOBase 
counterparts, they will never return None."

However, class.io.BufferedReader (inheriting from io.BufferedIOBase) *does* 
return None in this case.  Admittedly, io.BufferedReader does says it is 
overriding the inherited method, but I'm surprised that change in behaviour 
declared for buffered objects, is reverted to the RarIOBase behaviour on a more 
specific class.

The attached file (a little long - sorry), simulates a slow non-blocking raw 
file, which it wraps in a BufferReader to test the behaviour defined in 
BufferedIOBase.

--
files: read2.py
messages: 334630
nosy: steverpalmer
priority: normal
severity: normal
status: open
title: io.BufferReader.read() returns None
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48091/read2.py

___
Python tracker 

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



[issue29995] re.escape() escapes too much

2019-01-31 Thread Salvo Tomaselli


Salvo Tomaselli  added the comment:

Aaaand this broke my unit tests when moving from 3.6 to 3.7!

--
nosy: +LtWorf

___
Python tracker 

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



[issue35868] Support ALL_PROXY environment variable in urllib

2019-01-31 Thread SilentGhost


Change by SilentGhost :


--
nosy: +orsenthil
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



[issue27749] multprocessing errors on Windows: WriteFile() argument 1 must be int, not None; OSError: handle is closed

2019-01-31 Thread Michael Jacob


Michael Jacob  added the comment:

So, I'm experiencing the issue in the title, too. The pipe handle stays valid 
for between 5 and 60 minutes, then it goes None when written to.

I'm far from understanding that code, but this crude re-connect code seems to 
solve the issue for me:

In BaseProxy._callmethod, I changed:

conn.send((self._id, methodname, args, kwds))

to:

try:
conn.send((self._id, methodname, args, kwds))
except TypeError:
self._connect()
conn = self._tls.connection
conn.send((self._id, methodname, args, kwds))

--

___
Python tracker 

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



[issue35868] Support ALL_PROXY environment variable in urllib

2019-01-31 Thread Oleh Khoma


Change by Oleh Khoma :


--
components: +Library (Lib) -Extension Modules

___
Python tracker 

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



[issue35868] Support ALL_PROXY environment variable in urllib

2019-01-31 Thread Oleh Khoma


New submission from Oleh Khoma :

Please, add support for ALL_PROXY environment variable to urllib. When this 
environment variable is found, add same proxy for HTTP, HTTPS and FTP.

--
components: Extension Modules
messages: 334627
nosy: Oleh Khoma
priority: normal
severity: normal
status: open
title: Support ALL_PROXY environment variable in urllib
type: enhancement

___
Python tracker 

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



[issue27015] subprocess.CalledProcessError's repr changes based on kwargs, and doesn't unpickle

2019-01-31 Thread Nick Coghlan

Nick Coghlan  added the comment:

Reviewing Rémi's page made me realise that a big part of the root cause here is 
pickle support in exceptions predating the introduction of `__getnewargs__` and 
`__getnewargs_ex__`.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue35867] NameError is not caught at Task execution

2019-01-31 Thread Sampsa Riikonen


New submission from Sampsa Riikonen :

- Create a cofunction that raises an Exception or an Error
- Schedule that cofunction as a task
- Exceptions are raised when the task is executed OK
- However, Errors (i.e. NameError, AssertionError, etc.) are raised only at 
task garbage collection..!

Please try this snippet:

```
import asyncio

class HevonPaskaa:

def __init__(self):
pass

async def goodfunc(self):
await asyncio.sleep(3)
print("Good function was called allright")
print("While it was sleeping, hevonpaska must have been executed")

async def hevonpaska(self):
"""When this cofunction is scheduled as a task:
- The NameError is not raised immediately .. !
- BaseException is raised immeadiately OK
"""
raise NameError # WARNING: This is catched only when the program 
terminates
# raise BaseException # WARNING: comment the previous line and 
uncomment this: this is catched immediately

async def cofunc2(self):
# # we'd like this to raise the NameError immediately:
self.task = asyncio.get_event_loop().create_task(self.hevonpaska())
self.good_task = asyncio.get_event_loop().create_task(self.goodfunc())
# # this raises NameError immediately because the task is garbage 
collected:
# self.task = None

async def cofunc1(self):
await self.cofunc2()
print("\nwaitin' : where-t-f is the NameError hiding!?")
await asyncio.sleep(6)
print("Wait is over, let's exit\n")

hv = HevonPaskaa()

asyncio.get_event_loop().run_until_complete(hv.cofunc1())
```

--
components: asyncio
messages: 334625
nosy: Sampsa Riikonen, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: NameError is not caught at Task execution
type: behavior
versions: Python 3.6

___
Python tracker 

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



Re: How to replace space in a string with \n

2019-01-31 Thread ^Bart

[Solved by myself and I'm happy!!! :)]

text = "The best day of my life!"

space = text[3]

print (text.replace(space, "\n"))

[Like what I said in another message, in the afternoon I'll ask to the 
teacher if for this exercise we're able to use .replace]

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


[issue35766] Merge typed_ast back into CPython

2019-01-31 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c by Łukasz Langa (Guido 
van Rossum) in branch 'master':
bpo-35766: Merge typed_ast back into CPython (GH-11645)
https://github.com/python/cpython/commit/dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue12822] NewGIL should use CLOCK_MONOTONIC if possible.

2019-01-31 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-23428: "Use the monotonic clock for thread conditions on POSIX 
platforms".

--

___
Python tracker 

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



[issue27015] subprocess.CalledProcessError's repr changes based on kwargs, and doesn't unpickle

2019-01-31 Thread Nick Coghlan


Change by Nick Coghlan :


--
pull_requests:  -11260

___
Python tracker 

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



[issue27015] subprocess.CalledProcessError's repr changes based on kwargs, and doesn't unpickle

2019-01-31 Thread Nick Coghlan


Change by Nick Coghlan :


--
pull_requests:  -11261

___
Python tracker 

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



[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve

2019-01-31 Thread Nick Coghlan


Nick Coghlan  added the comment:

+1 for Antoine's comment - while our approach with memoryview has generally 
been "If you're doing serious work with n-dimensional data, you still need 
NumPy (or an equivalent)", we've also been open to borrowing more NumPy 
behaviours for memoryview as particular pain points arise, and I think that 
applies here.

--

___
Python tracker 

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



Re: How to replace space in a string with \n

2019-01-31 Thread Michael Poeltl
hi ^Bert,

I've just thought that you don't like to use text.replace(' ', '\n'), and so I 
came up with another way to get the job done.

So it was part of a "school-test" - uiuitststs ;-)

follow the hint from Peter then, and inside *your* for-loop ask yourself, how 
to inspect the value of c in a loop and what to do *if* the value of c was ' ' .

as mentioned, a string is immuteable, so you cannot change it *inplace* - you 
have to build a new str-object (has a new object-id the starting with an empty 
string say

newtext = ''
and with each loop over your original text you add one character like

newtext = newtext+c

and only if c has a value of ' ', then you add a different value like '\n'

well, now you should try to understand peters for-loop, and then you should try 
to combine what you have learned with the if-statement within the for(-loop) 
block

happy learning the python-language! It's a great one, this I can promise you!
regards
Michael

* Peter Otten <__pete...@web.de> [2019-01-31 11:15]:
> ^Bart wrote:
> 
> >> Why?
> > 
> > It's a school test, now we should use just what we studied, if than,
> > else, sequences, etc.!
> > 
> > ^Bart
> 
> Hint: you can iterate over the characters of a string
> 
> >>> for c in "hello":
> ... print(c)
> ... 
> h
> e
> l
> l
> o
> 
> 
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
  Michael Poeltl 
  Computational Materials Physics at University
  Wien, Sensengasse 8/12, A-1090 Wien, AUSTRIA
  http://cmp.univie.ac.at/
  http://homepage.univie.ac.at/michael.poeltl/
  using elinks-0.12, mutt-1.5.21, and vim-7.4,
  with python-3.6.1, on linux mint 17.3 (rose)   :-)
  fon: +43-1-4277-51409

  "Lehrend lernen wir!"
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue12822] NewGIL should use CLOCK_MONOTONIC if possible.

2019-01-31 Thread INADA Naoki


INADA Naoki  added the comment:

ref: https://bugs.chromium.org/p/webrtc/issues/detail?id=9269
macOS and iOS don't support pthread_condattr_setclock yet.

--
components: +Interpreter Core -None
versions: +Python 3.8 -Python 3.2, Python 3.3

___
Python tracker 

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



Re: How to replace space in a string with \n

2019-01-31 Thread Chris Angelico
On Thu, Jan 31, 2019 at 9:56 PM ^Bart  wrote:
>
> >You coulde use »sub« from the module »re«, then.
> >(The Python Library Reference, Release 3.8.0a0 -
> >6.2 re - Regular expression operations)
>
> We're using 3.7.2 :\
>

Don't worry about that difference - 3.8 is only minorly different from 3.7.

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


Re: How to replace space in a string with \n

2019-01-31 Thread Antoon Pardon
On 31/01/19 11:47, ^Bart wrote:
>>    . A correct answer to the exercise would be:
>>
>> |You cannot replace a space with \n in a string,
>> |because strings are immutable in Python.
>
> Yes, I thought in a wrong way! :)
>
Well maybe you can turn the string into a list of characters. Then
replace the spaces with newlines and finaly turn the list into a string
again. -- Antoon.

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


Re: How to replace space in a string with \n

2019-01-31 Thread ^Bart

No it is not the proper way of a school test to copy what others provided.


You're right but I need just to understand what tools I should use, it 
could be nice if the teacher says something like "use just these three 
tools to solve this problem" or "you don't need to use these other tools 
to do it!"


I hope you understood what I mean...

^Bart

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


Re: How to replace space in a string with \n

2019-01-31 Thread ^Bart

   You coulde use »sub« from the module »re«, then.
   (The Python Library Reference, Release 3.8.0a0 -
   6.2 re - Regular expression operations)


We're using 3.7.2 :\


   Otherwise,

   Write a loop that takes the first character from
   the source and appends it to a new string until
   there is no more character left in the source.

   You now should have written a loop that copies
   the string character by character.

   Then it is easy to modify the loop a little bit
   to complete the exercise.


I'll ask it to the teacher this afternoon, thanks for your reply! :)

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


Re: How to replace space in a string with \n

2019-01-31 Thread ^Bart

   . A correct answer to the exercise would be:

|You cannot replace a space with \n in a string,
|because strings are immutable in Python.


Yes, I thought in a wrong way! :)

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


Re: How to replace space in a string with \n

2019-01-31 Thread ^Bart

Il 31/01/19 10:34, Michael Poeltl ha scritto:

hi,
Maybe this is a proper way to do what you'd liked to achieve


text = "The best day of my life!"
newtext = '\n'.join( text.split() )
print(newtext)

The
best
day
of
my
life!




yours
Michael


Thanks Michael, I'll ask to my teacher in the afternoon if he has the 
same idea, you know when you start a new language you should solve 
problems just with few things, when your mind understood how the 
language works you can use every tools of this language! :)


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


[issue35866] concurrent.futures deadlock

2019-01-31 Thread SilentGhost


Change by SilentGhost :


--
nosy: +bquinlan, pitrou

___
Python tracker 

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



Re: How to replace space in a string with \n

2019-01-31 Thread ^Bart

Have you even tried to run this?


No, it doesn't run, it's just a personal idea! :)


I don't think this does what you think it does.

text.count(' ') will return 5, an integer. So you are testing if 5 is in text. 
But since
5 is an integer that will raise a TypeError.


Yes, I understood this is wrong!


rightText = text-space



Where does text-space come from?


I thought to use (text) - (space), space is " " but I should replace in 
text what I said in the variable is space.


I know there are a lot o solutions but this afternoon I'll ask to the 
teacher what we should do to do it!


Thank you very much for your reply! :)
^Bart
--
https://mail.python.org/mailman/listinfo/python-list


[issue20767] Some python extensions can't be compiled with clang 3.4

2019-01-31 Thread STINNER Victor


STINNER Victor  added the comment:

> If the intent is to use this issue to track the resolution of the original 
> issue (clang compilation broken) and cover the new PR (which just moves the 
> code from os detection to compiler detection), then it can remain open. 
> Otherwise it can be closed, as the original issue 'has' been fixed.

Ok, I close the issue.

On https://github.com/python/cpython/pull/5233 bapt asked "code changes", but I 
don't understand what exactly and I'm not interested to continue to work on 
these changes. If someone is interested, please open a new issue (pointing to 
this one).

--
resolution:  -> fixed
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: How to replace space in a string with \n

2019-01-31 Thread Antoon Pardon
On 31/01/19 10:37, Michael Poeltl wrote:
> hi,
>
> ^Bart  ended in a Mail-Delivery...
> so I send it ONLY to the python-list
>
> ^Bert, a proper way to do what you'd liked to achieve is the following:

No it is not the proper way of a school test to copy what others provided.

-- 
Antoon.


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


Re: How to replace space in a string with \n

2019-01-31 Thread Antoon Pardon
On 31/01/19 10:18, ^Bart wrote:
> Hello everybody! :)
>
> I got a text and I should replace every space with \n without to use
> str.replace, I thought something like this:

Have you even tried to run this?

>
> text = "The best day of my life!"
>
> space = (' ')
>
> if text.count(' ') in text:
>     space=\n

I don't think this does what you think it does.

text.count(' ') will return 5, an integer. So you are testing if 5 is in text. 
But since
5 is an integer that will raise a TypeError.

>
> rightText = text-space


Where does text-space come from?

-- 
Antoon.

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


Re: How to replace space in a string with \n

2019-01-31 Thread Peter Otten
^Bart wrote:

>> Why?
> 
> It's a school test, now we should use just what we studied, if than,
> else, sequences, etc.!
> 
> ^Bart

Hint: you can iterate over the characters of a string

>>> for c in "hello":
... print(c)
... 
h
e
l
l
o




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


Re: How to replace space in a string with \n

2019-01-31 Thread Michael Poeltl
hi,

^Bart  ended in a Mail-Delivery...
so I send it ONLY to the python-list

^Bert, a proper way to do what you'd liked to achieve is the following:

>>> text = "The best day of my life!"
>>> newtext = '\n'.join( text.split() )
>>> print(newtext)
The
best
day
of
my
life!
>>>

regards
Michael

* ^Bart  [2019-01-31 10:22]:
> Hello everybody! :)
> 
> I got a text and I should replace every space with \n without to use
> str.replace, I thought something like this:
> 
> text = "The best day of my life!"
> 
> space = (' ')
> 
> if text.count(' ') in text:
> space=\n
> 
> rightText = text-space
> 
> print(rightText)
> 
> I should have an output like this:
> The
> best
> day
> of
> my
> life!
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
  Michael Poeltl 
  Computational Materials Physics at University
  Wien, Sensengasse 8/12, A-1090 Wien, AUSTRIA
  http://cmp.univie.ac.at/
  http://homepage.univie.ac.at/michael.poeltl/
  using elinks-0.12, mutt-1.5.21, and vim-7.4,
  with python-3.6.1, on linux mint 17.3 (rose)   :-)
  fon: +43-1-4277-51409

  "Lehrend lernen wir!"
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25592] distutils docs: data_files always uses sys.prefix

2019-01-31 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Jeroen you're right.  Could you still give it a quick check?  Then I'll mark 
the PR for a 2.7 backport.

--

___
Python tracker 

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



[issue25592] distutils docs: data_files always uses sys.prefix

2019-01-31 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
status: closed -> open

___
Python tracker 

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



[issue35866] concurrent.futures deadlock

2019-01-31 Thread Jakub Wilk


New submission from Jakub Wilk :

The attached test program hangs eventually (it may need a few thousand of 
iterations).

Tested with Python v3.7.2 on Linux, amd64.

--
components: Library (Lib)
files: cf-deadlock.py
messages: 334618
nosy: jwilk
priority: normal
severity: normal
status: open
title: concurrent.futures deadlock
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48090/cf-deadlock.py

___
Python tracker 

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



Re: How to replace space in a string with \n

2019-01-31 Thread Michael Poeltl
hi,
Maybe this is a proper way to do what you'd liked to achieve

>>> text = "The best day of my life!"
>>> newtext = '\n'.join( text.split() )
>>> print(newtext)
The
best
day
of
my
life!
>>>

yours
Michael

* ^Bart  [2019-01-31 10:22]:
> Hello everybody! :)
> 
> I got a text and I should replace every space with \n without to use
> str.replace, I thought something like this:
> 
> text = "The best day of my life!"
> 
> space = (' ')
> 
> if text.count(' ') in text:
> space=\n
> 
> rightText = text-space
> 
> print(rightText)
> 
> I should have an output like this:
> The
> best
> day
> of
> my
> life!
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
  Michael Poeltl 
  Computational Materials Physics at University
  Wien, Sensengasse 8/12, A-1090 Wien, AUSTRIA
  http://cmp.univie.ac.at/
  http://homepage.univie.ac.at/michael.poeltl/
  using elinks-0.12, mutt-1.5.21, and vim-7.4,
  with python-3.6.1, on linux mint 17.3 (rose)   :-)
  fon: +43-1-4277-51409

  "Lehrend lernen wir!"
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20767] Some python extensions can't be compiled with clang 3.4

2019-01-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy:  -terry.reedy

___
Python tracker 

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



Re: How to replace space in a string with \n

2019-01-31 Thread Michael Poeltl
maybe this is an alternative way to get your wished result.

>>> text = "The best day of my life!"
>>> newtext = '\n'.join( text.split() )
>>> print(newtext)
The
best
day
of
my
life!
>>>

yours
Michael
* ^Bart  [2019-01-31 10:22]:
> Hello everybody! :)
> 
> I got a text and I should replace every space with \n without to use
> str.replace, I thought something like this:
> 
> text = "The best day of my life!"
> 
> space = (' ')
> 
> if text.count(' ') in text:
> space=\n
> 
> rightText = text-space
> 
> print(rightText)
> 
> I should have an output like this:
> The
> best
> day
> of
> my
> life!
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
  Michael Poeltl 
  Computational Materials Physics at University
  Wien, Sensengasse 8/12, A-1090 Wien, AUSTRIA
  http://cmp.univie.ac.at/
  http://homepage.univie.ac.at/michael.poeltl/
  using elinks-0.12, mutt-1.5.21, and vim-7.4,
  with python-3.6.1, on linux mint 17.3 (rose)   :-)
  fon: +43-1-4277-51409

  "Lehrend lernen wir!"
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to replace space in a string with \n

2019-01-31 Thread ^Bart

Why?


It's a school test, now we should use just what we studied, if than, 
else, sequences, etc.!


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


Re: How to replace space in a string with \n

2019-01-31 Thread Alister via Python-list
On Thu, 31 Jan 2019 10:18:20 +0100, ^Bart wrote:

> Hello everybody! :)
> 
> I got a text and I should replace every space with \n without to use
> str.replace,

Why?

> I thought something like this:
> 
> text = "The best day of my life!"
> 
> space = (' ')
> 
> if text.count(' ') in text:
>  space=\n
> 
> rightText = text-space
> 
>  print(rightText)
> 
> I should have an output like this:
> The best day of my life!





-- 
There is nothing new except what has been forgotten.
-- Marie Antoinette
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >