Can you introduce some book about python?

F

fdsl ysnh

--- (e-mail address removed)дµÀ:
Send Python-list mailing list submissions to
(e-mail address removed)

To subscribe or unsubscribe via the World Wide Web,
visit
http://mail.python.org/mailman/listinfo/python-list
or, via email, send a message with subject or body
'help' to
(e-mail address removed)

You can reach the person managing the list at
(e-mail address removed)

When replying, please edit your Subject line so it
is more specific
than "Re: Contents of Python-list digest..."
Today's Topics:

1. Re: appending key-value pairs to a dict (Peter
Hansen)
2. Re: Is Python suitable for a huge, enterprise
size app?
(Paul Rubin)
3. Re: appending key-value pairs to a dict (Brian
Beck)
4. Re: Comparing 2 similar strings? (Skip
Montanaro)
5. Re: Is Python suitable for a huge, enterprise
size app?
(Paul Rubin)
6. Re: buffer_info error ([email protected])
7. Re: appending key-value pairs to a dict (James
Stroud)
8. From the call hook, how do I know more
precisely what is
called? (Vijay Kumar)
9. Re: PyGame and Rotozoom (Sorry if OT) (Lee
Harr)
10. Re: buffer_info error (Jp Calderone)
11. Re: appending key-value pairs to a dict (Roy
Smith)
12. Re: Is Python suitable for a huge, enterprise
size app?
(Dave Brueck)
13. Re: Process monitoring (John Abel)
·¢¼þÈË: Peter Hansen <[email protected]>
ÊÕ¼þÈË: (e-mail address removed)
ÈÕÆÚ: Fri, 20 May 2005 16:12:17 -0400
Ö÷Ìâ: Re: appending key-value pairs to a dict
I know how to setup an empty list and loop thru something... appending
to the list on each loop... how does this work with dicts?

I'm looping thru a list of files and I want to put the file's name and
its sha hash into a dict on each loop.

Whereas with a list you would call "append" in the
loop, with a
dictionary you simply use an indexed-assignment type
of access:

mydict = {}
for filename in some_list_of_filenames:
hash =
sha.sha(open(filename).read()).hexdigest() # or
whatever
mydict[filename] = hash

-Peter
·¢¼þÈË: Paul Rubin <http://[email protected]>
ÊÕ¼þÈË: (e-mail address removed)
ÈÕÆÚ: 20 May 2005 13:12:50 -0700
Ö÷Ìâ: Re: Is Python suitable for a huge, enterprise
size app?

Dave Brueck said:
One thing from your experience that did resonate with me is that,
except for ftplib and occasionally urllib (for basic, one-shot GETs),
we don't use any of the standard library's "protocol" modules - partly
because we had to implement our own HTTP libraries for performance and
scalability reasons anyway, and partly because we had trouble figuring
out e.g. all the ins and outs of
urllib/urllib2/httplib.

What do you use for HTTPS? And did you use the
Cookie module in your
HTTP servers? You may have had problems without
even being aware of
them (until recently if you used Cookie with its
default settings, any
attacker could completely take over your server by
sending you
carefully concoted cookies). I'm not trying to be
contentious here,
just mentioning a couple further cases of where
problems aren't
visible from far away but are there when you look
close.
·¢¼þÈË: Brian Beck <[email protected]>
ÊÕ¼þÈË: (e-mail address removed)
ÈÕÆÚ: Fri, 20 May 2005 16:14:17 -0400
Ö÷Ìâ: Re: appending key-value pairs to a dict
I know how to setup an empty list and loop thru something... appending
to the list on each loop... how does this work with dicts?

I'm looping thru a list of files and I want to put the file's name and
its sha hash into a dict on each loop.

Like so:

d = {}
for filename in files:
d[sha_func(filename)] = filename


Or like so:

d = dict([(sha_func(filename), filename) for
filename in files])

--
Brian Beck
Adventurer of the First Order
·¢¼þÈË: Skip Montanaro <[email protected]>
³­ËÍ: (e-mail address removed)
ÊÕ¼þÈË: Steve Holden <[email protected]>
ÈÕÆÚ: Fri, 20 May 2005 15:16:49 -0500
Ö÷Ìâ: Re: Comparing 2 similar strings?


Steve> (is this the same as 'Conchobar'?)

No, that's a trendy pub in Key West...

<wink>

Skip
·¢¼þÈË: Paul Rubin <http://[email protected]>
ÊÕ¼þÈË: (e-mail address removed)
ÈÕÆÚ: 20 May 2005 13:15:48 -0700
Ö÷Ìâ: Re: Is Python suitable for a huge, enterprise
size app?

Fredrik Lundh said:
this has been reported before, and it won't get fixed (unless you're
volunteering to add Python-compatible garbage
collection to Tk, that is).

Yeah, I think I understand what the issue is. I can
think of some
kludgy possible fixes but I assume they've been
thought about already
and rejected. The workaround of making the
application save an extra
reference isn't too bad, but all relevant docs that
say anything about
these images should mention the requirement
emphatically.
·¢¼þÈË: "(e-mail address removed)" <[email protected]>
ÊÕ¼þÈË: (e-mail address removed)
ÈÕÆÚ: 20 May 2005 13:18:33 -0700
Ö÷Ìâ: Re: buffer_info error

i am filling in a packet with source and destination
address and using
the buffer_info call to pass on the address to an
underlying low level
call.

The src and dest are strings, but buffer_info
expects an array. How do
i deal with this?

·¢¼þÈË: James Stroud <[email protected]>
ÊÕ¼þÈË: (e-mail address removed)
ÈÕÆÚ: Fri, 20 May 2005 13:20:48 -0700
Ö÷Ìâ: Re: appending key-value pairs to a dict

I know how to setup an empty list and loop thru something... appending
to the list on each loop... how does this work with dicts?

I'm looping thru a list of files and I want to put the file's name and
its sha hash into a dict on each loop.

Many thanks,

rbt

Simple assignment.

adict[filename] = an_sha_hash



--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
·¢¼þÈË: Vijay Kumar <[email protected]>
³­ËÍ: (e-mail address removed)
ÊÕ¼þÈË: (e-mail address removed)
ÈÕÆÚ: Fri, 20 May 2005 14:21:33 -0600
Ö÷Ìâ: From the call hook, how do I know more
precisely what is called?

Hi,

I wrote a trace function using the profiling and
tracing hooks
provided by the python interpreter.

The Python interpreter reports the calls occuring in
the source
program to my trace function.

How can I know whether the call happened is a
function call or method
call and if it is a method call what is its self
object and/or class
is?.

I receive a frame object from the interpreter for
every call.

Thanks,
Vijay.
·¢¼þÈË: Lee Harr <[email protected]>
ÊÕ¼þÈË: (e-mail address removed)
ÈÕÆÚ: Fri, 20 May 2005 20:38:45 GMT
Ö÷Ìâ: Re: PyGame and Rotozoom (Sorry if OT)

I'm not sure if this is off-topic, since it doesn't deal with Python
itself, but here goes:

I'm messing around with writing a simple "game" where the player (a
crudely drawn smiley face) moves by rotating and moving back or forward
(think Resident Evil, but from an always-above view). After much
hacking, I have it working where left and right rotate the player sprite
and up always moves the sprite whichever direction it's facing, while
down is reverse. I'm using pygame.transform.RotoZoom().

My problem is that it doesn't rotate smoothly. When it rotates, the
corners of the image (just a plain white background) look like they're
hitting some barrier and making it move around. Think of an empty box
turned diagonally (so that it looks like a diamond, with its open end
facing you), and a cube in that box being turned while it's resting in
the bottom corner. I want it to rotate smoothly around its center, it's
it's not doing that.

I'm guessing that it has something to do with me not setting up a Rect
right, but I'm not sure. Maybe this is a limitation of Rotozoom/Rotate?

Any advice would be greatly appreciated. And yes, I'm a rank PyGame newbie.



You might want to try pygsear:
http://www.nongnu.org/pygsear/

It has a RotatedImage class which takes care of
rotating
things for you. See the examples roti.py and
wings.py
for some use of rotated image sprites.
·¢¼þÈË: Jp Calderone <[email protected]>
ÊÕ¼þÈË: (e-mail address removed)
ÈÕÆÚ: Fri, 20 May 2005 20:45:00 GMT
Ö÷Ìâ: Re: buffer_info error

i am filling in a packet with source and destination address and using
the buffer_info call to pass on the address to an underlying low level
call.

The src and dest are strings, but buffer_info expects an array. How do
i deal with this?

What's the low-level call you're invoking?

Jp
·¢¼þÈË: (e-mail address removed) (Roy Smith)
ÊÕ¼þÈË: (e-mail address removed)
ÈÕÆÚ: 20 May 2005 16:50:39 -0400
Ö÷Ìâ: Re: appending key-value pairs to a dict

rbt said:
I know how to setup an empty list and loop thru something... appending
to the list on each loop... how does this work with dicts?

I'm looping thru a list of files and I want to put the file's name and
its sha hash into a dict on each loop.

You just assign values to keys. If the key doesn't
exist, it's
created automagically. You want something like
this:

shaDict = {}
for fileName in fileNameList:
hash = generateShaHash (fileName)
shaDict[hash] = fileName
·¢¼þÈË: Dave Brueck <[email protected]>
ÊÕ¼þÈË: (e-mail address removed)
ÈÕÆÚ: Fri, 20 May 2005 15:07:05 -0600
Ö÷Ìâ: Re: Is Python suitable for a huge, enterprise
size app?

Paul said:
urllib/urllib2/httplib.


What do you use for HTTPS?

Hi Paul,

m2crypto (plus some patches to make asynchronous SSL
do what we needed).
And did you use the Cookie module in your
HTTP servers? You may have had problems without even being aware of
them (until recently if you used Cookie with its default settings, any
attacker could completely take over your server by sending you
carefully concoted cookies).

Are you referring to the use of pickle for cookie
serialization? In any case, we
didn't use Cookie.py from the stdlib (on the
servers, nearly everything related
to URLs & HTTP was custom-built, with the exception
of urlparse, for the
aforemenioned reasons).

-Dave
·¢¼þÈË: John Abel <[email protected]>
³­ËÍ: (e-mail address removed)
ÈÕÆÚ: Fri, 20 May 2005 22:24:14 +0100
Ö÷Ìâ: Re: Process monitoring
Hey, I'm working on a Python program that will launch some other
non-Python process using os.spawn (in the os.P_NOWAIT mode) and then
basically wait for it to finish (while doing some other stuff in the
interim). Normally, the new process will signal that it's done by
writing to a file, but I'd like to also find out if the new process
died unexpectedly. Anyone know any preferrable ways to do this?

Greg Steffensen
If you're using 2.4, have a look at the subprocess
module.

J
http://mail.python.org/mailman/listinfo/python-list
I am a beginner,Can you introduce some book about
python? I am a student of china

_________________________________________________________
Do You Yahoo!?
150ÍòÇúMP3·è¿ñËÑ£¬´øÄú´³ÈëÒôÀÖµîÌÃ
http://cn.rd.yahoo.com/mail_cn/tag/yisou/music/*http://music.yisou.com/
ÃÀÅ®Ã÷ÐÇÓ¦Óо¡ÓУ¬ËѱéÃÀͼ¡¢ÑÞͼºÍ¿áͼ
http://cn.rd.yahoo.com/mail_cn/tag/yisou/image/*http://image.yisou.com
1G¾ÍÊÇ1000Õ×£¬ÑÅ»¢µçÓÊ×ÔÖúÀ©ÈÝ£¡
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/
 
R

rdsteph

You m,igth try my page of Python Book reviews at
http://www.awaretek.com/book.html

Ron Stephens


fdsl said:
--- (e-mail address removed)写é“:
Send Python-list mailing list submissions to
(e-mail address removed)

To subscribe or unsubscribe via the World Wide Web,
visit
http://mail.python.org/mailman/listinfo/python-list
or, via email, send a message with subject or body
'help' to
(e-mail address removed)

You can reach the person managing the list at
(e-mail address removed)

When replying, please edit your Subject line so it
is more specific
than "Re: Contents of Python-list digest..."
Today's Topics:

1. Re: appending key-value pairs to a dict (Peter
Hansen)
2. Re: Is Python suitable for a huge, enterprise
size app?
(Paul Rubin)
3. Re: appending key-value pairs to a dict (Brian
Beck)
4. Re: Comparing 2 similar strings? (Skip
Montanaro)
5. Re: Is Python suitable for a huge, enterprise
size app?
(Paul Rubin)
6. Re: buffer_info error ([email protected])
7. Re: appending key-value pairs to a dict (James
Stroud)
8. From the call hook, how do I know more
precisely what is
called? (Vijay Kumar)
9. Re: PyGame and Rotozoom (Sorry if OT) (Lee
Harr)
10. Re: buffer_info error (Jp Calderone)
11. Re: appending key-value pairs to a dict (Roy
Smith)
12. Re: Is Python suitable for a huge, enterprise
size app?
(Dave Brueck)
13. Re: Process monitoring (John Abel)
å‘件人: Peter Hansen <[email protected]>
收件人: (e-mail address removed)
日期: Fri, 20 May 2005 16:12:17 -0400
主题: Re: appending key-value pairs to a dict
I know how to setup an empty list and loop thru something... appending
to the list on each loop... how does this work with dicts?

I'm looping thru a list of files and I want to put the file's name and
its sha hash into a dict on each loop.

Whereas with a list you would call "append" in the
loop, with a
dictionary you simply use an indexed-assignment type
of access:

mydict = {}
for filename in some_list_of_filenames:
hash =
sha.sha(open(filename).read()).hexdigest() # or
whatever
mydict[filename] = hash

-Peter
å‘件人: Paul Rubin <http://[email protected]>
收件人: (e-mail address removed)
日期: 20 May 2005 13:12:50 -0700
主题: Re: Is Python suitable for a huge, enterprise
size app?

Dave Brueck said:
One thing from your experience that did resonate with me is that,
except for ftplib and occasionally urllib (for basic, one-shot GETs),
we don't use any of the standard library's "protocol" modules - partly
because we had to implement our own HTTP libraries for performance and
scalability reasons anyway, and partly because we had trouble figuring
out e.g. all the ins and outs of
urllib/urllib2/httplib.

What do you use for HTTPS? And did you use the
Cookie module in your
HTTP servers? You may have had problems without
even being aware of
them (until recently if you used Cookie with its
default settings, any
attacker could completely take over your server by
sending you
carefully concoted cookies). I'm not trying to be
contentious here,
just mentioning a couple further cases of where
problems aren't
visible from far away but are there when you look
close.
å‘件人: Brian Beck <[email protected]>
收件人: (e-mail address removed)
日期: Fri, 20 May 2005 16:14:17 -0400
主题: Re: appending key-value pairs to a dict
I know how to setup an empty list and loop thru something... appending
to the list on each loop... how does this work with dicts?

I'm looping thru a list of files and I want to put the file's name and
its sha hash into a dict on each loop.

Like so:

d = {}
for filename in files:
d[sha_func(filename)] = filename


Or like so:

d = dict([(sha_func(filename), filename) for
filename in files])

--
Brian Beck
Adventurer of the First Order
å‘件人: Skip Montanaro <[email protected]>
抄é€: (e-mail address removed)
收件人: Steve Holden <[email protected]>
日期: Fri, 20 May 2005 15:16:49 -0500
主题: Re: Comparing 2 similar strings?


Steve> (is this the same as 'Conchobar'?)

No, that's a trendy pub in Key West...

<wink>

Skip
å‘件人: Paul Rubin <http://[email protected]>
收件人: (e-mail address removed)
日期: 20 May 2005 13:15:48 -0700
主题: Re: Is Python suitable for a huge, enterprise
size app?

Fredrik Lundh said:
this has been reported before, and it won't get fixed (unless you're
volunteering to add Python-compatible garbage
collection to Tk, that is).

Yeah, I think I understand what the issue is. I can
think of some
kludgy possible fixes but I assume they've been
thought about already
and rejected. The workaround of making the
application save an extra
reference isn't too bad, but all relevant docs that
say anything about
these images should mention the requirement
emphatically.
å‘件人: "(e-mail address removed)" <[email protected]>
收件人: (e-mail address removed)
日期: 20 May 2005 13:18:33 -0700
主题: Re: buffer_info error

i am filling in a packet with source and destination
address and using
the buffer_info call to pass on the address to an
underlying low level
call.

The src and dest are strings, but buffer_info
expects an array. How do
i deal with this?

å‘件人: James Stroud <[email protected]>
收件人: (e-mail address removed)
日期: Fri, 20 May 2005 13:20:48 -0700
主题: Re: appending key-value pairs to a dict

I know how to setup an empty list and loop thru something... appending
to the list on each loop... how does this work with dicts?

I'm looping thru a list of files and I want to put the file's name and
its sha hash into a dict on each loop.

Many thanks,

rbt

Simple assignment.

adict[filename] = an_sha_hash



--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
å‘件人: Vijay Kumar <[email protected]>
抄é€: (e-mail address removed)
收件人: (e-mail address removed)
日期: Fri, 20 May 2005 14:21:33 -0600
主题: From the call hook, how do I know more
precisely what is called?

Hi,

I wrote a trace function using the profiling and
tracing hooks
provided by the python interpreter.

The Python interpreter reports the calls occuring in
the source
program to my trace function.

How can I know whether the call happened is a
function call or method
call and if it is a method call what is its self
object and/or class
is?.

I receive a frame object from the interpreter for
every call.

Thanks,
Vijay.
å‘件人: Lee Harr <[email protected]>
收件人: (e-mail address removed)
日期: Fri, 20 May 2005 20:38:45 GMT
主题: Re: PyGame and Rotozoom (Sorry if OT)

I'm not sure if this is off-topic, since it doesn't deal with Python
itself, but here goes:

I'm messing around with writing a simple "game" where the player (a
crudely drawn smiley face) moves by rotating and moving back or forward
(think Resident Evil, but from an always-above view). After much
hacking, I have it working where left and right rotate the player sprite
and up always moves the sprite whichever direction it's facing, while
down is reverse. I'm using pygame.transform.RotoZoom().

My problem is that it doesn't rotate smoothly. When it rotates, the
corners of the image (just a plain white background) look like they're
hitting some barrier and making it move around. Think of an empty box
turned diagonally (so that it looks like a diamond, with its open end
facing you), and a cube in that box being turned while it's resting in
the bottom corner. I want it to rotate smoothly around its center, it's
it's not doing that.

I'm guessing that it has something to do with me not setting up a Rect
right, but I'm not sure. Maybe this is a limitation of Rotozoom/Rotate?

Any advice would be greatly appreciated. And yes, I'm a rank PyGame newbie.



You might want to try pygsear:
http://www.nongnu.org/pygsear/

It has a RotatedImage class which takes care of
rotating
things for you. See the examples roti.py and
wings.py
for some use of rotated image sprites.
å‘件人: Jp Calderone <[email protected]>
收件人: (e-mail address removed)
日期: Fri, 20 May 2005 20:45:00 GMT
主题: Re: buffer_info error

i am filling in a packet with source and destination address and using
the buffer_info call to pass on the address to an underlying low level
call.

The src and dest are strings, but buffer_info expects an array. How do
i deal with this?

What's the low-level call you're invoking?

Jp
å‘件人: (e-mail address removed) (Roy Smith)
收件人: (e-mail address removed)
日期: 20 May 2005 16:50:39 -0400
主题: Re: appending key-value pairs to a dict

rbt said:
I know how to setup an empty list and loop thru something... appending
to the list on each loop... how does this work with dicts?

I'm looping thru a list of files and I want to put the file's name and
its sha hash into a dict on each loop.

You just assign values to keys. If the key doesn't
exist, it's
created automagically. You want something like
this:

shaDict = {}
for fileName in fileNameList:
hash = generateShaHash (fileName)
shaDict[hash] = fileName
å‘件人: Dave Brueck <[email protected]>
收件人: (e-mail address removed)
日期: Fri, 20 May 2005 15:07:05 -0600
主题: Re: Is Python suitable for a huge, enterprise
size app?

Paul said:
One thing from your experience that did resonate with me is that,
except for ftplib and occasionally urllib (for basic, one-shot GETs),
we don't use any of the standard library's "protocol" modules - partly
because we had to implement our own HTTP libraries for performance and
scalability reasons anyway, and partly because we had trouble figuring
out e.g. all the ins and outs of urllib/urllib2/httplib.


What do you use for HTTPS?

Hi Paul,

m2crypto (plus some patches to make asynchronous SSL
do what we needed).
And did you use the Cookie module in your
HTTP servers? You may have had problems without even being aware of
them (until recently if you used Cookie with its default settings, any
attacker could completely take over your server by sending you
carefully concoted cookies).

Are you referring to the use of pickle for cookie
serialization? In any case, we
didn't use Cookie.py from the stdlib (on the
servers, nearly everything related
to URLs & HTTP was custom-built, with the exception
of urlparse, for the
aforemenioned reasons).

-Dave
å‘件人: John Abel <[email protected]>
抄é€: (e-mail address removed)
日期: Fri, 20 May 2005 22:24:14 +0100
主题: Re: Process monitoring
Hey, I'm working on a Python program that will launch some other
non-Python process using os.spawn (in the os.P_NOWAIT mode) and then
basically wait for it to finish (while doing some other stuff in the
interim). Normally, the new process will signal that it's done by
writing to a file, but I'd like to also find out if the new process
died unexpectedly. Anyone know any preferrable ways to do this?

Greg Steffensen
If you're using 2.4, have a look at the subprocess
module.

J
http://mail.python.org/mailman/listinfo/python-list
I am a beginner,Can you introduce some book about
python? I am a student of china

_________________________________________________________
Do You Yahoo!?
150万曲MP3疯狂æœï¼Œå¸¦æ‚¨é—¯å…¥éŸ³ä¹æ®¿å ‚
http://cn.rd.yahoo.com/mail_cn/tag/yisou/music/*http://music.yisou.com/
美女明星应有尽有,æœé美图ã€è‰³å›¾å’Œé…·å›¾
http://cn.rd.yahoo.com/mail_cn/tag/yisou/image/*http://image.yisou.com
1G就是1000兆,雅虎电邮自助扩容ï¼
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/
 
H

Heiko Wundram

Am Samstag, 21. Mai 2005 08:59 schrieb (e-mail address removed):

Quoting a senseless quote, bravo!

...

wasting-bandwith-sure-is-fun-over-ISDN-'ly yours,

--
--- Heiko.
see you at: http://www.stud.mh-hannover.de/~hwundram/wordpress/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBCjvoOf0bpgh6uVAMRAv+MAJsFZIET+fn6+EuJqz+TMnAq9HD0qQCff46s
w4icSkQnMmtnq9IjMpA0e7A=
=UQEK
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top