Friday, March 12, 2010

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

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

comp.lang.python@googlegroups.com

Today's topics:

* inspect.stack() and frame - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/fc8bf697fa9a01a4?hl=en
* Reverse engineering CRC? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/b22db1e3e63db596?hl=en
* NoSQL Movement? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/942e22a0145599b2?hl=en
* to create variable from dict - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/9a2ccf6e5c80789b?hl=en
* Exiting gracefully from ThreadingTCPServer - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/5521265522a15d9f?hl=en
* Unicode characters in btye-strings - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/77271907fb195aca?hl=en
* Python, Reportlabs, Pil and Windows 7 (64bit) - 2 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/8f0199cb036d7949?hl=en
* Threading, Queue for a function so it only runs once at a time. - 4 messages,
2 authors
http://groups.google.com/group/comp.lang.python/t/7896ac48f32d8599?hl=en
* Anything like "Effective Java" for Python? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/47674ff2d2c78fa6?hl=en
* Visual Python programming and decompilers? - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/920e010869d6b6fc?hl=en
* Asynchronous HTTP client - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/8d12ca848ffb171e?hl=en
* file seek is slow - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/f9c31a229cdda107?hl=en
* Cheeps Guest houses Karachi Independents fully furnished - 2 messages, 2
authors
http://groups.google.com/group/comp.lang.python/t/01860274448ad654?hl=en
* Need advice on starting a Python group - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/0a24bf882c72c555?hl=en
* question regarding wxSlider - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/7000a2c895b1da4f?hl=en

==============================================================================
TOPIC: inspect.stack() and frame
http://groups.google.com/group/comp.lang.python/t/fc8bf697fa9a01a4?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Mar 12 2010 6:08 am
From: Félix-Antoine Fortin


Thanks Gabriel, you resumed quite well what I did discovered after my
second post
by playing with the garbage collector module.

> (The garbage collector will,  
> eventually, break the cycle and free those objects, but not very soon).

I'm not very familiar with the Python garbage collector, so you may
excuse my
simple question, but how can it break the cycle? I guess the object
will be
freed at least when the program ends, but could it be before that? Is
there a
mechanisme in the garbage collector to detect circular references?

Felix


== 2 of 2 ==
Date: Fri, Mar 12 2010 7:47 am
From: MRAB


Félix-Antoine Fortin wrote:
> Thanks Gabriel, you resumed quite well what I did discovered after my
> second post
> by playing with the garbage collector module.
>
>> (The garbage collector will,
>> eventually, break the cycle and free those objects, but not very soon).
>
> I'm not very familiar with the Python garbage collector, so you may
> excuse my
> simple question, but how can it break the cycle? I guess the object
> will be
> freed at least when the program ends, but could it be before that? Is
> there a
> mechanisme in the garbage collector to detect circular references?
>
In CPython objects are reference-counted, which allows an object to be
collected as soon as there are no references to it.

However, this won't take care of circular references, so a secondary
garbage collector was introduced which occasionally looks for
inaccessible objects (garbage) using (probably) mark-and-sweep.

==============================================================================
TOPIC: Reverse engineering CRC?
http://groups.google.com/group/comp.lang.python/t/b22db1e3e63db596?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 12 2010 6:22 am
From: Emile van Sebille


On 3/12/2010 3:24 AM Gregory Ewing said...
> What confused me initially is that it seems to be adding
> a few extra bytes to the checked data that aren't present
> in the file. Figuring out what they're supposed to contain
> is proving to be quite a headache...

Length?

Emile


==============================================================================
TOPIC: NoSQL Movement?
http://groups.google.com/group/comp.lang.python/t/942e22a0145599b2?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 12 2010 6:30 am
From: "D'Arcy J.M. Cain"


On Fri, 12 Mar 2010 01:05:27 -0800
Jonathan Gardner <jgardner@jonathangardner.net> wrote:
> Let me give you an example. I worked on a system that would load
> recipients for email campaigns into a database table. The SQL database
> was nice during the initial design and prototype stage because we
> could quickly adjust the tables to add or remove columns and try out
> different designs.. However, once our system got popular, the
> limitation was how fast we could load recipients into the database.

Just curious, what database were you using that wouldn't keep up with
you? I use PostgreSQL and would never consider going back to flat
files. The only thing I can think of that might make flat files faster
is that flat files are buffered whereas PG guarantees that your
information is written to disk before returning but if speed is more
important than 100% reliability you can turn that off and let PG use
the file system buffering just like flat files.

--
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: to create variable from dict
http://groups.google.com/group/comp.lang.python/t/9a2ccf6e5c80789b?hl=en
==============================================================================

== 1 of 3 ==
Date: Fri, Mar 12 2010 6:40 am
From: Tim Chase


hiral wrote:
> Is there any way to create variables which name matches with dict key?
>
> For example:
> dict1 = {"abc":'1", "def":"2"}
>
> Now I am looking to have variable name abc and it's value be '1' etc.

1) you can't because "def" is a reserved word in Python.

2) why do you want to? This seems to come up about every week or
so and people STILL want to do it. Search the archives...you
won't have to go back too far.

3) once you have it, how do you plan to use the variables? If
you don't know what they'll be named ahead of time, how can you
use them in your code

The usual answer is "don't do that -- just use them as a dict",
or if you're trying to set up some constants, you can use

abc, def_, ghi = 1, 2, 3

-tkc

== 2 of 3 ==
Date: Fri, Mar 12 2010 6:50 am
From: Luis M. González


On Mar 12, 10:59 am, hiral <hiralsmaill...@gmail.com> wrote:
> Hi,
>
> Is there any way to create variables which name matches with dict key?
>
> For example:
> dict1 = {"abc":'1", "def":"2"}
>
> Now I am looking to have variable name abc and it's value be '1' etc.
>
> Pl. suggest.
>
> Thank you.

Check out this thread (very recent):
http://groups.google.com/group/comp.lang.python/browse_thread/thread/bb1797ffb6fc3bd7/25fe94103c7a231f?lnk=gst&q=luis+variables#25fe94103c7a231f

Short answer: you can update globals() with a dictionary, as follows:

globals().update( dict1 )

Then you'll have each key-value pair as variables in the global
namespace.
The question is: should you do it?

Luis


== 3 of 3 ==
Date: Fri, Mar 12 2010 7:02 am
From: Jean-Michel Pichavant


Luis M. González wrote:
> On Mar 12, 10:59 am, hiral <hiralsmaill...@gmail.com> wrote:
>
>> Hi,
>>
>> Is there any way to create variables which name matches with dict key?
>>
>> For example:
>> dict1 = {"abc":'1", "def":"2"}
>>
>> Now I am looking to have variable name abc and it's value be '1' etc.
>>
>> Pl. suggest.
>>
>> Thank you.
>>
>
> Check out this thread (very recent):
> http://groups.google.com/group/comp.lang.python/browse_thread/thread/bb1797ffb6fc3bd7/25fe94103c7a231f?lnk=gst&q=luis+variables#25fe94103c7a231f
>
> Short answer: you can update globals() with a dictionary, as follows:
>
> globals().update( dict1 )
>
> Then you'll have each key-value pair as variables in the global
> namespace.
> The question is: should you do it?
>
> Luis
>
The answer is known: no, he should not do it :o)

JM

==============================================================================
TOPIC: Exiting gracefully from ThreadingTCPServer
http://groups.google.com/group/comp.lang.python/t/5521265522a15d9f?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 12 2010 7:15 am
From: Pete Emerson


I'm trying to get threading going for the first time in python, and
I'm trying to modify code I found so that I can have the server close
the TCP connections and exit gracefully. Two problems:

1) While the KeyboardInterrupt works, if I make more than 0 curls to
the server and then quit, I can't run it again right away and get
this:
socket.error: [Errno 48] Address already in use

Not all of my connections are closing properly. How do I fix this?

2) curling localhost:8080/quit does show the "Quitting" output that I
expect, but doesn't quit the server until I manually control-c it.

I think that I need *all* threads to close and not just the current
one, so I'm not quite sure how to proceed. Pointers in the right
direction are appreciated. And if there's a "better" way to do this
threading httpd server (subjective, I realize), please let me know!
Thanks.

Pete

#############################################
#!/usr/bin/env python

import SocketServer
import SimpleHTTPServer

PORT = 8080
done = False
class CustomHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
global done
if self.path=='/quit':
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
self.wfile.write('Quitting')
done = True
return self
else:
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
self.wfile.write('Unknown')
return self


if __name__ == "__main__":
httpd = SocketServer.ThreadingTCPServer(('localhost',
PORT),CustomHandler)
try:
while not done:
print "done: ", done
httpd.handle_request()
except KeyboardInterrupt:
print "Server is done."
httpd.server_close()

==============================================================================
TOPIC: Unicode characters in btye-strings
http://groups.google.com/group/comp.lang.python/t/77271907fb195aca?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 12 2010 7:37 am
From: Robert Kern


On 2010-03-12 06:35 AM, Steven D'Aprano wrote:
> I know this is wrong, but I'm not sure just how wrong it is, or why.
> Using Python 2.x:
>
>>>> s = "éâÄ"
>>>> print s
> éâÄ
>>>> len(s)
> 6
>>>> list(s)
> ['\xc3', '\xa9', '\xc3', '\xa2', '\xc3', '\x84']
>
> Can somebody explain what happens when I put non-ASCII characters into a
> non-unicode string? My guess is that the result will depend on the
> current encoding of my terminal.

Exactly right.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco


==============================================================================
TOPIC: Python, Reportlabs, Pil and Windows 7 (64bit)
http://groups.google.com/group/comp.lang.python/t/8f0199cb036d7949?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Mar 12 2010 7:44 am
From: Robin Becker


On 12/03/2010 11:40, Robin Becker wrote:
........
>
> I assume I can get those from a working Python amd64 install and stuff
> on one of the compiler paths somehow.


Not sure if this is a bug; I dug around a bit and find that because of the cross
compilation distutils is supposed to add an extra library path with the name
PCbuild\AMD64 when doing x86-->amd64 cross builds.

I tried copying the 2.6.4 amd64 libs/dlls etc etc into c:\python26\PCbuild\AMD64
and reran my cross build

c:\python26\python setup.py build --plat-name=win-amd64

however, that still gives linker import errors.

Looked in the output I see this

> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\x86_amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\python26
> \libs /LIBPATH:C:\python26\PCbuild\amd64 /EXPORT:init_rl_accel build\temp.win-amd64-2.6\Release\_rl_accel.obj /OUT:build
> \lib.win-amd64-2.6\_rl_accel.pyd /IMPLIB:build\temp.win-amd64-2.6\Release\_rl_accel.lib /MANIFESTFILE:build\temp.win-amd
> 64-2.6\Release\_rl_accel.pyd.manifest
> Creating library build\temp.win-amd64-2.6\Release\_rl_accel.lib and object build\temp.win-amd64-2.6\Release\_rl_accel
> .exp
> _rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyNumber_Int referenced in function _parseSequenceInt
> _rl_accel.obj : error LNK2019: unresolved external symbol __imp_PySequence_GetItem referenced in function _parseSequence


that looks wrong because I'm using 32 bit python to do the build and

/LIBPATH:C:\python26\libs /LIBPATH:C:\python26\PCbuild\amd64

means that the 32 bit libraries are first. Running the linker command by itself
(without the 32bit libs in the command) works fine ie

> C:\ux\PydBuilder\rl_addons\rl_accel>"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\x86_amd64\link.exe" /DLL /nolog
> o /INCREMENTAL:NO /LIBPATH:C:\python26\PCbuild\amd64 /EXPORT:init_rl_accel build\temp.win-amd64-2.6\Release\_rl_accel.ob
> j /OUT:build\lib.win-amd64-2.6\_rl_accel.pyd /IMPLIB:build\temp.win-amd64-2.6\Release\_rl_accel.lib /MANIFESTFILE:build\
> temp.win-amd64-2.6\Release\_rl_accel.pyd.manifest
> Creating library build\temp.win-amd64-2.6\Release\_rl_accel.lib and object build\temp.win-amd64-2.6\Release\_rl_accel
> .exp

seems to work fine and produce a pyd in build\lib.win-amd64-2.6
--
Robin Becker


== 2 of 2 ==
Date: Fri, Mar 12 2010 7:44 am
From: Robin Becker


On 12/03/2010 11:40, Robin Becker wrote:
........
>
> I assume I can get those from a working Python amd64 install and stuff
> on one of the compiler paths somehow.


Not sure if this is a bug; I dug around a bit and find that because of the cross
compilation distutils is supposed to add an extra library path with the name
PCbuild\AMD64 when doing x86-->amd64 cross builds.

I tried copying the 2.6.4 amd64 libs/dlls etc etc into c:\python26\PCbuild\AMD64
and reran my cross build

c:\python26\python setup.py build --plat-name=win-amd64

however, that still gives linker import errors.

Looked in the output I see this

> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\x86_amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\python26
> \libs /LIBPATH:C:\python26\PCbuild\amd64 /EXPORT:init_rl_accel build\temp.win-amd64-2.6\Release\_rl_accel.obj /OUT:build
> \lib.win-amd64-2.6\_rl_accel.pyd /IMPLIB:build\temp.win-amd64-2.6\Release\_rl_accel.lib /MANIFESTFILE:build\temp.win-amd
> 64-2.6\Release\_rl_accel.pyd.manifest
> Creating library build\temp.win-amd64-2.6\Release\_rl_accel.lib and object build\temp.win-amd64-2.6\Release\_rl_accel
> .exp
> _rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyNumber_Int referenced in function _parseSequenceInt
> _rl_accel.obj : error LNK2019: unresolved external symbol __imp_PySequence_GetItem referenced in function _parseSequence


that looks wrong because I'm using 32 bit python to do the build and

/LIBPATH:C:\python26\libs /LIBPATH:C:\python26\PCbuild\amd64

means that the 32 bit libraries are first. Running the linker command by itself
(without the 32bit libs in the command) works fine ie

> C:\ux\PydBuilder\rl_addons\rl_accel>"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\x86_amd64\link.exe" /DLL /nolog
> o /INCREMENTAL:NO /LIBPATH:C:\python26\PCbuild\amd64 /EXPORT:init_rl_accel build\temp.win-amd64-2.6\Release\_rl_accel.ob
> j /OUT:build\lib.win-amd64-2.6\_rl_accel.pyd /IMPLIB:build\temp.win-amd64-2.6\Release\_rl_accel.lib /MANIFESTFILE:build\
> temp.win-amd64-2.6\Release\_rl_accel.pyd.manifest
> Creating library build\temp.win-amd64-2.6\Release\_rl_accel.lib and object build\temp.win-amd64-2.6\Release\_rl_accel
> .exp

seems to work fine and produce a pyd in build\lib.win-amd64-2.6
--
Robin Becker


==============================================================================
TOPIC: Threading, Queue for a function so it only runs once at a time.
http://groups.google.com/group/comp.lang.python/t/7896ac48f32d8599?hl=en
==============================================================================

== 1 of 4 ==
Date: Fri, Mar 12 2010 7:56 am
From: "John P."


Sorry but its not really an option for me with PostgreSQL. Thanks anyway.

I wonder if there is a simple way of just queueing the run of a function
make it only run once at a time but by multiply threads? :)

On Fri, 12 Mar 2010 00:54:57 -0800, Jonathan Gardner
<jgardner@jonathangardner.net> wrote:
> For lots of transactions running at once, MySQL is a terrible choice.
> Give PostgreSQL a try. It does a much better job with that kind of
> load.
>
> On Thu, Mar 11, 2010 at 11:11 PM, John P. <mailinglists@riddergarn.dk>
> wrote:
>> Hi,
>>
>> Im programming a simple webcrawler with threading for the fun of it,
>> which
>> is inserting the data fetch into a mysql database, but after
continuously
>> cause my mysql server to produce error during database queries (i
assume
>> its cause because of the many execution at the same time.) the scipt
>> produces errors.
>>
>> I figured out i need some kind of queue for the function i use to
insert
>> into the database, to make sure its only called once at a time.
>>
>> I have looked at the Queue module but its for more complicated than my
>> current python skills can cope with. :)
>>
>> Would somebody please help me out here?
>>


== 2 of 4 ==
Date: Fri, Mar 12 2010 8:22 am
From: "D'Arcy J.M. Cain"


On Fri, 12 Mar 2010 15:56:12 +0000
"John P." <mailinglists@riddergarn.dk> wrote:
> Sorry but its not really an option for me with PostgreSQL. Thanks anyway.

Why? It's your best option. Any other solutions that you can't use
before people give you more suggestions?

--
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.


== 3 of 4 ==
Date: Fri, Mar 12 2010 8:49 am
From: "John P."


On Fri, 12 Mar 2010 11:22:04 -0500, "D'Arcy J.M. Cain" <darcy@druid.net>
wrote:
> On Fri, 12 Mar 2010 15:56:12 +0000
> "John P." <mailinglists@riddergarn.dk> wrote:
>> Sorry but its not really an option for me with PostgreSQL. Thanks
anyway.
>
> Why? It's your best option. Any other solutions that you can't use
> before people give you more suggestions?

Chill. I didn't ask for an alternative to my database, it could be writing
in a file as well. What I need is some kind of queue to my function so it
doesnt crack up running 20 times at the same time. I'm working on a remote
server which I share with some friends, meaning I can't install whatever I
want to.
The problem seems to be that my threads are making MySQL queries at the
same time before it can fetch the data just requested. Also I said thanks
for his effort trying to help and kept a nice tone, shouldn't that be
enough?

/John


== 4 of 4 ==
Date: Fri, Mar 12 2010 9:25 am
From: "John P."


On Fri, 12 Mar 2010 16:49:04 +0000, "John P." <mailinglists@riddergarn.dk>
wrote:
> On Fri, 12 Mar 2010 11:22:04 -0500, "D'Arcy J.M. Cain" <darcy@druid.net>
> wrote:
>> On Fri, 12 Mar 2010 15:56:12 +0000
>> "John P." <mailinglists@riddergarn.dk> wrote:
>>> Sorry but its not really an option for me with PostgreSQL. Thanks
> anyway.
>>
>> Why? It's your best option. Any other solutions that you can't use
>> before people give you more suggestions?
>
> Chill. I didn't ask for an alternative to my database, it could be
writing
> in a file as well. What I need is some kind of queue to my function so
it
> doesnt crack up running 20 times at the same time. I'm working on a
remote
> server which I share with some friends, meaning I can't install whatever
I
> want to.
> The problem seems to be that my threads are making MySQL queries at the
> same time before it can fetch the data just requested. Also I said
thanks
> for his effort trying to help and kept a nice tone, shouldn't that be
> enough?
>
> /John

Don't worry guys, I found a solution. My problem was caused because I used
the same mysql connection for all the treads, now its working perfectly,
with mysql.

/John.

==============================================================================
TOPIC: Anything like "Effective Java" for Python?
http://groups.google.com/group/comp.lang.python/t/47674ff2d2c78fa6?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 12 2010 7:50 am
From: Gabriel Rossetti


kj wrote:
>
> Subject line pretty much says it all: is there a book like "Effective
> Java" for Python. I.e. a book that assumes that readers are
> experienced programmers that already know the basics of the language,
> and want to focus on more advanced programming issues?
>
> ~K
>

Effective Java is a good book, it is not like most people responding to
this topic a "how to program in Java"
book but a "I know how to program in Python, but I want it to run fast
and use a minimal amount of memory".
I would have liked to have such a book for Python when I was past the
language learning stage.

Gabriel

==============================================================================
TOPIC: Visual Python programming and decompilers?
http://groups.google.com/group/comp.lang.python/t/920e010869d6b6fc?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Mar 12 2010 8:18 am
From: "Billy Earney"


Ludolph,

This reminds me of the orange project which is developed in python.
http://www.ailab.si/orange/
It is actually for data mining, but many of the concepts could be used for a
more general programming structure.

Billy

-----Original Message-----
From: python-list-bounces+billy.earney=gmail.com@python.org
[mailto:python-list-bounces+billy.earney=gmail.com@python.org] On Behalf Of
Ludolph
Sent: Thursday, March 11, 2010 12:39 PM
To: python-list@python.org
Subject: Visual Python programming and decompilers?

Hi Guys

At work I have been exposed to a Agile Platform called OutSystems. It
allows you to visually program your web applications
http://i.imgur.com/r2F0i.png and I find the idea very intriguing.

So I have started to play around with the idea on how will I be able
to visually represent Python code as in the above image and then allow
the programmer to change some of the flow/code/logic visually and then
get it back as python source code. I don't know if this have been
tried before and after some googling I can't find anything like this,
so maybe I'm just lacking basic googling skills or a python solution
like the above does not exist yet.

If anybody knows of such solution please let me know, so that I don't
spend a lot of time recreating the wheel. Otherwise help me out on the
following problem:

I decided I can use byteplay3 http://pypi.python.org/pypi/byteplay/ to
disassemble the code to workable objects, It even allows me to rebuild
the objects to bytecode. So if I define patterns on how python
interrupts the source code to bytecode I can visually represent this
and also so convert my visual representations back to bytecode.

The only problem I have at the moment is how will I get this bytecode
back to python source code. I have googled for python decompiler but
only found old projects like unpyc, decompyle and some online
services. I would like to know if anybody know of a well maintained or
at least recent module that can help me accomplish the above
mentioned, because I'm hoping I can implement this in Python 3.1.

So any input or suggestion would be greatly appreciated.

Kind Regards,

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

== 2 of 2 ==
Date: Fri, Mar 12 2010 8:36 am
From: Tim Wintle


On Thu, 2010-03-11 at 20:38 +0200, Ludolph wrote:
>
> I decided I can use byteplay3 http://pypi.python.org/pypi/byteplay/ to
> disassemble the code to workable objects, It even allows me to rebuild
> the objects to bytecode. So if I define patterns on how python
> interrupts the source code to bytecode I can visually represent this
> and also so convert my visual representations back to bytecode.

Assuming you're on 2.6 or later, I'd suggest working with the ast module
instead:
http://docs.python.org/library/ast.html


==============================================================================
TOPIC: Asynchronous HTTP client
http://groups.google.com/group/comp.lang.python/t/8d12ca848ffb171e?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 12 2010 8:48 am
From: Antoine Pitrou


Le Sun, 07 Mar 2010 22:40:36 +0800, pingooo a écrit :
> I'm writing an open source python client for a web service. The client
> may be used in all kinds of environments - Linux, Mac OS X, Windows, web
> hosting, etc by others. It is not impossible to have twisted as a
> dependency, but that makes deployment a larger job than simply uploading
> a Python file.

If it can be used by non-Python users, you will have to package it using
py2exe or py2app anyway, in which case Twisted will be bundled
automatically and the size overhead won't be very large.

==============================================================================
TOPIC: file seek is slow
http://groups.google.com/group/comp.lang.python/t/f9c31a229cdda107?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 12 2010 8:57 am
From: Antoine Pitrou


Le Tue, 09 Mar 2010 15:56:47 -0800, Metalone a écrit :
> for i in xrange(1000000):
> f1.seek(0)

This is quite a stupid benchmark to write, since repeatedly seeking to 0
is a no-op. I haven't re-read the file object code recently, but chances
are that the Python file object has its own bookkeeping which adds a bit
of execution time.

But I would suggest measuring the performance of *actual* seeks to
different file offsets, before handwaving about the supposed "slowness"
of file seeks in Python.

Regards

Antoine.


==============================================================================
TOPIC: Cheeps Guest houses Karachi Independents fully furnished
http://groups.google.com/group/comp.lang.python/t/01860274448ad654?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Mar 12 2010 9:17 am
From: jgjghj


Cheeps Guest houses Karachi Independents fully furnished
Bungalows
http://guest-houses-5star-hotels-karachi.blogspot.com


== 2 of 2 ==
Date: Fri, Mar 12 2010 11:27 am
From: ghjj


Cheeps Guest houses Karachi Independents fully furnished
Bungalows
http://guest-houses-5star-hotels-karachi.blogspot.com

==============================================================================
TOPIC: Need advice on starting a Python group
http://groups.google.com/group/comp.lang.python/t/0a24bf882c72c555?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Mar 12 2010 10:31 am
From: CM


On Mar 11, 9:57 am, gb345 <gb...@invalid.com> wrote:
> I'm hoping to get advice from anyone with prior experience setting
> up a Python group.
>
> A friend of mine and I have been trying to start a
> scientific-programming-oriented Python group in our school (of
> medecine and bio research), with not much success.
>
> The main problem is attendance.  Even though a *ton* of people have
> told us that it's a great idea, that they're *very* interested,
> and have asked to be added to our mailing list, the attendance to
> our first few meeting has never been more than 5, including my
> friend and I.  Last time just he and I showed up.
>
> The second problem is getting content.  The format we'd envisioned
> for this group was centered around code review (though not limited
> to it).  The idea was that at every meeting a different member
> would show some code.  This could be for any of a number of reasons,
> such as, for example, 1) illustrate a cool module or technique; 2)
> present a scientific research problem and how they used Python to
> solve it, or get help solving it; 3) get general feedback (e.g. on
> code clarity, software usability, module architecture, etc.).  But
> in principle just about anything is OK: e.g. a talk on favorite
> Python resources, or a comparison of Python with some other language,
> or an overview of Python gotchas would all be fair game.
>
> Also, we stressed that the talks were not expected to be polished:
> no need for PowerPoint slides, etc.  Just project any old code onto
> the screen, and talk about it, or scribble stuff on the chalkboard.
>
> Still, we have a hard time finding volunteers.
>
> And even when we've had volunteers, hardly anyone shows up!

Do you advertise each time and describe what the topic will be for
that meeting and why the attendees should care? That might make a
difference. I.e., there's a big difference between:

a) The Thursday afternoon Python for scientific applications is
meeting, and I should remember that this week amidst all the other
stuff I have going on.

and

b) Wow, this Thursday there will be an hour workshop on how to create
publication quality graphs (somewhat) easily in Python using ready-
made tools...and there will be pizza!

Also, giving it a cool acronymic name doesn't hurt. :D

Che


== 2 of 2 ==
Date: Fri, Mar 12 2010 11:16 am
From: Kurt Smith


On Thu, Mar 11, 2010 at 8:57 AM, gb345 <gb345@invalid.com> wrote:
>
>
>
> I'm hoping to get advice from anyone with prior experience setting
> up a Python group.
>
> A friend of mine and I have been trying to start a
> scientific-programming-oriented Python group in our school (of
> medecine and bio research), with not much success.
>
> The main problem is attendance.  Even though a *ton* of people have
> told us that it's a great idea, that they're *very* interested,
> and have asked to be added to our mailing list, the attendance to
> our first few meeting has never been more than 5, including my
> friend and I.  Last time just he and I showed up.
>
> The second problem is getting content.  The format we'd envisioned
> for this group was centered around code review (though not limited
> to it).  The idea was that at every meeting a different member
> would show some code.  This could be for any of a number of reasons,
> such as, for example, 1) illustrate a cool module or technique; 2)
> present a scientific research problem and how they used Python to
> solve it, or get help solving it; 3) get general feedback (e.g. on
> code clarity, software usability, module architecture, etc.).  But
> in principle just about anything is OK: e.g. a talk on favorite
> Python resources, or a comparison of Python with some other language,
> or an overview of Python gotchas would all be fair game.
>
> Also, we stressed that the talks were not expected to be polished:
> no need for PowerPoint slides, etc.  Just project any old code onto
> the screen, and talk about it, or scribble stuff on the chalkboard.
>
> Still, we have a hard time finding volunteers.
>
> And even when we've had volunteers, hardly anyone shows up!
>
> Any suggestions would be appreciated.
>
> GB
>
> P.S.  There's a Python Meetup we could go to, but it does not fit
> the bill for us: it doesn't meet often enough, it's sort of out of
> the way, and has practically no one doing scientific programming.
> --
> http://mail.python.org/mailman/listinfo/python-list
>

There's a general Scientific Computing interest group that gets
together here at the University of Wisconsin-Madison, and it has a
significant Python component & focus. They put on a Python bootcamp
this January that was a huge success.

http://hackerwithin.org/cgi-bin/hackerwithin.fcgi/wiki

They have bi-weekly meetings, sometimes it's of the 'come and share on
X topic,' although many times its 'local guest speaker is coming to
speak about Y'. My impression is that the latter meetings grabbed a
number of people around campus -- 'hey, I need to do Y, I'll see what
the speaker has to say,' and then they started coming for the
show-and-tell meetings. My recommendation would be to provide
something of value every meeting, the more specific the better.
'Python' in this regard is a bit open ended. You'd likely get more
involvement if you had meetings that focused on, e.g., parallel
computing (and have examples in python (mpi4py), and have someone come
and talk about MPI or something), or scientific data formats (with
examples of pyhdf5 or pytables...), or you could advertise a tutorial
on some scipy & numpy features and their advantages over using
matlab/octave/idl.

It's more work than show-and-tell meetings, but look at it as priming the pump.

There is much interest around here re: Python in science, but many
have only heard about it, some have dabbled but put it on the shelf,
others couldn't get it to work (they're scientists and used to
prepackaged software that works out of the box -- if it doesn't, it's
somebody else's problem), many others can't justify the time it would
take to learn it when they already have something else working. Until
something with value comes along (like your meeting with specific
topics) to change their minds, an open-ended meeting won't appeal much
to them.

Just some thoughts, and an example of what's worked here. Personally
I tend to make it to the meetings with a specific topic, and end up
skipping the ones that are more open-ended.

Kurt

==============================================================================
TOPIC: question regarding wxSlider
http://groups.google.com/group/comp.lang.python/t/7000a2c895b1da4f?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 12 2010 11:08 am
From: Philip Semanchuk


On Mar 12, 2010, at 1:56 PM, Ugo Cupcic wrote:

> Hi all,
>
> I have a question regarding wxSlider. I'm developing a wxwidget python
> interface for a robotic hand. The sliders send the target values to
> the
> joints.
>
> I'd like to display the current position of the joint on the slider. I
> wanted to use wxSlider.SetTick(myposition) but I couldn't get
> SetTick to
> display anything.
>
> Anyone has an idea ? I attached a dummy code to the message to
> illustrate.


Hi Ugo,
I don't mean to chase you away, but there is a dedicated wxPython
mailing list where you obviously have a much better chance of getting
an answer.

http://www.wxpython.org/maillist.php

Developing a robotic hand sounds like fun!

Cheers
Philip


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

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