Wednesday, March 24, 2010

comp.lang.python - 25 new messages in 11 topics - digest

comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en

comp.lang.python@googlegroups.com

Today's topics:

* Advice needed on parallel processing in python - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/e85ed76e6b8ec515?hl=en
* sum for sequences? - 5 messages, 5 authors
http://groups.google.com/group/comp.lang.python/t/139c0887a359405b?hl=en
* coding contest - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/694c653bf8b75f9e?hl=en
* spams - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/6cd4398a7b2416ab?hl=en
* What's the matter with docs.python.org? - 5 messages, 4 authors
http://groups.google.com/group/comp.lang.python/t/1493a683b68094cb?hl=en
* C-API: Extract information from function object - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/0783672c019fcadf?hl=en
* Programmatically discovering encoding types supported by codecs module - 4
messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/38f757c3f72901a1?hl=en
* Unicode blues in Python3 - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/064da9b38b1cde61?hl=en
* Is it possible to use re2 from Python? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/4c38032f9905efce?hl=en
* how to do asynchronous http requests with epoll and python 3.1 - 1 messages,
1 author
http://groups.google.com/group/comp.lang.python/t/7f32bca5410805a7?hl=en
* the Python Foundation - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/dffd2f2d435be839?hl=en

==============================================================================
TOPIC: Advice needed on parallel processing in python
http://groups.google.com/group/comp.lang.python/t/e85ed76e6b8ec515?hl=en
==============================================================================

== 1 of 2 ==
Date: Wed, Mar 24 2010 8:27 am
From: Glazner


Hi!

I need to replace an app that does number crunching over a local
network.
it have about 50 computers as slaves
each computer needs to run COM that will do the "job"
right now the system uses MFC threads and DCOM to distribute the load.

as i said, Now i'm trying to replace this system with python.
I already use win32all and read about Pareller Python and Pyro.

a requirement is that messages can be sent to the remote worker.

If anyone can share experience I'll love to hear


Many Thanks,
Yoav Glazner


== 2 of 2 ==
Date: Wed, Mar 24 2010 11:13 am
From: Jon Clements


On 24 Mar, 15:27, Glazner <yoavglaz...@gmail.com> wrote:
> Hi!
>
> I need to replace an app that does number crunching over a local
> network.
> it have about 50 computers as slaves
> each computer needs to run COM that will do the "job"
> right now the system uses MFC threads and DCOM to distribute the load.
>
> as i said, Now i'm trying to replace this system with python.
> I already use win32all and read about Pareller Python and Pyro.
>
> a requirement is that messages can be sent to the remote worker.
>
> If anyone can share experience I'll love to hear
>
> Many Thanks,
> Yoav Glazner

Would Celery suit? http://celeryproject.org/

hth

Jon.

==============================================================================
TOPIC: sum for sequences?
http://groups.google.com/group/comp.lang.python/t/139c0887a359405b?hl=en
==============================================================================

== 1 of 5 ==
Date: Wed, Mar 24 2010 8:29 am
From: kj


Is there a sequence-oriented equivalent to the sum built-in? E.g.:

seq_sum(((1, 2), (5, 6))) --> (1, 2) + (5, 6) --> (1, 2, 5, 6)

?

(By "sequence" I'm referring primarily to lists and tuples, and
excluding strings, since for these there is ''.join()).

TIA!

~K


== 2 of 5 ==
Date: Wed, Mar 24 2010 8:39 am
From: Glazner


On Mar 24, 5:29 pm, kj <no.em...@please.post> wrote:
> Is there a sequence-oriented equivalent to the sum built-in?  E.g.:
>
>   seq_sum(((1, 2), (5, 6))) --> (1, 2) + (5, 6) --> (1, 2, 5, 6)
>
> ?
>
> (By "sequence" I'm referring primarily to lists and tuples, and
> excluding strings, since for these there is ''.join()).
>
> TIA!
>
> ~K

try itertools.chain


== 3 of 5 ==
Date: Wed, Mar 24 2010 8:42 am
From: Neil Cerutti


On 2010-03-24, kj <no.email@please.post> wrote:
>
>
> Is there a sequence-oriented equivalent to the sum built-in? E.g.:
>
> seq_sum(((1, 2), (5, 6))) --> (1, 2) + (5, 6) --> (1, 2, 5, 6)
>
> ?
>
> (By "sequence" I'm referring primarily to lists and tuples, and
> excluding strings, since for these there is ''.join()).

reduce, or functools.reduce in Python 3.1.

>>> functools.reduce(operator.add, ((1, 2), (5, 6)))
(1, 2, 5, 6)

--
Neil Cerutti
"It's not fun to build walls. But it's even less fun to live
without walls in a world full of zombies." --Greedy Goblin


== 4 of 5 ==
Date: Wed, Mar 24 2010 8:42 am
From: Steve Holden


kj wrote:
>
> Is there a sequence-oriented equivalent to the sum built-in? E.g.:
>
> seq_sum(((1, 2), (5, 6))) --> (1, 2) + (5, 6) --> (1, 2, 5, 6)
>
> ?
>
> (By "sequence" I'm referring primarily to lists and tuples, and
> excluding strings, since for these there is ''.join()).
>
Do you mean you want to flatten a list structure? There have been
several discussions about this, which Google will find for you quite easily.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/

== 5 of 5 ==
Date: Wed, Mar 24 2010 9:20 am
From: Duncan Booth


kj <no.email@please.post> wrote:

> Is there a sequence-oriented equivalent to the sum built-in? E.g.:
>
> seq_sum(((1, 2), (5, 6))) --> (1, 2) + (5, 6) --> (1, 2, 5, 6)
>
> ?
>
Apart from the suggestions for Google for general list flattening, for this
specific example you could just use the 'sum' built-in:

>>> sum(((1, 2), (5, 6)), ())
(1, 2, 5, 6)

Just give it an empty tuple as the starting value.

==============================================================================
TOPIC: coding contest
http://groups.google.com/group/comp.lang.python/t/694c653bf8b75f9e?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Mar 24 2010 8:42 am
From: insomnia iit roookee


IIT ROORKEE COGNIZANCE presents INSOMNIA :THE MIDNIGHT PROGRAMMING
CONTEST...
www.insomnia.cognizance.org.in

Starts on : 27th March, 9:00 PM

Cash prizes worth Rs.30,000 on stake for this round.
(PS: Problems of previous rounds are available for practice.)

==============================================================================
TOPIC: spams
http://groups.google.com/group/comp.lang.python/t/6cd4398a7b2416ab?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Mar 24 2010 8:42 am
From: "D'Arcy J.M. Cain"


On Wed, 24 Mar 2010 20:47:12 +0530
Shashwat Anand <anand.shashwat@gmail.com> wrote:
> Lately this list have been spammed a lot. Any workarounds by moderators?

Not as long as it is gatewayed to Usenet. You can kill most of the
spam by blocking anything from gmail.com with a Newsgroups line.
Unfortunately you will also block a lot of legitimate postings.

If they would turn off the gateway then legitimate posters can choose
to join the list but as long as the gateway is there then there is no
reason to switch.

With the gateway off there are all sorts of tools to reduce spam. I
think the best one is to set the flag to only allow subscribers to post
and to start all new users as moderated and remove the moderation on
the first posting as long as it is not spam. If the first posting is
not spam then chances are none of the rest from that user will be spam.

--
D'Arcy J.M. Cain <darcy@druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

==============================================================================
TOPIC: What's the matter with docs.python.org?
http://groups.google.com/group/comp.lang.python/t/1493a683b68094cb?hl=en
==============================================================================

== 1 of 5 ==
Date: Wed, Mar 24 2010 9:05 am
From: kj

In the last couple of weeks, docs.python.org has been down repeatedly
(like right now). Has anyone else noticed this?

~K

== 2 of 5 ==
Date: Wed, Mar 24 2010 9:19 am
From: python@bdurham.com


KJ,

> In the last couple of weeks, docs.python.org has been down repeatedly
> (like right now). Has anyone else noticed this?

I've been surfing docs.python.org all morning and haven't had any
problems.

I'm connecting from Bethlehem, PA (USA).

Malcolm


== 3 of 5 ==
Date: Wed, Mar 24 2010 9:19 am
From: Philip Semanchuk

On Mar 24, 2010, at 12:05 PM, kj wrote:

> In the last couple of weeks, docs.python.org has been down repeatedly
> (like right now). Has anyone else noticed this?

http://downforeveryoneorjustme.com/docs.python.org

Works for me...

HTH
Philip


== 4 of 5 ==
Date: Wed, Mar 24 2010 9:24 am
From: Steve Holden


kj wrote:
>
>
> In the last couple of weeks, docs.python.org has been down repeatedly
> (like right now). Has anyone else noticed this?

http://downforeveryoneorjustme.com/docs.python.org

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/

== 5 of 5 ==
Date: Wed, Mar 24 2010 9:25 am
From: kj


In <mailman.1145.1269447568.23598.python-list@python.org> Philip Semanchuk <philip@semanchuk.com> writes:


>On Mar 24, 2010, at 12:05 PM, kj wrote:

>> In the last couple of weeks, docs.python.org has been down repeatedly
>> (like right now). Has anyone else noticed this?

>http://downforeveryoneorjustme.com/docs.python.org

Very handy. Thanks!

~K

==============================================================================
TOPIC: C-API: Extract information from function object
http://groups.google.com/group/comp.lang.python/t/0783672c019fcadf?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Mar 24 2010 9:49 am
From: "Gabriel Genellina"


En Wed, 24 Mar 2010 12:09:27 -0300, moerchendiser2k3
<googler.1.webmaster@spamgourmet.com> escribió:

> I have a reference to a function and would like to know how to extract
> information from a function object.
>
> Information I am looking for: line and file where this function is
> from.
>
> PyObject_Call can do this to when I call a function object and
> something failed so these information are written to the traceback. So
> any suggestions how to do that?

See the Language Reference; the associated code object holds the file and
starting line the function comes from.
The traceback object contains better information (like the line being
executed instead of the first one). Why don't you use it instead?

--
Gabriel Genellina


==============================================================================
TOPIC: Programmatically discovering encoding types supported by codecs module
http://groups.google.com/group/comp.lang.python/t/38f757c3f72901a1?hl=en
==============================================================================

== 1 of 4 ==
Date: Wed, Mar 24 2010 10:18 am
From: Benjamin Kaplan


On Wed, Mar 24, 2010 at 12:17 PM, <python@bdurham.com> wrote:
> Is there a way to programmatically discover the encoding types supported by
> the codecs module?
>
> For example, the following link shows a table with Codec, Aliases, and
> Language columns.
> http://docs.python.org/library/codecs.html#standard-encodings
>
> I'm looking for a way to programmatically generate this table through some
> form of module introspection.
>
> Ideas?
>
> Malcolm
> --

According to my brief messing around with the REPL,
encodings.aliases.aliases is a good place to start. I don't know of
any way to get the Language column, but at the very least that will
give you most of the supported encodings and any aliases they have.


== 2 of 4 ==
Date: Wed, Mar 24 2010 10:39 am
From: "Gabriel Genellina"


En Wed, 24 Mar 2010 13:17:16 -0300, <python@bdurham.com> escribió:

> Is there a way to programmatically discover the encoding types
> supported by the codecs module?
>
> For example, the following link shows a table with Codec,
> Aliases, and Language columns.
> http://docs.python.org/library/codecs.html#standard-encodings
>
> I'm looking for a way to programmatically generate this table
> through some form of module introspection.

After looking at how things are done in codecs.c and encodings/__init__.py
I think you should enumerate all modules in the encodings package that
define a getregentry function.
Aliases come from encodings.aliases.aliases.

--
Gabriel Genellina

== 3 of 4 ==
Date: Wed, Mar 24 2010 10:55 am
From: python@bdurham.com


Benjamin,

> According to my brief messing around with the REPL, encodings.aliases.aliases is a good place to start. I don't know of any way to get the Language column, but at the very least that will give you most of the supported encodings and any aliases they have.

Thank you - that's exactly the type of information I was looking for.

I'm including the following for anyone browsing the mailing list
archives in the future.

Here's the snippet we're using to dynamically generate the codec
documentation posted on the docs.python website.

import encodings
encodingDict = encodings.aliases.aliases
encodingType = dict()
for key, value in encodingDict.items():
if value not in encodingType:
encodingType[ value ] = list()
encodingType[ value ].append( key )

for key in sorted( encodingType.keys() ):
aliases = sorted( encodingType[ key ] )
aliases = ', '.join( aliases )
print '%-20s%s' % ( key, aliases )

Regards,
Malcolm


== 4 of 4 ==
Date: Wed, Mar 24 2010 10:58 am
From: python@bdurham.com


Gabriel,

> After looking at how things are done in codecs.c and encodings/__init__.py I think you should enumerate all modules in the encodings package that define a getregentry function. Aliases come from encodings.aliases.aliases.

Thanks for looking into this for me. Benjamin Kaplan made a similar
observation. My reply to him included the snippet of code we're using to
generate the actual list of encodings that our software will support
(thanks to Python's codecs and encodings modules).

Your help is always appreciated :)

Regards,
Malcolm


----- Original message -----
From: "Gabriel Genellina" <gagsl-py2@yahoo.com.ar>
To: python-list@python.org
Date: Wed, 24 Mar 2010 14:39:20 -0300
Subject: Re: Programmatically discovering encoding types supported by
codecs module

En Wed, 24 Mar 2010 13:17:16 -0300, <python@bdurham.com> escribió:

> Is there a way to programmatically discover the encoding types
> supported by the codecs module?
>
> For example, the following link shows a table with Codec,
> Aliases, and Language columns.
> http://docs.python.org/library/codecs.html#standard-encodings
>
> I'm looking for a way to programmatically generate this table
> through some form of module introspection.


--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list


==============================================================================
TOPIC: Unicode blues in Python3
http://groups.google.com/group/comp.lang.python/t/064da9b38b1cde61?hl=en
==============================================================================

== 1 of 3 ==
Date: Wed, Mar 24 2010 10:33 am
From: Michael Torrie


Steven D'Aprano wrote:
> I think your question is malformed. You need to work out what behaviour
> you actually want, before you can ask for help on how to get it.

It may or may not be malformed, but I understand the question. So let
eme translate for you. How can he write arbitrary bytes ( 0x0 through
0xff) to stdout without having them mangled by encodings. It's a very
simple question, really. Looks like Antoine Pitrou has answered this
question quite nicely as well.


== 2 of 3 ==
Date: Wed, Mar 24 2010 10:34 am
From: nn


Antoine Pitrou wrote:
> Le Tue, 23 Mar 2010 10:33:33 -0700, nn a écrit :
>
> > I know that unicode is the way to go in Python 3.1, but it is getting in
> > my way right now in my Unix scripts. How do I write a chr(253) to a
> > file?
> >
> > #nntst2.py
> > import sys,codecs
> > mychar=chr(253)
> > print(sys.stdout.encoding)
> > print(mychar)
>
> print() writes to the text (unicode) layer of sys.stdout.
> If you want to access the binary (bytes) layer, you must use
> sys.stdout.buffer. So:
>
> sys.stdout.buffer.write(chr(253).encode('latin1'))
>
> or:
>
> sys.stdout.buffer.write(bytes([253]))
>
> See http://docs.python.org/py3k/library/io.html#io.TextIOBase.buffer

Just what I needed! Now I full control of the output.

Thanks Antoine. The new io stack is still a bit of a mystery to me.

Thanks everybody else, and sorry for confusing the issue. Latin1 just
happens to be very convenient to manipulate bytes and is what I
thought of initially to handle my mix of textual and non-textual data.


== 3 of 3 ==
Date: Wed, Mar 24 2010 12:35 pm
From: John Nagle


nn wrote:

> To be more informative I am both writing text and binary data
> together. That is I am embedding text from another source into stream
> that uses non-ascii characters as "control" characters. In Python2 I
> was processing it mostly as text containing a few "funny" characters.

OK. Then you need to be writing arrays of bytes, not strings.
Encoding is your problem. This has nothing to do with Unicode.

John Nagle

==============================================================================
TOPIC: Is it possible to use re2 from Python?
http://groups.google.com/group/comp.lang.python/t/4c38032f9905efce?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Mar 24 2010 10:44 am
From: _wolf

yes we can! http://github.com/facebook/pyre2

as pointed out by http://stackoverflow.com/users/219162/daniel-stutzbach

now gotta go and try it out.

==============================================================================
TOPIC: how to do asynchronous http requests with epoll and python 3.1
http://groups.google.com/group/comp.lang.python/t/7f32bca5410805a7?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Mar 24 2010 10:47 am
From: _wolf

i asked this question before on
http://stackoverflow.com/questions/2489780/how-to-do-asynchronous-http-requests-with-epoll-and-python-3-1
but without a definitive answer as yet.

can someone help me out? i want to do several simple http GET and POST
requests in the same process using Python 3.1 without using threading.


the original post:

there is an interesting page [http://scotdoyle.com/python-epoll-
howto.html
][1] about how to do asnchronous / non-blocking / AIO http
serving in python 3.

there is the [tornado web server][2] which does include a non-blocking
http client. i have managed to port parts of the server to python 3.1,
but the implementation of the client requires [pyCurl][3] and [seems
to have problems][4] (with one participant stating how 'Libcurl is
such a pain in the neck', and looking at the incredibly ugly pyCurl
page i doubt pyCurl will arrive in py3+ any time soon).

now that epoll is available in the standard library, it should be
possible to do asynchronous http requests out of the box with python.
i really do not want to use asyncore or whatnot; epoll has a
reputation for being the ideal tool for the task, and it is part of
the python distribution, so using anything but epoll for non-blocking
http is highly counterintuitive (prove me wrong if you feel like it).

oh, and i feel threading is horrible. no threading. i use [stackless]
[5].

*people further interested in the topic of asynchronous http should
not miss out on this [talk by peter portante at PyCon2010][6]; also of
interest is [the keynote][7], where speaker antonio rodriguez at one
point emphasizes the importance of having up-to-date web technology
libraries right in the standard library.*


[1]: http://scotdoyle.com/python-epoll-howto.html
[2]: http://www.tornadoweb.org/
[3]: http://pycurl.sourceforge.net/
[4]:
http://groups.google.com/group/python-tornado/browse_thread/thread/276059a076593266/c49e8f834497271e?lnk=gst&q=httpclient+trouble+with+epoll#c49e8f834497271e
[5]: http://stackless.com/
[6]: http://python.mirocommunity.org/video/1501/pycon-2010-demystifying-non-bl
[7]: http://python.mirocommunity.org/video/1605/pycon-2010-keynote-relentlessl

==============================================================================
TOPIC: the Python Foundation
http://groups.google.com/group/comp.lang.python/t/dffd2f2d435be839?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Mar 24 2010 1:50 pm
From: Mark Tarver


From the website

The Python Software Foundation (PSF) is a 501(c)(3) non-profit
corporation that
holds the intellectual property rights behind the Python programming
language. We manage the open source licensing for Python version 2.1
and later and own and protect the trademarks associated with Python.

Could somebody explain 'what holding the intellectual property rights'
means in this context and in what sense PSF manages the licensing and
protects the trademarks associated with Python? This is for my
education.

thanks

Mark


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en

To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate