[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

[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

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

[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

[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

[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

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

[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

[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

[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",

[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

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

[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

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

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

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

[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

[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

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

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

[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

[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

[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

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

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

[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

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

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

[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

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)

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

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

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

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

[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

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

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.

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

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

[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

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

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

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

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

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

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

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 =

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

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

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

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

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

[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

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

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

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

[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

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

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

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

[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

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

[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

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

[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

[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

[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

[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

[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

[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..!

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

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

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

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

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

[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

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

[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

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

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

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

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

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

[issue35866] concurrent.futures deadlock

2019-01-31 Thread SilentGhost
Change by SilentGhost : -- nosy: +bquinlan, pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

[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

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

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

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

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 *

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

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

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

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

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

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

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

  1   2   >