[issue17005] Add a topological sort algorithm

2020-08-26 Thread Paddy McCarthy
Paddy McCarthy added the comment: Please ignore my earlier Message-id <1598493715.04.0.06462575371.issue17...@roundup.psfhosted.org>. I missed a dependency in cutting down a larger example. Sorry. -- ___ Python tracker

[issue17005] Add a topological sort algorithm

2020-08-26 Thread Paddy McCarthy
Paddy McCarthy added the comment: I've been playing with Python 3.9.0rc1 and was looking at a particular graph to see when it released tasks for processing. I ran the following code: from functools import reduce from pprint import pprint as pp from collections import defaultdict from graphlib

[issue33235] Better help text for dict.setdefault

2018-04-06 Thread Paddy McCarthy
New submission from Paddy McCarthy <paddy3...@gmail.com>: Hi, I was answering some question and used dict.setdefault as part of the solution and posted the help() on it as part of my answer. The help was this: In [15]: help(mapper.setdefault) Help on built-in function setdefault: setd

[issue24914] Python: Not just OO style but this is not mentioned on python.org or in FAQ

2015-08-23 Thread Paddy McCarthy
Paddy McCarthy added the comment: OK, here's a suggested re-wording: Python is an interpreted, interactive, object-oriented programming language that also supports programming in procedural and functional styles. It incorporates modules, exceptions, dynamic typing, very high level dynamic

[issue24914] Python: Not just OO style but this is not mentioned on python.org or in FAQ

2015-08-22 Thread Paddy McCarthy
New submission from Paddy McCarthy: Just read http://www.ibmsystemsmag.com/ibmi/developer/general/different-world-python/?utm_campaign=ibm-enewsutm_medium=emailutm_source=ibmi-jul22-2015?utm_content=exclusive1-headline It states that they could have had an officially supported version

[issue10395] new os.path function to extract common prefix based on path components

2015-03-20 Thread Paddy McCarthy
Paddy McCarthy added the comment: Can we now: 1. Move os.path.commonprefix to str.commonprefix or string.commonprefix 2. Deprecate the use of os.path.commonprefix 3. Add os.path.commonpath 4. Update the documentation. This seems to have lingered for too long and yet people have been willing

[issue23695] idiom for clustering a data series into n-length groups

2015-03-18 Thread Paddy McCarthy
Paddy McCarthy added the comment: I like R. David Murray's suggestion, but I am also aware of how it works and so cannot judge how it would look to the intermediate Python programmer who knows iterators and zip, but is new to this grouper; (who I think should be the target audience

[issue23695] idiom for clustering a data series into n-length groups

2015-03-17 Thread Paddy McCarthy
Paddy McCarthy added the comment: Hmmm. It seems that the problem isn't to do with the fact that it works, or how to apply it; the problem is with *how* it works. Making it an idiom means that too many will use it without knowing why it works which could lead to later maintenance issues. I

[issue23695] idiom for clustering a data series into n-length groups

2015-03-17 Thread Paddy McCarthy
New submission from Paddy McCarthy: In the zip section of the documentation, e.g. https://docs.python.org/3/library/functions.html#zip There is mention of an idiom for clustering a data series into n-length groups that I seem to only come across when people are explaining how it works on blog

[issue16580] Add examples to int.to_bytres and int.from_bytes

2012-12-09 Thread Paddy McCarthy
Paddy McCarthy added the comment: On 06/12/2012 14:31, Ezio Melotti wrote: Ezio Melotti added the comment: I agree. The examples in the doc seem clear to me, whereas the ones you proposed are not as clear. Do you think there's something that they don't currently cover that should

[issue16580] Add examples to int.to_bytres and int.from_bytes

2012-12-09 Thread Paddy McCarthy
Paddy McCarthy added the comment: On 09/12/2012 10:55, Ezio Melotti wrote: Ezio Melotti added the comment: Usually we add plain Python equivalents when they are simple enough that the code equivalent is as understandable as the prose or more (see for example http://docs.python.org/3

[issue16580] Add examples to int.to_bytres and int.from_bytes

2012-11-29 Thread Paddy McCarthy
New submission from Paddy McCarthy: http://docs.python.org/3.3/library/stdtypes.html?highlight=to_bytes#int.to_bytes and http://docs.python.org/3.3/library/stdtypes.html?highlight=to_bytes#int.to_bytes would benefit from an example showing what they do based on simpler coding. I have

Re: Is their an expression to create a class?

2009-03-17 Thread Donald 'Paddy' McCarthy
Chris Rebert wrote: On Tue, Mar 17, 2009 at 2:24 PM, Robert Kern robert.k...@gmail.com wrote: On 2009-03-17 16:13, Paddy wrote: We the def statement and the lambda expression. We have the class statement, but is their an expression to create a class? Or: def F(): pass type(F) type

[issue3214] Suggest change to glossary explanation: Duck Typing

2008-07-01 Thread Paddy McCarthy
Paddy McCarthy [EMAIL PROTECTED] added the comment: Hi Georg, A bit of relevant background about me: I've been interested in Duck Typing _specifically_ for a couple of years when I started watching edits to it on Wikipedia. I researched the history of the use of the term and changed

[issue3214] Suggest change to glossary explanation: Duck Typing

2008-06-26 Thread Paddy McCarthy
New submission from Paddy McCarthy [EMAIL PROTECTED]: The official glossary entry here: http://docs.python.org/tut/node18.html#l2h-46 says: duck-typing Pythonic programming style that determines an object's type by inspection of its method or attribute signature rather than by explicit

Re: Question: How do I format printing in python

2008-06-25 Thread Donald 'Paddy' McCarthy
Lie wrote: On Jun 24, 12:12 am, [EMAIL PROTECTED] wrote: Hi All, How do I format printed data in python? I could not find this in the Python Reference Manual:http://docs.python.org/ref/print.html Nor could I find it in Matloff's great

Re: Python 2.5 adoption

2008-04-19 Thread Donald 'Paddy' McCarthy
Joseph Turian wrote: Basically, we're planning on releasing it as open-source, and don't want to alienate a large percentage of potential users. Then develop for 2.5 with an eye on what is to come this year in 2.6 with regard to already planned deprecations. - Paddy. --

pprint module and newer standard types

2008-04-18 Thread Donald 'Paddy' McCarthy
Hi, When I try and use pprint on standard types I get varying 'quality of output'. Lists will wrap nicely to multiple lines as will dicts, but sets and defaultdicts give one long unreadable line. Is their a chance to get this changed so that more built-in types look pretty when printed with

Re: alternating string replace: Extended input (Long).

2008-01-09 Thread Donald 'Paddy' McCarthy
cesco wrote: I created some more test strings and ran posters solutions against them. results attached. - Paddy. # alternating_replacements.py tests = 1 2_ 3_4 5_6_ 7_8_9 10_11_12_ 13_14_15_16 17_18_19_20_ \ _ _21 _22_ _23_24 _25_26_ _27_28_29 _30_31_32_ _33_34_35_36 \ __ ___

Re: Is Python really a scripting language?

2007-12-12 Thread Donald 'Paddy' McCarthy
Doug Morse wrote: although perhaps not a part of the definition of scripting languages per se, one aspect of them is that they are often used to glue a wide variety of other components together. perl's initial and continued success is in no small part to all the wrappers and interfaces it has

Re: EuroPython vs PyconUK

2007-04-26 Thread Donald 'Paddy' McCarthy
EuGeNe Van den Bulke wrote: I do realize that the UK is not really part of Europe (no polemic :P) but I am nevertheless curious about the logic behind creating another major Python event in Europe. Wasn't EuroPython enough? Like many I am sure, I probably won't be able to attend both (and

Re: Python not giving free memory back to the os get's me in real problems ...

2007-04-25 Thread Donald 'Paddy' McCarthy
[EMAIL PROTECTED] wrote: So I read quite a few things about this phenomenon in Python 2.4.x but I can hardly believe that there is really no solution to my problem. We use a commercial tool that has a macro functionality. These macros are written in python. So far nothing extraordinary.

Re: Where did my post go?

2007-04-25 Thread Donald 'Paddy' McCarthy
[EMAIL PROTECTED] wrote: I posted to this newsgroup earlier about my annoyances with python and now I can't find the post. What did you do with it? I notice a gmail address. Google groups was not updated for over a day and is still 'behind'. Try another news reader. - Paddy --

combining several lambda equations

2005-02-18 Thread Paddy McCarthy
Hi, I am trying to use eval as little as possible but solve this problem. #If given:two or more lambda equations x=lambda : A B y=lambda : C+6 = 7 ... How do I create another lambda expression Z equivalent to Z=lambda : (AB) and (C+6=7) # i.e. the anding together of the originals, but

Re: Choosing the right parser for parsing C headers

2005-02-08 Thread Paddy McCarthy
Jean de Largentaye wrote: Hi, I need to parse a subset of C (a header file), and generate some unit tests for the functions listed in it. I thus need to parse the code, then rewrite function calls with wrong parameters. What I call shaking the broken tree :) I chose to make my UT-generator in

Re: Is Python as capable as Perl for sysadmin work?

2005-02-08 Thread Paddy McCarthy
Jeff Epler wrote: No. Unlike Perl, Python implements only a *finite turning machine* model of computation. An easy way to see this limitation is in the following code: 1.0 / 10.0 0.10001 Snip Jeff Nice, Made my evening :-) - Pad. --

Re: variable declaration

2005-02-03 Thread Paddy McCarthy
Alexander Zatvornitskiy wrote: Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in C. It can cause very ugly errors,like this: epsilon=0 S=0 while