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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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,
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',
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
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
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
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
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
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
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
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:
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.
)
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
P.S: Python 3.2!
--
http://mail.python.org/mailman/listinfo/python-list
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
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
.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
My thanks.
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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.
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
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
- 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
).
Paddy
--
Ray, when someone asks you if you're a god, you say YES!
--
http://mail.python.org/mailman/listinfo/python-list
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?
; 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
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
(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
/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
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 to:
#
Thanks.
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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):
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
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
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
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
) 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
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
, 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
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
' % \
( 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
lies?
(For the Table, please see the blog entry).
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
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
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
, 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
/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
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
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
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
()
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
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
a much better muscle :-)
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
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
generally:
http://wiki.python.org/moin/PerlPhrasebook
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
encouraged
to adapt it to their needs.
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
.
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
when looking for weapons of mass
destruction in Iraq.
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
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
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
, 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
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
://github.com/tablatom/rubydoctest/wikis/special-directives
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
://pyxml.sourceforge.net/topics/howto/node26.html
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
'[' ... ']' brackets?
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
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
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
be faster, by avoiding the lambda:
d = collections.defaultdict(int)
d[key] += value
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
(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
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
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
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
(list_ldap) - set(list_current)
to_add
set(['hello'])
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
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 - 100 of 680 matches
Mail list logo