Hello guys,
While working at a dispatcher using
multiprocessing.connection.Listener module I've stumbled upon some
sortof magic trick that amazed me. How is this possible and
what does multiprocessing library doing in background for this to
work?
Client, Python 2.6
rusi writes:
> So I tried:
> Recast the comprehension as a map
> Rewrite the map into a fmap (functionalmap) to create new bindings
>
> def fmap(f,lst):
> if not lst: return []
> return [f(lst[0])] + fmap(f, lst[1:])
>
> Still the same effects.
>
> Obviously I am changing it at the wron
On Fri, 03 Jun 2011 14:35:52 +1000, Chris Angelico wrote:
> On Fri, Jun 3, 2011 at 2:23 PM, Steven D'Aprano
> wrote:
>>> You can't get a valid result from data produced by an invalid
>>> computation. Garbage in, garbage out.
>>
>> Of course you can. Here's a trivial example:
>>
>> def f(x):
>>
On Fri, Jun 3, 2011 at 2:23 PM, Steven D'Aprano
wrote:
>> You can't get a valid result from data produced by an invalid
>> computation. Garbage in, garbage out.
>
> Of course you can. Here's a trivial example:
>
> def f(x):
> return 1
>
If your incoming x is garbage, your outgoing 1 is also ga
>In article ,
> Chris Torek wrote:
>> Python might be penalized by its use of Unicode here, since a
>> Boyer-Moore table for a full 16-bit Unicode string would need
>> 65536 entries (one per possible ord() value).
In article
Roy Smith wrote:
>I'm not sure what you mean by "full 16-bit Unicode
On Fri, 03 Jun 2011 11:17:17 +1200, Gregory Ewing wrote:
> Steven D'Aprano wrote:
>
>> def kronecker(x, y):
>> if x == y: return 1
>> return 0
>>
>> This will correctly consume NAN arguments. If either x or y is a NAN,
>> it will return 0.
>
> I'm far from convinced that this result is
Terry,
return math.sqrt(sum([h*i*i for i,h in enumerate(histogram)]) / self.Area())
Ran at the same speed as my 'fast' version and without the square brackets was
slower.
Thanks,
Keir
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Jun 3, 2011 at 1:52 PM, Chris Angelico wrote:
> However, Unicode planes 0-2 have all
> the defined printable characters
PS. I'm fully aware that there are ranges defined in page 14 / E.
They're non-printing characters, and unlikely to be part of a text
string, although it is possible. So
On Fri, Jun 3, 2011 at 1:44 PM, Roy Smith wrote:
> In article ,
> Chris Torek wrote:
>
>> Python might be penalized by its use of Unicode here, since a
>> Boyer-Moore table for a full 16-bit Unicode string would need
>> 65536 entries (one per possible ord() value).
>
> I'm not sure what you mean
In article ,
Chris Torek wrote:
> Python might be penalized by its use of Unicode here, since a
> Boyer-Moore table for a full 16-bit Unicode string would need
> 65536 entries (one per possible ord() value).
I'm not sure what you mean by "full 16-bit Unicode string"? Isn't
unicode inherently
>In article <94ph22frh...@mid.individual.net>
> Neil Cerutti wrote:
>> Python's str methods, when they're sufficent, are usually more
>> efficient.
In article
Roy Smith replied:
>I was all set to say, "prove it!" when I decided to try an experiment.
>Much to my surprise, for at least one com
After copious headscratching I took Ned's advice and went for 3.2
which includes built-in interactive arrow key support. To any Mac OSX
readers, save yourself the trouble and don't even try Python 3.1.3.
-- Gnarlie
http://Gnarlodious.com
--
http://mail.python.org/mailman/listinfo/python-list
On 03/06/2011 02:57, Roy Smith wrote:
In article<94ph22frh...@mid.individual.net>,
Neil Cerutti wrote:
On 2011-06-01, ru...@yahoo.com wrote:
For some odd reason (perhaps because they are used a lot in
Perl), this groups seems to have a great aversion to regular
expressions. Too bad because
On Jun 3, 4:43 am, Gregory Ewing wrote:
> Alain Ketterlin wrote:
> > But going against generally accepted semantics should at least
> > be clearly indicated. Lambda is one of the oldest computing abstraction,
> > and they are at the core of any functional programming language.
>
> Yes, and Python'
In article <94ph22frh...@mid.individual.net>,
Neil Cerutti wrote:
> On 2011-06-01, ru...@yahoo.com wrote:
> > For some odd reason (perhaps because they are used a lot in
> > Perl), this groups seems to have a great aversion to regular
> > expressions. Too bad because this is a typical problem w
Thanks for the fast responses.
Tim, you're right I did have my lambda parameters the wrong way round.
Fixing up the order had no effect on the speed (platform is x64 win7).
Ian, I was basing my code off Fredrik Lundh post on comparing images.
http://effbot.org/zone/pil-comparing-images.htm
Terry
On Thu, Jun 2, 2011 at 4:38 PM, Tim Delaney wrote:
> First of all, do you have the parameters to the lambda the wrong way around
> in the map() version? zip(histogram, range(255)) will return (histogram
> value, index), but enumerate(histogram) will return (index, histogram
> value). But the param
Alain Ketterlin wrote:
But going against generally accepted semantics should at least
be clearly indicated. Lambda is one of the oldest computing abstraction,
and they are at the core of any functional programming language.
Yes, and Python's lambdas behave exactly the *same* way as
every other
ANNOUNCING:
PDFTron PDFNet SDK v.5.7. - A Python Extension Package for all types
of PDF processing including rendering, conversion, editing, and
creation.
WHAT IT IS:
PDFNet SDK is an amazingly comprehensive, high-quality PDF developer
toolkit for working with PDF files at all levels. Using the
Steven D'Aprano wrote:
def kronecker(x, y):
if x == y: return 1
return 0
This will correctly consume NAN arguments. If either x or y is a NAN, it
will return 0.
I'm far from convinced that this result is "correct". For one
thing, the Kronecker delta is defined on integers, not reals,
On Thu, Jun 2, 2011 at 3:26 PM, Algis Kabaila wrote:
> import math
>
> length = math.hypot(z, math.hypot(x, y))
>
> One line and fast.
The dimension is arbitrary, though, so:
length = reduce(math.hypot, self._coords, 0)
Cheers,
Ian
--
http://mail.python.org/mailman/listinfo/python-list
Nick Buchholz wrote:
First thanks to all who replied. FYI the classes in the file have been working in various
environments since I wrote them in python1.3 and updated them to python 2.x in 2005.
I think I solved the problem, well not solved in that I don't know why the
technique I used failed
On 6/2/2011 6:07 PM, Keir Rice wrote:
Hi All,
The following function was showing up in my profiles as a large bottle neck:
# Slow version
def RMSBand(self, histogram):
"""Calculates the root-mean-squared value for the given colour stream
histogram."""
intermediateResult = map(l
I'm making the presumption that you are using Python 2.x in my notes.
On Thu, Jun 2, 2011 at 3:07 PM, Keir Rice wrote:
> Hi All,
>
> The following function was showing up in my profiles as a large bottle
> neck:
>
> # Slow version
> def RMSBand(self, histogram):
>"""Calculates the root-m
On 3 June 2011 08:07, Keir Rice wrote:
> Hi All,
>
> The following function was showing up in my profiles as a large bottle
> neck:
>
> # Slow version
> def RMSBand(self, histogram):
>"""Calculates the root-mean-squared value for the given colour
> stream histogram."""
>intermedia
In article
<272336f2-5fab-4792-af83-1a95f7835...@glegroupsg2000goo.googlegroups.com
>,
Saul Spatz wrote:
> The documentation refers to the Demo directory in the source. I've
> downloaded the source tarball for python 3.2 and there's no such directory.
> I downloaded the source for python 2.7
Hi All,
The following function was showing up in my profiles as a large bottle neck:
# Slow version
def RMSBand(self, histogram):
"""Calculates the root-mean-squared value for the given colour stream
histogram."""
intermediateResult = map(lambda (i, h): h*(i**2), zip(histogram,
On Thu, 02 Jun 2011 09:18:18 -0700
"Nick Buchholz" wrote:
>Hi all,
>I've been wandering through the DOCs for an hour and haven't found a
> solution to this
>I'm just starting to convert from 2.5 to 3.2 and I have a problem. I have a
>code that looks like this.
>
...code removed
>
First th
The documentation refers to the Demo directory in the source. I've downloaded
the source tarball for python 3.2 and there's no such directory. I downloaded
the source for python 2.7 to check, and the Demo directory is present. Has the
directory been moved, renamed or eliminated in 3.2? Thank
Are you writing a command line interpreter (even if a partial one)? If so take
a look at : http://docs.python.org/library/cmd.html
Ramit
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
This communication
On Monday 30 May 2011 23:38:53 Gabriel wrote:
> Thanks a lot to both of you, Chris & Peter!
>
> (I knew the solution would be simple ... ;-) )
import math
length = math.hypot(z, math.hypot(x, y))
One line and fast.
OldAl.
--
Algis
http://akabaila.pcug.org.au/StructuralAnalysis.pdf
--
http://
With this code:
#!/usr/bin/env python
from processing import Pool, Process, Manager, Lock
import sys
def slow_operation(i, q, lk):
print "id: ", i
# some really slow operation...
print "qcquiring lock..."
try:
lk.acquire(blocking=True)
q.put("result")
lk.
Billy Mays wrote:
> I read this when it was on HN the other day, but I still don't see what
> is special about super(). It seems (from your post) to just be a stand
> in for the super class name? Is there something special I missed?
>
Consider any diamond hierarchy:
class Base(object): pass
Greetings,
We develop on Ubuntu/Macs and deploy RPMs to CentOS (this is the settings,
can't be changed much).
The problem is that when installing from the rpm, the packages go to
/usr/local/lib/python2.7/dist-packages (which is the right location for
Ubuntu). However the default python path in
On Thu, 02 Jun 2011 09:54:30 +, Steven D'Aprano wrote:
>> Exceptions allow you to write more natural code by ignoring the awkward
>> cases. E.g. writing "x * y + z" rather than first determining whether "x
>> * y" is even defined then using a conditional.
>
> You've quoted me out of context.
Nick Buchholz wrote:
Hi all,
I've been wandering through the DOCs for an hour and haven't found a
solution to this
I'm just starting to convert from 2.5 to 3.2 and I have a problem. I have a
code that looks like this.
I just ran the posted code in both 2.5 and 3.2 and experienced no
prob
On 6/2/2011 7:00 AM, Alain Ketterlin wrote:
Nowhere. But going against generally accepted semantics should at least
be clearly indicated. Lambda is one of the oldest computing abstraction,
and they are at the core of any functional programming language. Adding
a quick hack to python and call it
http://cutehotestgirls.blogspot.com/
http://cutehotestgirls.blogspot.com/
http://cutehotestgirls.blogspot.com/
http://cutehotestgirls.blogspot.com/
http://cutehotestgirls.blogspot.com/
http://cutehotestgirls.blogspot.com/
http://cutehotestgirls.blogspot.com/
http://cutehotestgirls.blogspot.com/
htt
On 02/06/2011 17:18, Nick Buchholz wrote:
Hi all,
I've been wandering through the DOCs for an hour and haven't found a
solution to this
I'm just starting to convert from 2.5 to 3.2 and I have a problem. I have a
code that looks like this.
from tkinter import *
import time
import datetime
On 6/2/2011 12:18 PM, Nick Buchholz wrote:
Hi all,
I've been wandering through the DOCs for an hour and haven't found a
solution to this
I'm just starting to convert from 2.5 to 3.2 and I have a problem. I have a
code that looks like this.
from tkinter import *
import time
import datetim
Hi all,
I've been wandering through the DOCs for an hour and haven't found a
solution to this
I'm just starting to convert from 2.5 to 3.2 and I have a problem. I have a
code that looks like this.
from tkinter import *
import time
import datetime
import string
import math
import random
pri
On Thu, Jun 2, 2011 at 11:22 AM, Steven D'Aprano
wrote:
> It seems to me that early binding is less flexible than late, because
> with late binding you have a chance to simulate early binding by saving a
> reference of the variable elsewhere, such as in a default value, or an
> instance attribute.
On Jun 2, 5:19 pm, Martin Brochhaus
wrote:
> Why do you need to do this with python? Why not output the SQL data as a .cvs
> and open that file in Excel. The user can then adjust column widths as he
> likes.
>
> If it has to be done programatically, you might want to start your journey
> here:h
On Thu, 02 Jun 2011 10:55:49 -0500, harrismh777 wrote:
> Steven D'Aprano wrote:
>> What do you expect this code to do?
>>
>> a = 42
>> funcs = [(lambda x: x+a) for i in range(10)] funcs[0](1)
>
> I do see your point with this... truly... but it did get me to think
> about what I *do* expect..
On Thu, Jun 2, 2011 at 4:47 AM, loial wrote:
> Unfortunately using jpython or json are not options at the moment
How about JPype? Or do the Java and Python need to be in separate processes?
--
http://mail.python.org/mailman/listinfo/python-list
On 6/2/11 8:05 AM, Grant Edwards wrote:
Two of my perennial complaints about Python's handling of NaNs and
Infs:
1) They weren't handle by pickle et al.
2) The string representations produced by repr() and accepted by
float() weren't standardized across platforms.
I think the latter
On Jun 2, 8:48 pm, Martin Brochhaus
wrote:
> I can only guess.
>
> 1) You can delete "import helper" as that is never used in the code and would
> raise another "no module" exception.
>
> 2) You can delete "import settings" and just insert some integers further
> down where it is used (settings.
Terry Reedy wrote:
Oh the irony of this proposal. You scolded us for breaking code with 2
to 3 changes, and here you propose a change more radical than anything
done in Python 3, and certain to break code, introduce bugs, complicate
the language, and reduce its functionality. Most of Guido's desi
Steven D'Aprano wrote:
What do you expect this code to do?
a = 42
funcs = [(lambda x: x+a) for i in range(10)]
funcs[0](1)
I do see your point with this... truly... but it did get me to think
about what I *do* expect... and that is that 'a' (for the lambda) will
be whatever 'a' is (now) a
I can only guess.
1) You can delete "import helper" as that is never used in the code and would
raise another "no module" exception.
2) You can delete "import settings" and just insert some integers further down
where it is used (settings.width and settings.height)
OR
- you can make the fol
Steven D'Aprano wrote:
funcs = [(lambda x, i=j: x+i) for j in range(10)]
Now the reader is no longer distracted by the "i=i" ugliness.
That's a good idea, in fact, change made!
The problem with Do What I Mean is that it so rarely Does What You Mean.
At best it Does What Some Other Guy Ima
Hello all,
I'm a newbie to Python and its my 2nd day exploring it.
I was trying to use Python wrapper for Google Charts API and was
tweaking the examples.
https://github.com/gak/pygooglechart/raw/master/examples/pie.py
This is the script which I was trying.
And the python interpreter gives the
On Thu, 02 Jun 2011 21:22:40 +0800, TheSaint wrote:
> Hello
> I studying some way to print few line in the console that won't scroll
> down. If was for a single line I've some idea, but several line it may
> take some vertical tab and find the original first position. I don't
> know anything about
Hello
I studying some way to print few line in the console that won't scroll down.
If was for a single line I've some idea, but several line it may take some
vertical tab and find the original first position.
I don't know anything about course module, some example will be highly
apreciated.
--
On 2011-06-01, ru...@yahoo.com wrote:
> For some odd reason (perhaps because they are used a lot in
> Perl), this groups seems to have a great aversion to regular
> expressions. Too bad because this is a typical problem where
> their use is the best solution.
Python's str methods, when they're su
On Jun 2, 6:46 am, Adam Tauno Williams wrote:
> On Wed, 2011-06-01 at 19:49 -0700, Uncle Ben wrote:
> > Shelving is a wonderfully simple way to get keyed access to a store of
> > items. I'd like to maintain this cache though.
>
> +1
>
> > Is there any way to remove a shelved key once it is hashed
On 2011-06-02, Steven D'Aprano wrote:
> But IEEE-754 is not just a "not-very-good" standard. It is an
> extremely good standard.
I get the distinct impression that the people arguing that IEEE-754 is
somehow "wrong" about the value of 'NaN == NaN' are the people who
don't actually use floating p
Alain Ketterlin writes:
> Steven D'Aprano writes:
> > I agree it's not intuitive. But where does it say that programming
> > language semantics must always be intuitive?
>
> Nowhere. But going against generally accepted semantics should at
> least be clearly indicated. Lambda is one of the oldest
Why do you need to do this with python? Why not output the SQL data as a .cvs
and open that file in Excel. The user can then adjust column widths as he likes.
If it has to be done programatically, you might want to start your journey
here:
http://www.python-excel.org/
Best regards,
Martin
--
Please let me know how can i import my sql data of multiple rows and
columns into an excel sheet.
here i need to adjust the column width based on the on the data that
sits into the column
--
http://mail.python.org/mailman/listinfo/python-list
On Wednesday 2011 June 01 10:34, John Nagle wrote:
> I have a program which uses "feedparser". It occasionally hangs when
> the network connection has been lost, and remains hung after the network
> connection is restored.
My solution is to download the feed file using wget, then hand that file t
On Wed, 2011-06-01 at 19:49 -0700, Uncle Ben wrote:
> Shelving is a wonderfully simple way to get keyed access to a store of
> items. I'd like to maintain this cache though.
+1
> Is there any way to remove a shelved key once it is hashed into the
> system? I could do it manually by removing the
On Thu, Jun 2, 2011 at 3:47 AM, loial wrote:
> Unfortunately using jpython or json are not options at the moment
What rules out JSON that does not also rule out the "just passing
strings" approach?
What about (*shudder*) XML? (Can't believe I just said that...)
Cheers,
Chris
--
http://mail.pyt
Steven D'Aprano writes:
>> The part that I don't see much about in the docs (some books, that is)
>> is that the lambda lookups occur late (the lambda is evaluated at the
>> time it is called). The Python docs on-line *do say* this (I found too
>> late) but its one quick phrase that can be missed
can you execute the java code from python and get the result stored as
python variable os.system()
On Thu, Jun 2, 2011 at 4:17 PM, loial wrote:
> Unfortunately using jpython or json are not options at the moment
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Nitin Pawar
--
Unfortunately using jpython or json are not options at the moment
--
http://mail.python.org/mailman/listinfo/python-list
Tracubik wrote:
> if you like, off course :)
>
> I'm making a port in python of a program made of bash commands + zenity
> for the GUI.
> so, i've to re-create a GUI in pyGTK and associate the right bash commands
> to the buttons.
> Instead of executing the bash script i simply print they in the
On Thu, Jun 2, 2011 at 2:54 AM, loial wrote:
> I need to pass some sort of array or hashmap from Java and read the
> data in a python script (which will be called by the java class). Is
> there any neater way to do this other than just passing strings?
Jython?: http://www.jython.org/
Or dependi
On Jun 2, 1:44 am, harrismh777 wrote:
..
> Just another example (excluding print 1/2 and unicode) where 3.x
> seems to be completely compatible with 2.x/ (tongue-in-cheek)
One of the key purposes of the 3.x line of code is to get rid of warts
in the language. As a result, if someone is
I need to pass some sort of array or hashmap from Java and read the
data in a python script (which will be called by the java class). Is
there any neater way to do this other than just passing strings?
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 01 Jun 2011 21:41:06 +0100, Nobody wrote:
> On Sun, 29 May 2011 23:31:19 +, Steven D'Aprano wrote:
>
>>> That's overstating it. There's a good argument to be made for raising
>>> an exception.
>>
>> If so, I've never heard it, and I cannot imagine what such a good
>> argument would b
On Thu, Jun 2, 2011 at 5:31 PM, Tracubik wrote:
> UNAME_CODE = ['uname']
> LS_CODE = ['cd /home/myUserId/Images/SashaGray',
> 'ls *.jpg']
>
> command_list = {
> "uname" : UNAME_CODE,
> "ls" : LS_CODE
> }
>
> do you like it?
> considering i'll have about 40+ butto
On Thu, Jun 2, 2011 at 3:14 PM, Steven D'Aprano
wrote:
> The problem with Do What I Mean is that it so rarely Does What You Mean.
> At best it Does What Some Other Guy Imagined I'd Probably Mean In This
> Situation. Let's not go there.
+1
One of my biggest "threats" to my coworkers goes along th
if you like, off course :)
I'm making a port in python of a program made of bash commands + zenity
for the GUI.
so, i've to re-create a GUI in pyGTK and associate the right bash commands
to the buttons.
Instead of executing the bash script i simply print they in the console.
so, here's my code
On 5/31/2011 7:45 PM, Carl Banks wrote:
Fine, it wasn't "unheard of". I'm pretty sure the existence of a few
high end compiler/hardware combinations that supported traps doesn't
invalidate my basic point. NaN was needed because few systems had a
separate path to deal with exceptional situations
75 matches
Mail list logo