Re: matplot plot hangs

2017-10-31 Thread Andrew Z
Stefan, I intentionally tried to use the qt backend that i do not have. I wanted to check i the switch was working (or not). All i want at this point is to use (seemed to be default) tkagg. On Oct 31, 2017 20:15, "Stefan Ram" wrote: > Andrew Z writes: > >ImportError: *No module named 'PyQt4'*

Re: Invoking return through a function?

2017-10-31 Thread Alberto Riva
On 10/31/2017 11:01 AM, Rhodri James wrote: On 31/10/17 02:06, Alberto Riva wrote: Steve D'Aprano gave you a pretty full answer, I just wanted to add:  The kind of statement I was trying to add would at least have made that explicit: return-if-so-and-so-happens. That's only obvious in the f

Re: The syntax of replacement fields in format strings

2017-10-31 Thread Rick Johnson
On Tuesday, October 31, 2017 at 1:35:33 PM UTC-5, John Smith wrote: > If we keep the current implementation as is, perhaps the > documentation should at least be altered ? You should supply a concise code example that showcases why _you_ feel the docs are not satisfactory. It would help. -- https

matplot plot hangs

2017-10-31 Thread Andrew Z
hello, learning python's plotting by using matplotlib with python35 on fedora 24 x86. Installed matplotlib into user's directory. tk, seemed to work - http://www.tkdocs.com/tutorial/install.html#installlinux - the window shows up just fine. but when trying to run the simple plot ( https://matplot

Re: Report on non-breaking spaces in posts

2017-10-31 Thread Ben Bacarisse
Rhodri James writes: > On 31/10/17 17:23, Stefan Ram wrote: >> Ned Batchelder writes: >>>     def wrapped_join(values, sep): >> >>Ok, here's a report on me seing non-breaking spaces in >>posts in this NG. I have written this report so that you >>can see that it's not my newsreader

Re: The syntax of replacement fields in format strings

2017-10-31 Thread John Smith
If we keep the current implementation as is, perhaps the documentation should at least be altered ? -- https://mail.python.org/mailman/listinfo/python-list

Re: Report on non-breaking spaces in posts

2017-10-31 Thread Ben Bacarisse
r...@zedat.fu-berlin.de (Stefan Ram) writes: > r...@zedat.fu-berlin.de (Stefan Ram) writes: >>|od -c tmp.txt >>|... >>|0012620 s u l a t e i t : \n \n     >>|0012640      d e f w r a p p e d _ >>|... >>| >>|od -x tmp.txt >>|.

Re: Report on non-breaking spaces in posts

2017-10-31 Thread Rhodri James
On 31/10/17 17:23, Stefan Ram wrote: Ned Batchelder writes:     def wrapped_join(values, sep): Ok, here's a report on me seing non-breaking spaces in posts in this NG. I have written this report so that you can see that it's not my newsreader that is converting something, becau

Re: Report on non-breaking spaces in posts (was: How to join elements at the beginning and end of the list)

2017-10-31 Thread Jon Ribbens
On 2017-10-31, Stefan Ram wrote: > Ned Batchelder writes: >>     def wrapped_join(values, sep): > > Ok, here's a report on me seing non-breaking spaces in > posts in this NG. I have written this report so that you > can see that it's not my newsreader that is converting > something, b

Thread safety issue (I think) with defaultdict

2017-10-31 Thread Israel Brewster
A question that has arisen before (for example, here: https://mail.python.org/pipermail/python-list/2010-January/565497.html ) is the question of "is defaultdict thread safe", with the answer generally being a conditional "

Re: enum

2017-10-31 Thread Cousin Stanley
ast wrote: > https://docs.python.org/3.5/library/enum.html#planet > > Documentation says that the value of the enum > members will be passed to this method. > > But in that case __init__ waits for two arguments, mass > and radius, while enum member's value is a tuple. > > It seems that there is

Re: Performance of map vs starmap.

2017-10-31 Thread Steve D'Aprano
On Mon, 30 Oct 2017 09:10 pm, Kirill Balunov wrote: > Sometime ago I asked this question at SO [1], and among the responses > received was paragraph: > > - `zip` re-uses the returned `tuple` if it has a reference count of 1 when > the `__next__` call is made. > - `map` build a new `tuple` that

Re: How to join elements at the beginning and end of the list

2017-10-31 Thread Steve D'Aprano
On Wed, 1 Nov 2017 02:29 am, Neil Cerutti wrote: > You can use the % operator instead of +, and a generator > expression instead of map. It's a pretty small improvement, > though. > > values = '||%s||' % ('||'.join(str(s) for s in value_list)) > > At least... I THINK you can use that generator e

Re: How to join elements at the beginning and end of the list

2017-10-31 Thread Ned Batchelder
On 10/31/17 12:29 PM, Stefan Ram wrote: Ned Batchelder writes: However you solve it, do yourself a favor and write a function to encapsulate it: It is always a good solution to encapsulate a pattern into a function. So I agree that this is a good suggestion. But just for the sole sake

Re: Cooperative class tree filtering

2017-10-31 Thread Alberto Berti
Thanks Ian, > "Ian" == Ian Kelly writes: Ian> On Thu, Oct 12, 2017 at 5:07 PM, Alberto Berti wrote: Ian> My initial reaction is: is this really worth it? This seems like an Ian> awful lot of code and added complexity in order to do away with two Ian> lines. It's a lot easi

Re: How to join elements at the beginning and end of the list

2017-10-31 Thread Neil Cerutti
On 2017-10-31, Stefan Ram wrote: > Neil Cerutti writes: >>You can use the % operator instead of +, and a generator >>expression instead of map. It's a pretty small improvement, >>though. > > "Improvement" in what sense? > > C:\>python -m timeit -s "value_list = [1, 2, 3, 4, 56, 's']" "values =

Re: How to join elements at the beginning and end of the list

2017-10-31 Thread Ned Batchelder
On 10/31/17 11:29 AM, Neil Cerutti wrote: On 2017-10-31, Ganesh Pal wrote: Here is my solution values = '||' + '||'.join(map(str, value_list)) + '||' values '||1||2||3||4||56||s||' I am joining the elements at the beginning and end of the list using '+' operator any other solution, this is

Re: How to join elements at the beginning and end of the list

2017-10-31 Thread Neil Cerutti
On 2017-10-31, Ganesh Pal wrote: > Here is my solution > values = '||' + '||'.join(map(str, value_list)) + '||' values > > '||1||2||3||4||56||s||' > > I am joining the elements at the beginning and end of the list > using '+' operator any other solution, this is not looking > neater > >

Re: Invoking return through a function?

2017-10-31 Thread Rhodri James
On 31/10/17 02:06, Alberto Riva wrote: Steve D'Aprano gave you a pretty full answer, I just wanted to add: The kind of statement I was trying to add would at least have made that explicit: return-if-so-and-so-happens. That's only obvious in the function that's doing the returning. The fun

How to join elements at the beginning and end of the list

2017-10-31 Thread Ganesh Pal
How to join each elements with a delimiter at (1) beginning and end of the list and (2) connecting all elements of the list Example : >>> value_list = [1, 2, 3, 4, 56, 's'] I want this to be converted in this from '||1||2||3||4||56||s||' Here is my solution >>> values = '||' + '||'.join(ma

Re: Invoking return through a function?

2017-10-31 Thread bartc
On 31/10/2017 05:32, Steve D'Aprano wrote: On Tue, 31 Oct 2017 02:34 pm, Chris Angelico wrote: No, I don't think you do understand them correctly - or at least, I don't know of any way for a C macro to jump into the middle of a function. I presume a macro could contain a call to longjmp, yes

Re: Invoking return through a function?

2017-10-31 Thread Alberto Berti
> "Lele" == Lele Gaifax writes: Lele> r...@zedat.fu-berlin.de (Stefan Ram) writes: Stefan> There are many macro processors available, like the C macro Stefan> preprocessor, gpp, M4, or funnelweb. You can always use them Stefan> for your Python source (which, in this case, isn'

enum

2017-10-31 Thread ast
Hi Below an example of enum which defines an __init__ method. https://docs.python.org/3.5/library/enum.html#planet Documentation says that the value of the enum members will be passed to this method. But in that case __init__ waits for two arguments, mass and radius, while enum member's va

Re: Invoking return through a function?

2017-10-31 Thread Chris Angelico
On Tue, Oct 31, 2017 at 4:32 PM, Steve D'Aprano wrote: > On Tue, 31 Oct 2017 02:34 pm, Chris Angelico wrote: > >> On Tue, Oct 31, 2017 at 2:00 PM, Steve D'Aprano >> wrote: >>> Python has no GOTO, fortunately, but C has at least two, GOTO and LONGJMP. >>> A C macro could, if I understand correctly