[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

Re: Need opinions on P vs NP

2015-04-18 Thread Paddy
On Saturday, 18 April 2015 08:09:06 UTC+1, wxjm...@gmail.com wrote: Le samedi 18 avril 2015 03:19:40 UTC+2, Paddy a écrit : Having just seen Raymond's talk on Beyond PEP-8 here: https://www.youtube.com/watch?v=wf-BqAjZb8M, it reminded me of my own recent post where I am soliciting

Re: Need opinions on P vs NP

2015-04-17 Thread Paddy
On Saturday, 18 April 2015 03:34:57 UTC+1, Ian wrote: On Fri, Apr 17, 2015 at 7:19 PM, Paddy paddy3...@..l.com wrote: Having just seen Raymond's talk on Beyond PEP-8 here: https://www.youtube.com/watch?v=wf-BqAjZb8M, it reminded me of my own recent post where I am soliciting opinions

Need opinions on P vs NP

2015-04-17 Thread Paddy
Having just seen Raymond's talk on Beyond PEP-8 here: https://www.youtube.com/watch?v=wf-BqAjZb8M, it reminded me of my own recent post where I am soliciting opinions from non-newbies on the relative Pythonicity of different versions of a routine that has non-simple array manipulations. The

[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

Re: Bug in timsort!?

2015-02-25 Thread Paddy
On Wednesday, 25 February 2015 00:08:32 UTC, Chris Angelico wrote: On Wed, Feb 25, 2015 at 10:50 AM, Skip Montanaro skip.mo...@gmail.com wrote: Even if/when we get to the point where machines can hold an array of 2**49 elements, I suspect people won't be using straight Python to wrangle

Re: Natural use of cmp= in sort

2014-11-12 Thread Paddy
On Tuesday, 11 November 2014 18:07:27 UTC, Ian wrote: The example that I posted is one that I recall being brought up on this list in the past, but I don't have a link for you. THanks Ian for your help in this. -- https://mail.python.org/mailman/listinfo/python-list

Re: Natural use of cmp= in sort

2014-11-11 Thread Paddy
On Tuesday, 11 November 2014 09:07:14 UTC, Ian wrote: On Tue, Nov 11, 2014 at 12:44 AM, Paddy paddyxxx-at-xmail.com wrote: Thanks Ian. The original author states ...and it is sure that the given inputs will give an output, i.e., the inputs will always be valid., which could be taken

Natural use of cmp= in sort

2014-11-10 Thread Paddy
Hi, I do agree with Raymond H. about the relative merits of cmp= and key= in sort/sorted, but I decided to also not let natural uses of cmp= pass silently. In answering this question,

Re: Natural use of cmp= in sort

2014-11-10 Thread Paddy
On Monday, 10 November 2014 19:44:39 UTC, Ian wrote: On Mon, Nov 10, 2014 at 12:19 PM, Peter Otten xxx@yyy wrote: I'm not sure this works. I tried: Here's a simpler failure case. ineq = f2 f3 ... f3 f1 [Previously posted code elided] greater_thans set([('f3', 'f1'), ('f2',

Re: Natural use of cmp= in sort

2014-11-10 Thread Paddy
On Monday, 10 November 2014 18:45:15 UTC, Paddy wrote: Hi, I do agree with Raymond H. about the relative merits of cmp= and key= in sort/sorted, but I decided to also not let natural uses of cmp= pass silently

Re: Natural use of cmp= in sort

2014-11-10 Thread Paddy
On Tuesday, 11 November 2014 06:37:18 UTC, Ian wrote: On Mon, Nov 10, 2014 at 8:09 PM, Paddy paddyxxx-at-xmail.com wrote: On Monday, 10 November 2014 18:45:15 UTC, Paddy wrote: Hi, I do agree with Raymond H. about

[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

Python 3.X: nonlocal support in eval/exec?

2011-08-11 Thread Paddy
is that there seems to be no support for nonlocal in eval/exec (unless, trivially, nonlocal==global). - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.X: nonlocal support in eval/exec?

2011-08-11 Thread Paddy
On Aug 11, 8:48 am, Terry Reedy tjre...@udel.edu wrote: On 8/11/2011 3:19 AM, Paddy wrote: We can access nonlocal variables in a function, but if we were to eval/ exec the function we cannot set up a nested stack of evironment dicts. We are limited to just two: global and local. Right

Re: Testing for performance regressions

2011-04-04 Thread Paddy
In an extended case when you try and capture how a function works over a range of inputs, you might want to not assume some relationship between input size and time, as this mnight limit your ability to change algorithms and still have acceptable performance. I.e. instead of this:

Re: Guido rethinking removal of cmp from sort method

2011-04-04 Thread Paddy
On Tuesday, April 5, 2011 2:16:07 AM UTC+1, harrismh777 wrote: Steven D'Aprano wrote: I prefer to consider Python 2.7 and Python 3.x as different dialects of the same language. There are a very few handful of incompatibilities, most of which can be automatically resolved by the 2to3 fixers.

functools.partial doesn't work without using named parameter

2011-03-25 Thread Paddy
) TypeError: fs() got multiple values for keyword argument 'f' # BUT fsf1(s=s) [0, 2, 4, 6] Would someone help? - Thanks in advance, Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: functools.partial doesn't work without using named parameter

2011-03-25 Thread Paddy
P.S: Python 3.2! -- http://mail.python.org/mailman/listinfo/python-list

Re: functools.partial doesn't work without using named parameter

2011-03-25 Thread Paddy
Thanks Ian, Benjamin, and Steven. I now know why it works as it does. Thinking about it a little more, Is it reasonable to *expect* partial acts as it does, rather than this way being an implementation convenience? (That was written as a straight question not in any way as a dig). I had

Re: functools.partial doesn't work without using named parameter

2011-03-25 Thread Paddy
Aha! Thanks Ian for this new snippet. It is what I will use for my current example. (But please see my third posting on this too). -- http://mail.python.org/mailman/listinfo/python-list

Whats new in Python 3: concurrent-futures example error?

2011-02-22 Thread Paddy
.txt', 'dest2.txt') e.submit(shutil.copy, 'src3.txt', 'dest3.txt') e.submit(shutil.copy, 'src3.txt', 'dest4.txt') Should the last line show a copy of src4.txt rather than src3.txt going to dest4.txt? - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Whats new in Python 3: concurrent-futures example error?

2011-02-22 Thread Paddy
My thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: EXOR or symmetric difference for the Counter class

2010-08-17 Thread Paddy
On 17 Aug, 02:29, Raymond Hettinger pyt...@rcn.com wrote: [Paddy] Lets say you have two *sets* of integers representing two near-copies of some system, then a measure of their difference could be calculated as: len(X.symmetric_difference(Y)) / (len(X) + len(Y)) * 100 % If the two

Re: EXOR or symmetric difference for the Counter class

2010-08-17 Thread Paddy
On Aug 17, 10:47 pm, Paddy paddy3...@googlemail.com wrote: On 17 Aug, 02:29, Raymond Hettinger pyt...@rcn.com wrote: [Paddy] Lets say you have two *sets* of integers representing two near-copies of some system, then a measure of their difference could be calculated as: len

Re: EXOR or symmetric difference for the Counter class

2010-08-17 Thread Paddy
On Aug 17, 2:29 am, Raymond Hettinger pyt...@rcn.com wrote: I would like to see someone post a subclass to the ASPN Cookbook that adds a number of interesting, though not common operations.  Your symmetric_difference() method could be one.  A dot_product() operation could be another.  

Re: EXOR or symmetric difference for the Counter class

2010-08-16 Thread Paddy
On 14 Aug, 18:14, Raymond Hettinger pyt...@rcn.com wrote: On Aug 12, 1:20 pm, Paddy paddy3...@googlemail.com wrote: I find myself needing to calculate the difference between two Counters or multisets or bags. I want those items that are unique to each bag. Tell us about your use cases

Re: EXOR or symmetric difference for the Counter class

2010-08-13 Thread Paddy
On Aug 13, 6:36 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Thu, 12 Aug 2010 13:20:19 -0700, Paddy wrote: I find myself needing to calculate the difference between two Counters or multisets or bags. Is this collections.Counter from Python 3.1? If so, you should say

EXOR or symmetric difference for the Counter class

2010-08-12 Thread Paddy
- b) Counter({'a': 2}) diff Counter({'a': 2, 'b': 1}) But thought why doesn't this operation appear already as a method of the class? - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Accessing a method from within its own code

2009-11-02 Thread Paddy O'Loughlin
). Paddy -- Ray, when someone asks you if you're a god, you say YES! -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing a method from within its own code

2009-11-02 Thread Paddy O'Loughlin
I suspect that the inspection module has your answer, but that it'll be bulkier, and much slower than just doing what you're doing already. Hmm. Yeah, it does appear to be bulky. I don't think it's really any more use than what I'm doing already. Why not use the default arguments gimmick?

Rosetta Code: request for help

2009-06-20 Thread Paddy
; or could do with an example translated to Python 3.x if it would change a lot from 2.x etc. Please take a look, I know I know I enjoy being involved. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: sorted() erraticly fails to sort string numbers

2009-04-30 Thread Paddy O'Loughlin
out by uuid, container is not list-like (at least as far as the sort() method goes). :) Paddy -- Ray, when someone asks you if you're a god, you say YES! -- http://mail.python.org/mailman/listinfo/python-list

Reading an exact number of characters from input

2009-04-16 Thread Paddy O'Loughlin
(and doesn't return) until I press Enter. My initial thoughts are that a function like C's fgetc would be the easiest way to do it, but I haven't been able to find an equivalent in my google search, so I was wondering if anyone here might have some ideas. What say you? Paddy -- Ray, when

Introducing Python to others

2009-03-26 Thread Paddy O'Loughlin
/most used), or something else? Any other suggestions for a possible wow reaction from an audience like that? Thanks, Paddy -- Ray, when someone asks you if you're a god, you say YES! -- http://mail.python.org/mailman/listinfo/python-list

Re: Introducing Python to others

2009-03-26 Thread Paddy O'Loughlin
Thanks for all your replies. A lot of very strong answers :) 2009/3/26 Mensanator mensana...@aol.com: What would you have to do to make this work? x+x+x      # expecting [3,6] [2, 4, 1, 2] What's happening is that the call to map() is returning a list object. So after it calculates the first

Is their an expression to create a class?

2009-03-17 Thread Paddy
' # is to: # Thanks. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

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

Re: Run a python script as an exe and run a new process from it

2009-02-27 Thread Paddy O'Loughlin
2009/2/27 venutaurus...@gmail.com venutaurus...@gmail.com: Thanks for the reply,,            I am trying to use the above application using psexec()in command line.But it failed returning the error message  exited with error code 255.              But when I ran the application normally it

Re: Run a python script as an exe and run a new process from it

2009-02-26 Thread Paddy O'Loughlin
Try this as an outline: script1.py from subprocess import Popen if __name__ == '__main__': scriptname = script2.py Popen(python %s % scriptname, shell=True) print I'm done script2.py from time import sleep if __name__ == '__main__': while (True):

Re: Byte type?

2009-02-24 Thread Paddy O'Loughlin
sure is not the case. There are people are spending lots of personal, unpaid and voluntary time developing Python. Paddy -- Ray, when someone asks you if you're a god, you say YES! -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I declare global vars or class vars in Python ?

2009-02-20 Thread Paddy O'Loughlin
2009/2/20 Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid: Note that while you *can* do direct access to the implementation attribute (here, '_A' for property 'A'), you don't *need* to so (and usually shouldn't - unless you have a very compelling reason). Interesting. Why

Re: How do I declare global vars or class vars in Python ?

2009-02-20 Thread Paddy O'Loughlin
a GoldenRule or to advise against its overuse. You use it when its appropriate and don't use it when you it's not, like any other feature. Paddy -- Ray, when someone asks you if you're a god, you say YES! -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I declare global vars or class vars in Python ?

2009-02-20 Thread Paddy O'Loughlin
is why I asked for an explanation. Your explanation seems to show that your tone was likely to be more personal bias than any real issue with properties. Paddy -- Ray, when someone asks you if you're a god, you say YES! -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I declare global vars or class vars in Python ?

2009-02-17 Thread Paddy O'Loughlin
) in python. Paddy 2009/2/17 Linuxguy123 linuxguy...@gmail.com: How do I do this in Python ? # declare A,B function getA return A function getB return B function setA(value) A = value function setB(value) B = value main() getA getB

Re: How do I declare global vars or class vars in Python ?

2009-02-17 Thread Paddy O'Loughlin
initialised in the module. Of course, if you try to call that function before the global has been initialised, python will complain [and rightly so :)] Paddy -- Ray, when someone asks you if you're a god, you say YES! -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic way to determine if a string is a number

2009-02-17 Thread Paddy O'Loughlin
, the most concise, and the most readable solution. Of course, if you want to use your own set of rules for number encoding, then building your own regular expression would seem to be the right way to go. Paddy -- Ray, when someone asks you if you're a god, you say YES! -- http://mail.python.org

Re: Will multithreading make python less popular?

2009-02-16 Thread Paddy
underlying algorithm. I was just exploring different ways of solving a problem on my blog: http://paddy3118.blogspot.com/2009/02/comparison-of-python-solutions-to.html (But no parallel solutions were attempted). Have fun programming! - Paddy. -- http://mail.python.org/mailman/listinfo/python

Re: Pythonic way to determine if a string is a number

2009-02-16 Thread Paddy
' % \           ( test.strip(), isnumber( test ) ) /code Their is a good answer given on Rosetta Code here: http://www.rosettacode.org/wiki/IsNumeric#Python - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Python Fractions issue.

2008-09-22 Thread Paddy
lies? (For the Table, please see the blog entry). - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes: loading .so file on Linux

2008-08-26 Thread Paddy
On Aug 23, 2:33 pm, Paddy [EMAIL PROTECTED] wrote: Hi, I am am falling at the first hurdle when trying to access a library using ctypes. I have a file libucdb.so which the file command says is shared object, but I cannot get it to load: Any help would be appreciated: dmccarthy: file /opt

Re: Psyco == tracing optimization?

2008-08-24 Thread Paddy
for that? /F I too feel that if Perl had such optimizations as Psyco gives Python then they would shout about it. I wonder about the new term and if it fits in the same 'box' as what Psyco does, for example, who was aware of whose work? - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Regex on a huge text

2008-08-24 Thread Paddy
, if you were looking for consecutive SPAM records with the same Name field then you might first extract only the SPAM records from the gigabytes to leave something more manageable to search for consecutive Name fields in. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

ctypes: loading .so file on Linux

2008-08-23 Thread Paddy
/questasim/linux/libucdb.so: cannot open shared o= bject file: No such file or directory ^[[A File stdin, line 1 ^ SyntaxError: invalid syntax - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Psyco == tracing optimization?

2008-08-22 Thread Paddy
Just wondered if this: http://arstechnica.com/news.ars/post/20080822-firefox-to-get-massive-javascript-performance-boost.html, is a new name for what is done by Psyco? - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Should Python raise a warning for mutable default arguments?

2008-08-22 Thread Paddy
of unexpected consequences ;) Peter +1 on this. It seems an obvious think to add to a lint-like tool rather than burdening core Python. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python one-liner??

2008-08-22 Thread Paddy
the bash shell on Unix (as bash supports multi-line quotes), but creating and then deleting a temporary file saves me from 'quoting hell'. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Validation of parameters

2008-08-10 Thread Paddy
() File pyshell#3, line 3, in __init__ self._foo AttributeError: 'tmp' object has no attribute '_foo' - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: What Python looks like

2008-08-05 Thread Paddy
or useful ways. I've learnt A LISP-like language, dabbled with forth prolog constraints - maybe its time to learn J and find out if this array programming malarky will bring new insight to my problem solving - but it will never be readable :-) - Paddy. -- http://mail.python.org/mailman/listinfo

Re: Native Code vs. Python code for modules

2008-07-30 Thread Paddy
a much better muscle :-) - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing VHDL with python, where to start.

2008-07-29 Thread Paddy
type information could be mixed in with the architecture. Luckily work had also decided to by in a commercial parser. I learned that add-hoc parsers have limits to their maintainability and become complex. You might not have such problems if your VHDL is all in one library. - Paddy. -- http

Re: Doubt

2008-07-23 Thread Paddy
generally: http://wiki.python.org/moin/PerlPhrasebook - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: software engineering foundations?

2008-07-22 Thread Paddy
encouraged to adapt it to their needs. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bidirectional Generators

2008-07-22 Thread Paddy
. Surely some other people have worked with this feature... Are there any pages that discuss how it's been useful? No, I don't want to see an implementation of coroutines. I get that one already. :-) -Wm What's one of them then? - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question

2008-07-20 Thread Paddy
when looking for weapons of mass destruction in Iraq. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: question

2008-07-20 Thread Paddy
On Jul 20, 6:39 pm, [EMAIL PROTECTED] wrote: Nobody any sensible answers. Too complicated I suppose! The sensible question was? -- http://mail.python.org/mailman/listinfo/python-list

Re: singletons

2008-07-18 Thread Paddy
for a general background on Design Patters in Python: http://uk.youtube.com/watch?v=0vJJlVBVTFg - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: read file into list of lists

2008-07-11 Thread Paddy
I make the print statement list[0] [0], that the word pear appears pear noun singular books nouns plural table noun singular Can someone help me? Thanks lofl = [line.strip().split() for line in the_opened_file] - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: read file into list of lists

2008-07-11 Thread Paddy
On Jul 11, 9:32 pm, John Machin [EMAIL PROTECTED] wrote: On Jul 11, 11:35 pm, Paddy [EMAIL PROTECTED] wrote: On Jul 11, 2:15 pm, antar2 [EMAIL PROTECTED] wrote: Hello, I can not find out how to read a file into a list of lists. I know how to split a text into a list sentences

Re: re.search much slower then grep on some regular expressions

2008-07-05 Thread Paddy
On Jul 5, 7:01 am, Peter Otten [EMAIL PROTECTED] wrote: Paddy wrote: It is not a smarter algorithm that is used in grep. Python RE's have more capabilities than grep RE's which need a slower, more complex algorithm. So you're saying the Python algo is alternatively gifted... Peter

Re: re.search much slower then grep on some regular expressions

2008-07-05 Thread Paddy
On Jul 5, 4:13 pm, Mark Dickinson [EMAIL PROTECTED] wrote: It seems like an appropriate moment to point out *this* paper: http://swtch.com/~rsc/regexp/regexp1.html That's the one! Thanks Mark. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: re.search much slower then grep on some regular expressions

2008-07-04 Thread Paddy
capabilities than grep RE's which need a slower, more complex algorithm. You could argue that if the costly RE features are not used then maybe simpler, faster algorithms should be automatically swapped in but - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting sorting order

2008-07-02 Thread Paddy
- Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting two dimentional array by column?

2008-07-02 Thread Paddy
out of the dictionary. Thanks ** Posted fromhttp://www.teranews.com** Hi Tobiah, Try this: arrayofdicts.sort( key = lambda dictinarray: dictinarray.get(sortkeyname) ) - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

[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

Propose slight change to tutorial glossary entry on Duck Typing

2008-06-25 Thread Paddy
the attribute that will find that out so it is redundant. Best to use EAFP for Duck typing as we trust you know what it is you are doing. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question: How do I format printing in python

2008-06-25 Thread Donald 'Paddy' McCarthy
, and data sequence may be tuple or list. Dictionary may also be used for data, but it has its own way to specify string formatting since dictionary is unordered but indexed by the dict key. I have attached a prog I wrote to answer someones elses similar problem. - Paddy. from StringIO import

Re: Is there any way to find out sizeof an object

2008-06-24 Thread Paddy
        self.args = args         self.kwds = kwds Thanks, Srini       Bollywood, fun, friendship, sports and more. You name it, we have it onhttp://in.promos.yahoo.com/groups/bestofyahoo/ Check memory Create a million Check memory Do maths! ;-) - Paddy. -- http://mail.python.org/mailman

Ruby doctest

2008-06-22 Thread Paddy
://github.com/tablatom/rubydoctest/wikis/special-directives - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: ISO dict = xml converter

2008-06-20 Thread Paddy
://pyxml.sourceforge.net/topics/howto/node26.html - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pattern Matching Over Python Lists

2008-06-19 Thread Paddy
'[' ... ']' brackets? - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Mapping None. Why?

2008-06-13 Thread Paddy
On Jun 13, 12:49 pm, David C. Ullrich [EMAIL PROTECTED] wrote: On Thu, 12 Jun 2008 12:05:02 -0700 (PDT), Paddy [EMAIL PROTECTED] wrote: Iam wondering why the peculiar behavior of map when the function in given as None: If you start with a value x and then apply no function at all

Re: Summing a 2D list

2008-06-13 Thread Paddy
against the defaultdict solution of: d = collections.defaultdict(int) for u,s in zip(users,score): d[u] += s - Paddy -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting things fast - was Re: Summing a 2D list

2008-06-12 Thread Paddy
be faster, by avoiding the lambda: d = collections.defaultdict(int) d[key] += value - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Mapping None. Why?

2008-06-12 Thread Paddy
(None, l1,l2,l3) True On looking up map on Wikipedia there is no mention of this special behaviour, So my question is why? Thanks, Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Mapping None. Why?

2008-06-12 Thread Paddy
that impression. I don't think that map should be like what Wikipedia says, I was just looking for another example of an implementation that might mention the behaviour. I just want to know the thoughts behind this behaviour in the Python map. - Paddy. -- http://mail.python.org/mailman/listinfo

Re: Mapping None. Why?

2008-06-12 Thread Paddy
On Jun 12, 9:48 pm, Robert Kern [EMAIL PROTECTED] wrote: Paddy wrote: On looking up map on Wikipedia there is no mention of this special behaviour, So my question is why? My question is why you are looking up the semantics of Python functions on Wikipedia instead of the Python

Re: Mapping None. Why?

2008-06-12 Thread Paddy
On Jun 12, 9:36 pm, Terry Reedy [EMAIL PROTECTED] wrote: Paddy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | | Iam wondering why the peculiar behavior of map when the function in | given as None: The 'peculiar behavior' is the same as zip (except for padding short iterators

Re: value is in list?

2008-06-12 Thread Paddy
(list_ldap) - set(list_current) to_add set(['hello']) - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Q re documentation Python style

2008-06-08 Thread Paddy
essentials in the function itself. This would leave the def nearer the body of the function, but I don't know of anyone else that does this. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   >