Add folder with Python mailing list messages
parent
3a1bf315aa
commit
6d39a20d84
@ -0,0 +1,79 @@
|
||||
From: jepler at inetnebr.com (Jeff Epler)
|
||||
Date: 21 Feb 1999 18:21:29 GMT
|
||||
Subject: New (?) suggestion to solve "assignment-in-while" desire
|
||||
Message-ID: <mailman.0.1433094741.31156.python-list@python.org>
|
||||
X-IMAPbase: 1567524838 0000742335
|
||||
X-UID: 1
|
||||
Content-Length: 2202
|
||||
|
||||
We all know what the problem looks like:
|
||||
|
||||
while 1:
|
||||
x=sys.stdin.readline()
|
||||
if not x: break
|
||||
....
|
||||
|
||||
well, someone can write an "xreadlines" which permits
|
||||
for i in xreadlines(sys.stdin):
|
||||
....
|
||||
|
||||
but next, who knows what "x"-function we will need.
|
||||
|
||||
And, at the same time, "for" embodies a test (for IndexError) and an
|
||||
assignment (to the loop variable). So what we need is a nice, generic
|
||||
class to embody this sort of functionality, with the ability to use an
|
||||
arbitrary test on the assigned value, as well as accept an arbitrary
|
||||
exception as an "end of loop" marker.
|
||||
|
||||
This is an implementation of the "lazy" class, which does what I've
|
||||
discussed:
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
class lazy:
|
||||
def __init__(self, function, test=lambda x: not x, exception=None,
|
||||
index=0):
|
||||
self.f=function
|
||||
self.t=test
|
||||
self.e=exception
|
||||
self.i=index
|
||||
|
||||
def __getitem__(self, i):
|
||||
try:
|
||||
if self.i: ret=self.f(i)
|
||||
else: ret=self.f()
|
||||
except self.e:
|
||||
raise IndexError
|
||||
if self.t(ret):
|
||||
raise IndexError
|
||||
return ret
|
||||
--------------------------------------------------------------------------
|
||||
here are some uses of it: xreadlines, and "xrange1" a limited
|
||||
reimplementation of xrange.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
xreadlines=lambda x: lazy(x.readline, exception=EOFError)
|
||||
xrange1=lambda min, max, inc: lazy(lambda x, min=min, inc=inc: min+inc*x,
|
||||
lambda y, max=max: y>=max, index=1)
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
the basic
|
||||
for i in lazy(f):
|
||||
body
|
||||
is the same as:
|
||||
while 1:
|
||||
i=f()
|
||||
if not i: break
|
||||
body
|
||||
|
||||
but you can embellish with more complicated tests, exception tests, or
|
||||
whatever.
|
||||
|
||||
The class assumes it will be called in a "for-like way" so please refrain
|
||||
from taunting it.
|
||||
|
||||
Jeff
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,77 @@
|
||||
From: jepler at inetnebr.com (Jeff Epler)
|
||||
Date: 21 Feb 1999 18:21:29 GMT
|
||||
Subject: New (?) suggestion to solve "assignment-in-while" desire
|
||||
Message-ID: <mailman.3.1433095024.31156.python-list@python.org>
|
||||
X-UID: 2
|
||||
Content-Length: 2201
|
||||
|
||||
We all know what the problem looks like:
|
||||
|
||||
while 1:
|
||||
x=sys.stdin.readline()
|
||||
if not x: break
|
||||
....
|
||||
|
||||
well, someone can write an "xreadlines" which permits
|
||||
for i in xreadlines(sys.stdin):
|
||||
....
|
||||
|
||||
but next, who knows what "x"-function we will need.
|
||||
|
||||
And, at the same time, "for" embodies a test (for IndexError) and an
|
||||
assignment (to the loop variable). So what we need is a nice, generic
|
||||
class to embody this sort of functionality, with the ability to use an
|
||||
arbitrary test on the assigned value, as well as accept an arbitrary
|
||||
exception as an "end of loop" marker.
|
||||
|
||||
This is an implementation of the "lazy" class, which does what I've
|
||||
discussed:
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
class lazy:
|
||||
def __init__(self, function, test=lambda x: not x, exception=None,
|
||||
index=0):
|
||||
self.f=function
|
||||
self.t=test
|
||||
self.e=exception
|
||||
self.i=index
|
||||
|
||||
def __getitem__(self, i):
|
||||
try:
|
||||
if self.i: ret=self.f(i)
|
||||
else: ret=self.f()
|
||||
except self.e:
|
||||
raise IndexError
|
||||
if self.t(ret):
|
||||
raise IndexError
|
||||
return ret
|
||||
--------------------------------------------------------------------------
|
||||
here are some uses of it: xreadlines, and "xrange1" a limited
|
||||
reimplementation of xrange.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
xreadlines=lambda x: lazy(x.readline, exception=EOFError)
|
||||
xrange1=lambda min, max, inc: lazy(lambda x, min=min, inc=inc: min+inc*x,
|
||||
lambda y, max=max: y>=max, index=1)
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
the basic
|
||||
for i in lazy(f):
|
||||
body
|
||||
is the same as:
|
||||
while 1:
|
||||
i=f()
|
||||
if not i: break
|
||||
body
|
||||
|
||||
but you can embellish with more complicated tests, exception tests, or
|
||||
whatever.
|
||||
|
||||
The class assumes it will be called in a "for-like way" so please refrain
|
||||
from taunting it.
|
||||
|
||||
Jeff
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
From: wavers at mail.pt (waver)
|
||||
Date: Sat, 27 Mar 1999 15:25:30 +0000
|
||||
Subject: help-me please
|
||||
Message-ID: <000801be7866$0d4d0020$6d0f1ed5@wavers>
|
||||
Content-Length: 1106
|
||||
X-UID: 3
|
||||
|
||||
Hi!
|
||||
i am a portuguese guy that heve some questions about Python.
|
||||
I read some tuturials but all only talk about how to program with Python
|
||||
and
|
||||
that is very important) but i want to know some other things:
|
||||
1-What do we do with Python?
|
||||
2-Can Python do some programs ?
|
||||
3-Python is a language only to Internet or can do some programs ?
|
||||
4-Explain how do i write my things in Python , i know that in the Python
|
||||
Shell we can write some commands but if i want to build some thing in Python
|
||||
i write in notepad and then how do i test it ??
|
||||
5-Does any Web Hosting Server support Python?
|
||||
|
||||
I know that are some lhamme questions but i want to learn Python so first i
|
||||
nedd to know how does Python word and what does it do.
|
||||
So please try to answear my questions , and for that email-me wavers at mail.pt
|
||||
because i don`t know how to work with newsgroup.
|
||||
Thank very much AND PELASE ANSWER MY QUESTION WITH ANY EMAIL TO
|
||||
WAVERS at MAIL.PT .
|
||||
|
||||
Byeeeeee
|
||||
|
||||
-------------- next part --------------
|
||||
An HTML attachment was scrubbed...
|
||||
URL: <http://mail.python.org/pipermail/python-list/attachments/19990327/b369b473/attachment.html>
|
||||
|
||||
|
@ -0,0 +1,35 @@
|
||||
From: python at rose164.wuh.wustl.edu (David Fisher)
|
||||
Date: Sat, 20 Mar 1999 19:48:27 -0600
|
||||
Subject: Simple tuple question
|
||||
Message-ID: <021001be7343$35563dc0$8f3dfc80@spkydomain>
|
||||
Content-Length: 1251
|
||||
X-UID: 4
|
||||
|
||||
Spam detection software, running on the system "albatross.python.org", has
|
||||
identified this incoming email as possible spam. The original message
|
||||
has been attached to this so you can view it (if it isn't spam) or label
|
||||
similar future email. If you have any questions, see
|
||||
the administrator of that system for details.
|
||||
|
||||
Content preview: ----- Original Message ----- From: "Jeff Shipman" <shippy at cs.nmt.edu>
|
||||
Newsgroups: comp.lang.python To: <python-list at python.org> Sent: Monday, March
|
||||
20, 2000 11:54 AM Subject: Re: Simple tuple question [...]
|
||||
|
||||
Content analysis details: (5.7 points, 5.0 required)
|
||||
|
||||
pts rule name description
|
||||
---- ---------------------- --------------------------------------------------
|
||||
2.0 FH_DATE_IS_19XX The date is not 19xx.
|
||||
1.4 NO_DNS_FOR_FROM DNS: Envelope sender has no MX or A DNS records
|
||||
2.3 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date
|
||||
|
||||
|
||||
-------------- next part --------------
|
||||
An embedded message was scrubbed...
|
||||
From: "David Fisher" <python at rose164.wuh.wustl.edu>
|
||||
Subject: Re: Simple tuple question
|
||||
Date: Sat, 20 Mar 1999 19:48:27 -0600
|
||||
Size: 1894
|
||||
URL: <http://mail.python.org/pipermail/python-list/attachments/19990320/1ce203c0/attachment.mht>
|
||||
|
||||
|
@ -0,0 +1,36 @@
|
||||
From: python at rose164.wuh.wustl.edu (David Fisher)
|
||||
Date: Sun, 21 Mar 1999 11:37:38 -0600
|
||||
Subject: making py modules with C
|
||||
Message-ID: <012701be73c1$a2872200$573dfc80@spkydomain>
|
||||
Content-Length: 1284
|
||||
X-UID: 5
|
||||
|
||||
Spam detection software, running on the system "albatross.python.org", has
|
||||
identified this incoming email as possible spam. The original message
|
||||
has been attached to this so you can view it (if it isn't spam) or label
|
||||
similar future email. If you have any questions, see
|
||||
the administrator of that system for details.
|
||||
|
||||
Content preview: ----- Original Message ----- From: "Gordon McMillan" <gmcm at hypernet.com>
|
||||
To: "David Fisher" <python at rose164.wuh.wustl.edu>; <python-list at python.org>
|
||||
Sent: Tuesday, March 21, 2000 6:49 AM Subject: Re: making py modules with
|
||||
C [...]
|
||||
|
||||
Content analysis details: (5.7 points, 5.0 required)
|
||||
|
||||
pts rule name description
|
||||
---- ---------------------- --------------------------------------------------
|
||||
1.4 NO_DNS_FOR_FROM DNS: Envelope sender has no MX or A DNS records
|
||||
2.0 FH_DATE_IS_19XX The date is not 19xx.
|
||||
2.3 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date
|
||||
|
||||
|
||||
-------------- next part --------------
|
||||
An embedded message was scrubbed...
|
||||
From: "David Fisher" <python at rose164.wuh.wustl.edu>
|
||||
Subject: Re: making py modules with C
|
||||
Date: Sun, 21 Mar 1999 11:37:38 -0600
|
||||
Size: 2969
|
||||
URL: <http://mail.python.org/pipermail/python-list/attachments/19990321/3f73cd3d/attachment.mht>
|
||||
|
||||
|
@ -0,0 +1,36 @@
|
||||
From: python at rose164.wuh.wustl.edu (David Fisher)
|
||||
Date: Sat, 20 Mar 1999 20:32:35 -0600
|
||||
Subject: making py modules with C
|
||||
Message-ID: <021101be7343$36381240$8f3dfc80@spkydomain>
|
||||
Content-Length: 1294
|
||||
X-UID: 6
|
||||
|
||||
Spam detection software, running on the system "albatross.python.org", has
|
||||
identified this incoming email as possible spam. The original message
|
||||
has been attached to this so you can view it (if it isn't spam) or label
|
||||
similar future email. If you have any questions, see
|
||||
the administrator of that system for details.
|
||||
|
||||
Content preview: I don't know about the make but I can point out a few syntax
|
||||
errors. ----- Original Message ----- From: "Shaun Hogan" <shogan at iel.ie>
|
||||
To: "python" <python-list at cwi.nl> Sent: Monday, March 20, 2000 4:56 AM Subject:
|
||||
making py modules with C [...]
|
||||
|
||||
Content analysis details: (5.7 points, 5.0 required)
|
||||
|
||||
pts rule name description
|
||||
---- ---------------------- --------------------------------------------------
|
||||
1.4 NO_DNS_FOR_FROM DNS: Envelope sender has no MX or A DNS records
|
||||
2.0 FH_DATE_IS_19XX The date is not 19xx.
|
||||
2.3 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date
|
||||
|
||||
|
||||
-------------- next part --------------
|
||||
An embedded message was scrubbed...
|
||||
From: "David Fisher" <python at rose164.wuh.wustl.edu>
|
||||
Subject: Re: making py modules with C
|
||||
Date: Sat, 20 Mar 1999 20:32:35 -0600
|
||||
Size: 3327
|
||||
URL: <http://mail.python.org/pipermail/python-list/attachments/19990320/fbf53fd2/attachment.mht>
|
||||
|
||||
|
@ -0,0 +1,37 @@
|
||||
From: python at rose164.wuh.wustl.edu (David Fisher)
|
||||
Date: Sun, 21 Mar 1999 10:37:41 -0600
|
||||
Subject: Importing "Modules"
|
||||
Message-ID: <007d01be73b9$38fb7460$573dfc80@spkydomain>
|
||||
Content-Length: 1353
|
||||
X-UID: 7
|
||||
|
||||
Spam detection software, running on the system "albatross.python.org", has
|
||||
identified this incoming email as possible spam. The original message
|
||||
has been attached to this so you can view it (if it isn't spam) or label
|
||||
similar future email. If you have any questions, see
|
||||
the administrator of that system for details.
|
||||
|
||||
Content preview: ----- Original Message ----- From: "Adrian Eyre" <a.eyre at optichrome.com>
|
||||
To: "JJ" <joacim at home.se>; <python-list at python.org> Sent: Tuesday, March
|
||||
21, 2000 5:45 AM Subject: RE: Importing "Modules" > > Constants.pyc > > [snip]
|
||||
> > Call this file "Constants.py". The .pyc will be generated for you. >
|
||||
[...]
|
||||
|
||||
Content analysis details: (5.7 points, 5.0 required)
|
||||
|
||||
pts rule name description
|
||||
---- ---------------------- --------------------------------------------------
|
||||
1.4 NO_DNS_FOR_FROM DNS: Envelope sender has no MX or A DNS records
|
||||
2.0 FH_DATE_IS_19XX The date is not 19xx.
|
||||
2.3 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date
|
||||
|
||||
|
||||
-------------- next part --------------
|
||||
An embedded message was scrubbed...
|
||||
From: "David Fisher" <python at rose164.wuh.wustl.edu>
|
||||
Subject: Re: Importing "Modules"
|
||||
Date: Sun, 21 Mar 1999 10:37:41 -0600
|
||||
Size: 3255
|
||||
URL: <http://mail.python.org/pipermail/python-list/attachments/19990321/d1654221/attachment.mht>
|
||||
|
||||
|
@ -0,0 +1,37 @@
|
||||
From: python at rose164.wuh.wustl.edu (David Fisher)
|
||||
Date: Wed, 17 Mar 1999 09:31:02 -0600
|
||||
Subject: Code basics
|
||||
Message-ID: <011901be708b$41ebf3a0$3f3dfc80@spkydomain>
|
||||
Content-Length: 1432
|
||||
X-UID: 8
|
||||
|
||||
Spam detection software, running on the system "albatross.python.org", has
|
||||
identified this incoming email as possible spam. The original message
|
||||
has been attached to this so you can view it (if it isn't spam) or label
|
||||
similar future email. If you have any questions, see
|
||||
the administrator of that system for details.
|
||||
|
||||
Content preview: Hi JJ, You indicate a block with indentation. Like so: while
|
||||
notDone: chip = self.getNumberOfSomething() if chip == 10: print "Tjohoo"
|
||||
else: print "Oh no!" I changed the this to self because thats the usual way
|
||||
of calling an instance method. Just pretend there's a class floating just
|
||||
off screen that this is inside of. [...]
|
||||
|
||||
Content analysis details: (5.3 points, 5.0 required)
|
||||
|
||||
pts rule name description
|
||||
---- ---------------------- --------------------------------------------------
|
||||
1.4 NO_DNS_FOR_FROM DNS: Envelope sender has no MX or A DNS records
|
||||
2.0 FH_DATE_IS_19XX The date is not 19xx.
|
||||
2.3 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date
|
||||
-0.4 AWL AWL: From: address is in the auto white-list
|
||||
|
||||
|
||||
-------------- next part --------------
|
||||
An embedded message was scrubbed...
|
||||
From: "David Fisher" <python at rose164.wuh.wustl.edu>
|
||||
Subject: Re: Code basics
|
||||
Date: Wed, 17 Mar 1999 09:31:02 -0600
|
||||
Size: 2336
|
||||
URL: <http://mail.python.org/pipermail/python-list/attachments/19990317/a65f1127/attachment.mht>
|
||||
|
@ -0,0 +1,29 @@
|
||||
From: mail at to.me (Usenet User)
|
||||
Date: 28 Apr 1999 05:53:36 GMT
|
||||
Subject: GUI other than Tkinter (TVision?)
|
||||
References: <3721567f.1748033@news> <7g1a8h$fae$1@Starbase.NeoSoft.COM>
|
||||
Message-ID: <8DB68CFE2HolyMama@bbinews.netvigator.com>
|
||||
X-UID: 9
|
||||
|
||||
Anyone interested in wrap this TVision with python?
|
||||
http://www.geocities.com/SiliconValley/Vista/6552/tvision.html
|
||||
|
||||
Turbo Vision is the good old TUI (Text User Interface) we
|
||||
used in Turbo C++ and it is GPLed. It is written in C++ and maybe someone
|
||||
want to wrap it with python.
|
||||
|
||||
==========
|
||||
What's Turbo Vision?
|
||||
|
||||
Turbo Vision (TVision for short) is a TUI (Text User Interface) that
|
||||
implements the well known CUA widgets. With TVision you can create an
|
||||
intuitive text mode application, intuitive means it will have CUA like
|
||||
interface (check boxes, radio buttons, push buttons, input lines, pull
|
||||
-down menues, status bars, etc.). All the people acustomed to the
|
||||
Windows, MacOS, OS/2, Motif, GTK, etc. interfaces will understand the
|
||||
interface at first sight.
|
||||
===========
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,51 @@
|
||||
From: mcannon at 21stcentury.net (Michael J. Cannon)
|
||||
Date: Mon, 12 Apr 1999 23:40:19 -0500
|
||||
Subject: Python and Nutcracker
|
||||
References: <370B62F2.93D76301@oi42.kwu.siemens.de>
|
||||
Message-ID: <3712CAB2.77A5AF2B@21stcentury.net>
|
||||
Content-Length: 1650
|
||||
X-UID: 10
|
||||
|
||||
Dr Tschammer:
|
||||
|
||||
Speaking from experience, both in supporting (independently of
|
||||
DataFocus) and porting, all I can say is be careful of the I/O and
|
||||
exception handling in the Nutcracker, especially when addressing issues
|
||||
involved in Winsock and calls to any messaging .dll's or libraries.
|
||||
Also, your users will have to disable the Nutcracker service manually
|
||||
when doing backups from NT databases on the server (especially SQL
|
||||
server and Oracle) and then manually restart, as cron and at -type calls
|
||||
are problematic with the Nutcracker services running. Finally, license
|
||||
WinBatch for your customers/users as they will need it.
|
||||
|
||||
Personally, I have given up on Nutcracker as support is both expensive
|
||||
and a nightmare of frustrated users. My preferred platform is now Java
|
||||
(via javat) or a mix of c (GNU C or C+/++) and python.
|
||||
|
||||
For a taste of what you're in for as far as support, check out the EDI-L
|
||||
mailing list and watch for messages on Harbinger's TLE product (formerly
|
||||
UNIX PREMENOS), or see if you can't get in contact with someone who will
|
||||
honestly critique NUWC's efforts (prominently featured on the DataFocus
|
||||
site).
|
||||
|
||||
My feeling is that Nutcracker was a good idea with a rushed
|
||||
implementation. With all the faults of NT, to depend on a set of
|
||||
libraries existing as a service, poorly implemented, is asking for
|
||||
trouble.
|
||||
|
||||
"Dr. Armin Tschammer" wrote:
|
||||
|
||||
> Hi,
|
||||
> Has anyone experience with Python and Nutcracker ?
|
||||
> We are using embedded Python in our application which
|
||||
> is developed under HPUX.
|
||||
> We are now porting our application to Windows NT
|
||||
> with the help of the Nutcracker library.
|
||||
> Has anyone already done such stuff ?
|
||||
>
|
||||
> Armin
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,108 @@
|
||||
From: faassen at pop.vet.uu.nl (Martijn Faassen)
|
||||
Date: Thu, 22 Apr 1999 19:49:24 +0200
|
||||
Subject: Pointers to variables
|
||||
References: <19990422121403.A279051@vislab.epa.gov>
|
||||
Message-ID: <371F6124.48EA9794@pop.vet.uu.nl>
|
||||
Content-Length: 3214
|
||||
X-UID: 11
|
||||
|
||||
Randall Hopper wrote:
|
||||
>
|
||||
> This doesn't work:
|
||||
>
|
||||
> for ( var, str ) in [( self.min, 'min_units' ),
|
||||
> ( self.max, 'max_units' )]:
|
||||
> if cnf.has_key( str ):
|
||||
> var = cnf[ str ]
|
||||
> del cnf[ str ]
|
||||
>
|
||||
> It doesn't assign values to self.min, self.max (both integers). The values
|
||||
> of these variables are inserted into the tuples and not references to the
|
||||
> variables themselves, which is the problem.
|
||||
>
|
||||
> How can I cause a reference to the variables to be stored in the tuples
|
||||
> instead of their values?
|
||||
|
||||
Hi there,
|
||||
|
||||
I've been trying to understand the purpose of the code in your fragment
|
||||
and your question for a minute or so, but I'm not entirely sure I get it
|
||||
yet.
|
||||
|
||||
I'm assuming what you want is to get 'cnf[str]' assigned to self.min or
|
||||
self.max.
|
||||
|
||||
What you could do is something like this:
|
||||
|
||||
for str in ('min_units', 'max_units'):
|
||||
if cnf.has_key(str):
|
||||
setattr(self, str, cnf[str])
|
||||
del cnf[str]
|
||||
|
||||
Tuples, by the way are immutable, so you can't change what values their
|
||||
elements point to after they've been created (though if these values
|
||||
point to other things themselves you can change that). That is, you
|
||||
can't do this:
|
||||
|
||||
foo = (value1, value2)
|
||||
foo[0] = "hey"
|
||||
|
||||
But, if you'd use a mutable list, you still run into trouble. If you say
|
||||
this:
|
||||
|
||||
mylist = [None] # list with a single element
|
||||
None
|
||||
variable_i_want_to_change = "Foo" # a variable I want to
|
||||
change
|
||||
mylist[0] = variable_i_want_to_change # okay, mylist[0] points to
|
||||
same data
|
||||
mylist[0] = "Bar" # now mylist[0] points to
|
||||
different data
|
||||
|
||||
then 'variable_i_want_to_change' won't change. You've simply changed
|
||||
what value mylist[0] points at. This is because a string (and integers
|
||||
etc) are immutable values in Python. If you use a mutable value such as
|
||||
a dictionary, you get this:
|
||||
|
||||
mylist = [None]
|
||||
variable_i_want_to_change = {}
|
||||
mylist[0] = variable_i_want_to_change
|
||||
mylist[0]["some key"] = "bar" # indeed changes
|
||||
variable_i_want_to_change!
|
||||
# mylist[0] = "Bar" -- doesn't work, makes mylist[0] point elsewhere
|
||||
|
||||
I suspect I'm making things sound horribly complicated when they aren't
|
||||
really. I can keep all this in my head easily, it's just hard
|
||||
communicating it. I can understand the confusion with pointers from C,
|
||||
but note that this is the actual semi-equivalent C code (of the first
|
||||
fragment, not the dict one, and using ints instead of strings):
|
||||
|
||||
/* Initialize the variables, assume easy allocate functions which do all
|
||||
the
|
||||
malloc() calls I don't want to figure out right now */
|
||||
int** mylist = allocate_list();
|
||||
*mylist[0] = 0;
|
||||
/* now we have a list with a pointer to an int value, which is 0 */
|
||||
|
||||
int* variable_i_want_to_change = allocate_int();
|
||||
*variable_i_want_to_change = 1;
|
||||
/* now we have a variable which points to an int value, which is 1 */
|
||||
|
||||
*mylist[0] = *variable_i_want_to_change;
|
||||
/* now the data mylist[0] points at becomes 1 too */
|
||||
|
||||
*mylist[0] = 2;
|
||||
/* now the data mylist[0] points at becomes 2 */
|
||||
|
||||
/* has the data *variable_i_want_to_change changed? no. I hope! :)*/
|
||||
|
||||
I don't expect this explained a lot. I feel like Tim Peters somehow...
|
||||
:)
|
||||
|
||||
Regards,
|
||||
|
||||
Martijn
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
From: tville at earthlink.net (susan e paolini)
|
||||
Date: Wed, 14 Apr 1999 13:01:30 -0400
|
||||
Subject: what do you do with Python
|
||||
Message-ID: <3714C9EA.86C0A4E@earthlink.net>
|
||||
X-UID: 12
|
||||
|
||||
I never see jobs with Python advertised so what is it that Python does?
|
||||
Thanks for the advice
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
From: roy at popmail.med.nyu.edu (Roy Smith)
|
||||
Date: Thu, 29 Apr 1999 14:02:40 -0400
|
||||
Subject: padding strings
|
||||
Message-ID: <roy-2904991402400001@qwerky.med.nyu.edu>
|
||||
X-UID: 13
|
||||
|
||||
Given a string, I want to generate another string which is exactly N
|
||||
characters long. If the first string is less than N, I want to blank-pad
|
||||
it. If the first string is greater than N, I want to truncate it.
|
||||
|
||||
What's the most straight-forward way to do that?
|
||||
|
||||
--
|
||||
Roy Smith <roy at popmail.med.nyu.edu>
|
||||
New York University School of Medicine
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
From: larsga at ifi.uio.no (Lars Marius Garshol)
|
||||
Date: 06 Apr 1999 07:33:09 +0200
|
||||
Subject: SNMPy update
|
||||
References: <7e1hiq$a71$1@Starbase.NeoSoft.COM> <7ear25$ksf$1@news-sj-3.cisco.com> <14089.11820.416453.80124@bitdiddle.cnri.reston.va.us>
|
||||
Message-ID: <wkiubacnze.fsf@ifi.uio.no>
|
||||
X-UID: 14
|
||||
|
||||
* Jeremy Hylton
|
||||
|
|
||||
| expect that I'd want to release it given the export control hassles.
|
||||
| However, it seemed clear to me that an ASN.1 compiler could be
|
||||
| written to generate the encode/decode routines. If someone is
|
||||
| interested in that, I've got some design notes and rough code on how
|
||||
| to do the encode/decode and on how to build a backend for SNACC.
|
||||
|
||||
I'd be interested in that. I've been thinking of doing a pure-Python
|
||||
LDAP client.
|
||||
|
||||
--Lars M.
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,105 @@
|
||||
From: sweeting at neuronet.com.my (sweeting at neuronet.com.my)
|
||||
Date: Sun, 25 Apr 1999 20:11:31 GMT
|
||||
Subject: converting perl to python - simple questions.
|
||||
References: <000001be8f3e$eea9c3c0$d39e2299@tim>
|
||||
Message-ID: <7fvstg$nqo$1@nnrp1.dejanews.com>
|
||||
Content-Length: 3248
|
||||
X-UID: 15
|
||||
|
||||
|
||||
> > Anyway, since I know that there are a few ex-perlmongers on the list,
|
||||
> > would somebody be so kind as to confirm whether I've translated
|
||||
> > the following code snippets correctly :
|
||||
> >
|
||||
> > a) Perl's "defined".
|
||||
> > [perl]
|
||||
> > if (defined($x{$token})
|
||||
> >
|
||||
> > [python]
|
||||
> > if (x.has_key(token) and x[token]!=None) :
|
||||
>
|
||||
> If should be enough to do
|
||||
>
|
||||
> if x.has_key(token):
|
||||
>
|
||||
> under the probably-correct theory that the Perl is just asking "does hash
|
||||
> 'x' have key 'token'?" "None" is a specific valid value, not at all
|
||||
> "undefined", so checking x[token] against None doesn't make sense unless
|
||||
> you've established your own consistent program-wide convention of using None
|
||||
> to *mean* something like undefined. Which is dicey. After e.g. "del
|
||||
> x[token]", a reference to x[token] doesn't yield None, it raises the
|
||||
> KeyError exception.
|
||||
|
||||
For years, I've been thinking of "None" in Python as "null" in javascript,
|
||||
meaning "no value set" and so it was actually quite interesting to see that
|
||||
Perl has "exists" and "defined" functions for dictionaries.... I had
|
||||
translated "exists($dictionary{$token})" into "dictionary.has_key(token)"
|
||||
and hence went overboard when I translated "defined(...)"
|
||||
|
||||
Anyway, from testing it does appear that both defined() and exists()
|
||||
can be simply replaced with dico.has_key(token) in my scripts.
|
||||
|
||||
|
||||
> > b) RE's.
|
||||
> > [perl]
|
||||
> > if ($mytext !~ /^\s$/)
|
||||
> >
|
||||
> > [python]
|
||||
> > if not (re.match('^\s$'), mytext)
|
||||
>
|
||||
> Hmm. The Perl says "if mytext isn't a single whitespace character", which
|
||||
> is an odd thing to check! If that's the intent, fine.
|
||||
|
||||
Yes, loads of double-byte character processing ...
|
||||
|
||||
> Python's "match"
|
||||
> already constrains the search to begin at the start of the string, so the
|
||||
> leading "^" isn't needed (use Python's "search" if don't want that
|
||||
> constraint).
|
||||
|
||||
aaaah - subtle. Thanks.
|
||||
|
||||
>So:
|
||||
>
|
||||
> if not re.match(r"\s$", mytext):
|
||||
>
|
||||
> Get in the habit of using r-strings for writing regexps; they'll make your
|
||||
> backslash life much easier.
|
||||
|
||||
Thank you for pointing that out - the perl stuff's been screwing
|
||||
with my head and making me confused, \s being ok in that language.
|
||||
|
||||
> Another thing to note is that high-use regexps can be compiled, and if
|
||||
> they're always used in the same way (match vs search) you can capture that
|
||||
> choice too. So this may be more appropriate:
|
||||
>
|
||||
> is_single_whitespace = re.compile(r"\s$").match
|
||||
>
|
||||
> while whatever:
|
||||
> ...
|
||||
> if not is_single_whitespace(mytext):
|
||||
> ...
|
||||
> ...
|
||||
|
||||
Thank you very much - I'd read the excellent howto on python.org and that
|
||||
described this too. I chose not to compile just for clarity since I'm still
|
||||
trying to work out if I've translated the code from perl to python
|
||||
correctly. But I will optimise later...
|
||||
|
||||
> Hoisting the regexp compilation out of the loop can be a substantial win.
|
||||
>
|
||||
> > Since I know neither perl nor chinese, it would be nice if somebody
|
||||
> > could help me remove one of the variables in my debugging.
|
||||
>
|
||||
> native-speakers-of-both-say-chinese-is-easier-to-read<wink>-ly y'rs - tim
|
||||
|
||||
after today, i'd be inclined to agree :)
|
||||
|
||||
chas
|
||||
|
||||
-----------== Posted via Deja News, The Discussion Network ==----------
|
||||
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,110 @@
|
||||
From: parkw at better.net (William Park)
|
||||
Date: Wed, 28 Apr 1999 15:20:42 -0400
|
||||
Subject: HTML "sanitizer" in Python
|
||||
In-Reply-To: <s72703fc.021@holnam.com>; from Scott Stirling on Wed, Apr 28, 1999 at 12:49:55PM -0400
|
||||
References: <s72703fc.021@holnam.com>
|
||||
Message-ID: <19990428152042.A708@better.net>
|
||||
Content-Length: 4007
|
||||
X-UID: 16
|
||||
|
||||
On Wed, Apr 28, 1999 at 12:49:55PM -0400, Scott Stirling wrote:
|
||||
> Hi,
|
||||
>
|
||||
> I am new to Python. I have an idea of a work-related project I want
|
||||
> to do, and I was hoping some folks on this list might be able to
|
||||
> help me realize it. I have Mark Lutz' _Programming Python_ book,
|
||||
> and that has been a helpful orientation. I like his basic packer
|
||||
> and unpacker scripts, but what I want to do is something in between
|
||||
> that basic program and its later, more complex manifestations.
|
||||
>
|
||||
> I am on a Y2K project with 14 manufacturing plants, each of which
|
||||
> has an inventory of plant process components that need to be tested
|
||||
> and/or replaced. I want to put each plant's current inventory on
|
||||
> the corporate intranet on a weekly or biweekly basis. All the plant
|
||||
> data is in an Access database. We are querying the data we need and
|
||||
> importing into 14 MS Excel 97 spreadsheets. Then we are saving the
|
||||
> Excel sheets as HTML. The HTML files bloat out with a near 100%
|
||||
> increase in file size over the original Excel files. This is
|
||||
> because the HTML converter in Excel adds all kinds of unnecessary
|
||||
> HTML code, such as <FONT FACE="Times New Roman"> for every single
|
||||
> cell in the table. Many of these tables have over 1000 cells, and
|
||||
> this code, along with its accompanying closing FONT tag, add up
|
||||
> quick. The other main, unnecessary code is the ALIGN="left"
|
||||
> attribute in <TD> tags (the default alignment _is_ left). The
|
||||
> unnecessary tags are consistent and easy to identify, and a routine
|
||||
> sh!
|
||||
> ould be writable that will automate the removal of them.
|
||||
>
|
||||
> I created a Macro in Visual SlickEdit that automatically opens all
|
||||
> these HTML files, finds and deletes all the tags that can be
|
||||
> deleted, saves the changes and closes them. I originally wanted to
|
||||
> do this in Python, and I would still like to know how, but time
|
||||
> constraints prevented it at the time. Now I want to work on how to
|
||||
> create a Python program that will do this. Can anyone help? Has
|
||||
> anyone written anything like this in Python already that they can
|
||||
> point me too? I would really appreciate it.
|
||||
>
|
||||
> Again, the main flow of the program is:
|
||||
>
|
||||
> >> Open 14 HTML files, all in the same folder and all with the .html
|
||||
> >> extension. Find certain character strings and delete them from
|
||||
> >> the files. In one case (the <TD> tags) it is easier to find the
|
||||
> >> whole tag with attributes and then _replace_ the original tag
|
||||
> >> with a plain <TD>. Save the files. Close the files. Exit the
|
||||
> >> program.
|
||||
|
||||
Hi Scott,
|
||||
|
||||
I shall assume that a <TD ...> tag occurs in one line. Try 'sed',
|
||||
for i in *.html
|
||||
do sed -e 's/<TD ALIGN="left">/<TD>/g" $i > /tmp/$i && mv /tmp/$i $i
|
||||
done
|
||||
or, in Python,
|
||||
for s in open('...', 'r').readlines():
|
||||
s = string.replace('<TD ALIGN="left">', '<TD>', s)
|
||||
print string.strip(s)
|
||||
|
||||
If <TD ...> tag spans over more than one line, then read the file in
|
||||
whole, like
|
||||
for s in open('...', 'r').read():
|
||||
|
||||
If the tag is not consistent, then you may have to use regular
|
||||
expression with 're' module.
|
||||
|
||||
Hopes this helps.
|
||||
William
|
||||
|
||||
|
||||
>
|
||||
> More advanced options would be the ability for the user to set
|
||||
> parameters for the program upon running it, to keep from hard-coding
|
||||
> the find and replace parms.
|
||||
|
||||
To use command line parameters, like
|
||||
$ cleantd 'ALIGN="left"'
|
||||
change to
|
||||
s = string.replace('<TD %s>' % sys.argv[1], '<TD>', s)
|
||||
|
||||
>
|
||||
> OK, thanks to any help you can provide. I partly was turned on to
|
||||
> Python by Eric Raymond's article, "How to Become a Hacker" (featured
|
||||
> on /.). I use Linux at home, but this program would be for use on a
|
||||
> Windows 95 platform at work, if that makes any difference. I do
|
||||
> have the latest Python interpreter and editor for Windows here at
|
||||
> work.
|
||||
>
|
||||
> Yours truly,
|
||||
> Scott
|
||||
>
|
||||
> Scott M. Stirling
|
||||
> Visit the HOLNAM Year 2000 Web Site: http://web/y2k
|
||||
> Keane - Holnam Year 2000 Project
|
||||
> Office: 734/529-2411 ext. 2327 fax: 734/529-5066 email: sstirlin at holnam.com
|
||||
>
|
||||
>
|
||||
> --
|
||||
> http://www.python.org/mailman/listinfo/python-list
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,43 @@
|
||||
From: aa8vb at vislab.epa.gov (Randall Hopper)
|
||||
Date: Sat, 17 Apr 1999 15:23:44 GMT
|
||||
Subject: Bug with makesetup on FreeBSD
|
||||
In-Reply-To: <19990416215633.C2020@ipass.net>; from Randall Hopper on Fri, Apr 16, 1999 at 09:56:33PM -0400
|
||||
References: <19990416143607.B1546743@vislab.epa.gov> <19990416215633.C2020@ipass.net>
|
||||
Message-ID: <19990417112344.A1624668@vislab.epa.gov>
|
||||
X-UID: 17
|
||||
|
||||
Andrew Csillag:
|
||||
|Randall Hopper wrote:
|
||||
|> Andrew Csillag:
|
||||
|> |makesetup in Python 1.5.1 and 1.5.2 bombs on lines in the Setup file
|
||||
|> |that use backslash continuation to break a module spec across lines on
|
||||
|> |FreeBSD.
|
||||
|>
|
||||
|> BTW FWIW, I just built 1.5.2 last night on 3.0-RELEASE using the 1.5.2c1
|
||||
|> port. Worked fine. But it may not invoke makesetup under the hood.
|
||||
|
|
||||
|It does invoke makesetup (that's how the Makefile in Modules gets
|
||||
|written). I'm also running FreeBSD 2.2.8, so it may be a bug in /bin/sh
|
||||
|that has been subsequently fixed... The quick test is to try this on
|
||||
|your 3.0 machine
|
||||
|
|
||||
|$ read line
|
||||
|some text here\
|
||||
|
|
||||
|On my 2.2.8 machine after I hit return after the \, I get a command line
|
||||
|prompt, not a "blank prompt" that would mean that the read wasn't done.
|
||||
|
||||
It must be something else then, because here with stock Bourne shell:
|
||||
|
||||
|$ read line
|
||||
|some text here\
|
||||
|$ echo $line
|
||||
|some text here\
|
||||
|
||||
I get the same behavior you describe, but no build breakage.
|
||||
|
||||
Randall
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,55 @@
|
||||
From: wdrake at my-dejanews.com (wdrake at my-dejanews.com)
|
||||
Date: Fri, 30 Apr 1999 18:54:25 GMT
|
||||
Subject: Oracle Call Interface
|
||||
References: <7gb3hn$lse$1@nnrp1.dejanews.com> <Pine.GSO.3.96.990430003346.3541A-100000@saga1.Stanford.EDU> <3729ADDA.8E51C1D0@palladion.com>
|
||||
Message-ID: <7gcu8v$8gp$1@nnrp1.dejanews.com>
|
||||
Content-Length: 1854
|
||||
X-UID: 18
|
||||
|
||||
I was interested in using Oracle's Advanced Queuing (AQ), specifically the
|
||||
asynchronous event notification features.
|
||||
|
||||
Thanks
|
||||
|
||||
In article <3729ADDA.8E51C1D0 at palladion.com>,
|
||||
Tres Seaver <tseaver at palladion.com> wrote:
|
||||
> Jeffrey Chang wrote:
|
||||
> >
|
||||
> > > If anyone has experience writing applications directly to the Oracle Call
|
||||
> > > Interface (OCI), in Python or JPython please send me examples or
|
||||
references on
|
||||
> > > how to do it.
|
||||
> >
|
||||
> > Yuck! What are you planning to do? Do you really really need to write
|
||||
> > directly to the OCI or can you use one of the available Oracle extension
|
||||
> > modules?
|
||||
> >
|
||||
> > About a year ago, I used the oracledb module from Digital Creations with
|
||||
> > Oracle7. It's very nice, but not optimized, and thus slow for large
|
||||
> > queries. Since then, Digital Creations has made DCOracle
|
||||
> > (http://www.digicool.com/DCOracle/; their commercial extension module)
|
||||
> > open source, so I guess that will replace oracledb. I haven't looked at
|
||||
> > it, but according to the FAQ, it's "much faster."
|
||||
> >
|
||||
> > I strongly advise you to use an extension module or JDBC if at all
|
||||
> > possible. Writing to the OCI is extremely ugly -- all the stuff we try to
|
||||
> > avoid by using python!
|
||||
>
|
||||
> ODBC/JDBC solutions suffer from "least-common-denominator" symptom; one can't
|
||||
> easily exploit Oracleisms. I haven't played with DCOracle yet, but wrapping
|
||||
OCI
|
||||
> into a nice Pythonic package would be a big win in some situations (passing
|
||||
> array parameters to stored procedures is the one I most often want).
|
||||
>
|
||||
> --
|
||||
> =========================================================
|
||||
> Tres Seaver tseaver at palladion.com 713-523-6582
|
||||
> Palladion Software http://www.palladion.com
|
||||
>
|
||||
|
||||
-----------== Posted via Deja News, The Discussion Network ==----------
|
||||
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,54 @@
|
||||
From: tim_one at email.msn.com (Tim Peters)
|
||||
Date: Sun, 11 Apr 1999 02:15:54 GMT
|
||||
Subject: Python 2.0 compatibility
|
||||
In-Reply-To: <GIOP2.37825$A6.19136587@news1.teleport.com>
|
||||
References: <GIOP2.37825$A6.19136587@news1.teleport.com>
|
||||
Message-ID: <000401be83c1$3a66e060$7fa22299@tim>
|
||||
Content-Length: 1985
|
||||
X-UID: 19
|
||||
|
||||
[Paranoid User]
|
||||
> We have selected Python as the scripting language for the next
|
||||
> generation of one of our embedded systems.
|
||||
|
||||
Good choice! Take the opportunity to expand it to all of your systems.
|
||||
|
||||
> This is a very fast-track project scheduled to ship near the end of
|
||||
> the first quarter of 2000.
|
||||
|
||||
In Internet time, that's about a century from now; but in Python time, it's
|
||||
just the early part of next year <wink>.
|
||||
|
||||
> I ran across a quote that said something to the effect that Python 2 will
|
||||
> be incompatible with Python 1. Before I make a decision as to whether we
|
||||
> freeze with Python 1.5.2, or migrate to Python 2 when it is released, I
|
||||
> need to find out the extent of truthfulness in the "quote".
|
||||
>
|
||||
> So, if anyone in-the-know about Python 2 could let me know the proposed
|
||||
> extent of its compatibility with 1.5.2 I would really appreciate it.
|
||||
|
||||
If anything concrete is known about Python2, it's inside Guido's inscrutable
|
||||
head. Don't worry about it. Since it doesn't yet exist (nor even a wisp of
|
||||
a sketch of an outline of a design document), it's all speculation.
|
||||
|
||||
My guess is it will end up being more compatible than most dare to hope --
|
||||
or to fear <0.7 wink>. By and large, the only suggestions Guido has seemed
|
||||
especially keen about are considered by many to be legitimate design errors
|
||||
in Python1 (the rift between types and classes is a clear example of that;
|
||||
that e.g. 3/2 returns 1 instead of 1.5 is a controversial example).
|
||||
|
||||
It doesn't much matter for you, though, since Python 1.6 will still be part
|
||||
of the 1.x line, and won't come out before the end of this year. If the
|
||||
much-later-still Python2 does turn out to be wildly incompatible, there are
|
||||
enough people using the Python1 line that someone other than Guido is likely
|
||||
to take over its maintenance (even if not active future development) -- and
|
||||
*certain* to take it over if enough companies care enough to pay for that
|
||||
service.
|
||||
|
||||
speaking-for-the-professional-prostitutes-of-the-world-ly y'rs - tim
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
From: paul at prescod.net (Paul Prescod)
|
||||
Date: Thu, 29 Apr 1999 19:00:33 GMT
|
||||
Subject: padding strings
|
||||
References: <roy-2904991402400001@qwerky.med.nyu.edu>
|
||||
Message-ID: <3728AC50.9085F2C0@prescod.net>
|
||||
X-UID: 20
|
||||
|
||||
Roy Smith wrote:
|
||||
>
|
||||
> Given a string, I want to generate another string which is exactly N
|
||||
> characters long. If the first string is less than N, I want to blank-pad
|
||||
> it. If the first string is greater than N, I want to truncate it.
|
||||
>
|
||||
> What's the most straight-forward way to do that?
|
||||
|
||||
How about this:
|
||||
|
||||
def mypad( s, num ):
|
||||
return string.ljust( s, num )[:num]
|
||||
|
||||
--
|
||||
Paul Prescod - ISOGEN Consulting Engineer speaking for only himself
|
||||
http://itrc.uwaterloo.ca/~papresco
|
||||
|
||||
"Microsoft spokesman Ian Hatton admits that the Linux system would have
|
||||
performed better had it been tuned."
|
||||
"Future press releases on the issue will clearly state that the research
|
||||
was sponsored by Microsoft."
|
||||
http://www.itweb.co.za/sections/enterprise/1999/9904221410.asp
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
From: janssen at parc.xerox.com (Bill Janssen)
|
||||
Date: Wed, 21 Apr 1999 21:33:08 GMT
|
||||
Subject: HTTP-NG Support?
|
||||
In-Reply-To: <002201be8c08$1969e570$8b7125a6@cpda6686.mcit.com>
|
||||
References: <002201be8c08$1969e570$8b7125a6@cpda6686.mcit.com>
|
||||
Message-ID: <cr7YEI0B0KGW10rKZr@holmes.parc.xerox.com>
|
||||
X-UID: 21
|
||||
|
||||
I've been using Python with HTTP-NG a lot, via ILU. ILU Python
|
||||
implements the w3ng wire protocol and the w3mux protocol and most of the
|
||||
type system -- the only thing missing is local objects, and I'm working
|
||||
on them now.
|
||||
|
||||
Bill
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,52 @@
|
||||
From: donn at u.washington.edu (Donn Cave)
|
||||
Date: 26 Apr 1999 16:40:25 GMT
|
||||
Subject: Emulating C++ coding style
|
||||
References: <371F8FB7.92CE674F@pk.highway.ne.jp> <371F9D0C.4F1205BB@pop.vet.uu.nl> <7foe7r$15mi$1@nntp6.u.washington.edu> <37245184.3AADF34D@pop.vet.uu.nl>
|
||||
Message-ID: <7g24tp$raa$1@nntp6.u.washington.edu>
|
||||
Content-Length: 1536
|
||||
X-UID: 22
|
||||
|
||||
Martijn Faassen <faassen at pop.vet.uu.nl> writes:
|
||||
| Donn Cave wrote:
|
||||
...
|
||||
|> It's not much like C++ here, but it's uncanny how it reeks of Python!
|
||||
|> Namespaces, references!
|
||||
|
|
||||
| Indeed. Not having used that class attribute trick often myself, I
|
||||
| wasn't aware of this surprising behavior. I suppose in order to get the
|
||||
| C++ behavior it's best to use a module global variable.
|
||||
|
||||
Not at all, either way is fine - the class scope is just as good a place
|
||||
as the module scope, for me it's the perfect place for things that are
|
||||
specific to the class.
|
||||
|
||||
It's the usage that you have to watch out for, and while there are some
|
||||
perils for the unwary, in the long run it's also an opportunity to gain
|
||||
a deeper understanding of how simple Python is. Same for module attributes -
|
||||
common problem, someone imports a module attribute like
|
||||
|
||||
from foo import shared
|
||||
shared = 5
|
||||
|
||||
and then wonders, how come no change to the attribute as seen from other
|
||||
modules. The right way to set to a module attribute - if you must do this
|
||||
at all - is
|
||||
|
||||
foo.shared = 5
|
||||
|
||||
and just the same for a class attribute (of class Foo):
|
||||
|
||||
from foo import Foo
|
||||
Foo.shared = 5
|
||||
|
||||
In general, you have the problem only when your usage doesn't reflect the
|
||||
design. If it's really a class attribute, but you set it in the instance
|
||||
scope, if it's really an external module attribute but you bind it into
|
||||
the present module's scope during import. Python bites if you trick it.
|
||||
|
||||
Donn Cave, University Computing Services, University of Washington
|
||||
donn at u.washington.edu
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
From: xx_nospam at delorges.in-berlin.de (Jo Meder)
|
||||
Date: 16 Apr 1999 17:07:59 +0200
|
||||
Subject: HTML Authentication with Python
|
||||
References: <7f5iru$rlm@news.acns.nwu.edu> <14102.27498.772779.5941@bitdiddle.cnri.reston.va.us> <7f6577$8kp@news.acns.nwu.edu> <37171EDE.9DFD027A@quantisci.co.uk>
|
||||
Message-ID: <m3vhew1u40.fsf@delorges.in-berlin.de>
|
||||
X-UID: 23
|
||||
|
||||
|
||||
Stephen Crompton <scrompton at quantisci.co.uk> writes:
|
||||
|
||||
[Excellent explanation of HTTP-Authentication snipped]
|
||||
|
||||
If you still need to do the authentication yourself, e.g. because the
|
||||
username/password combinations are held in a database that is not
|
||||
supported by your Webserver: It can be done and how you do it depends
|
||||
on the type of server you use. I have a working solution for Apache
|
||||
(which works by (ab)using the rewrite-module) and a solution for Roxen
|
||||
Challenger that I'll test in Real Life(tm) soon.
|
||||
|
||||
|
||||
|
||||
Jo.
|
||||
|
||||
|
||||
--
|
||||
xx_nospam at delorges.in-berlin.de
|
||||
is a valid address - ist eine gueltige Adresse.
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
From: fredrik at pythonware.com (Fredrik Lundh)
|
||||
Date: Tue, 13 Apr 1999 14:49:08 GMT
|
||||
Subject: CVS module
|
||||
References: <7evbjf$85f$1@anguish.transas.com>
|
||||
Message-ID: <001d01be85bc$cd9e92e0$f29b12c2@pythonware.com>
|
||||
X-UID: 24
|
||||
|
||||
Michael Sobolev wrote:
|
||||
> My quick attempt to find something that would help me to cope with CVS files
|
||||
> failed. Could anybody advise me whether such a module exist? Under "such a
|
||||
> module" I mean something that permits to get the complete information about the
|
||||
> given file:
|
||||
>
|
||||
> cvsfile = CVSFile (<full path to file>)
|
||||
>
|
||||
> from pprint import pprint
|
||||
>
|
||||
> pprint (cvsfile.revisions)
|
||||
>
|
||||
> or something alike.
|
||||
|
||||
maybe
|
||||
|
||||
Demo/pdist/cvslib.py
|
||||
|
||||
(in the Python source distribution) could be a start?
|
||||
|
||||
</F>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,95 @@
|
||||
From: tim_one at email.msn.com (Tim Peters)
|
||||
Date: Sat, 3 Apr 1999 06:26:17 GMT
|
||||
Subject: disenchanted java user mumbles newbie questions
|
||||
In-Reply-To: <3705980A.1C7E9512@swcp.com>
|
||||
References: <3705980A.1C7E9512@swcp.com>
|
||||
Message-ID: <000101be7d9a$e1ae88a0$879e2299@tim>
|
||||
Content-Length: 3142
|
||||
X-UID: 25
|
||||
|
||||
[Alex Rice]
|
||||
> 1) In the Python 1.5 Tutorial, sec. 9.2 "Python Scopes and Name Spaces"
|
||||
> there is the following passage:
|
||||
|
||||
> ...
|
||||
> -- however, the language definition is evolving towards static name
|
||||
> resolution, at ``compile'' time, so don't rely on dynamic name
|
||||
> resolution!
|
||||
> ...
|
||||
|
||||
> Where can I read more about this move towards for compile time, static
|
||||
> name resolution and the reasons for it.
|
||||
|
||||
Best I can suggest is scouring years' worth of DejaNews. Most of it is
|
||||
summarized in early postings to the Python Types-SIG, though
|
||||
(http://www.python.org/, and follow the SIGS link at the top ...).
|
||||
|
||||
"The reasons" are the same as everyone else's: a mix of efficiency and
|
||||
compile-time-checked type safety. I'd say the Python thrust these days may
|
||||
be more toward adding *optional* type decls, though. OTOH, nothing has
|
||||
changed in this area of Python for > 5 years, so don't panic prematurely
|
||||
<wink>.
|
||||
|
||||
> For some reason I was envisioning Python as being less like Java and
|
||||
> more like Objective-C or Smalltalk in terms of dynamic binding.
|
||||
|
||||
Yes, it is. It's extreme, though. For example, in
|
||||
|
||||
def sumlen(a, b, c):
|
||||
return len(a) + len(b) + len(c)
|
||||
|
||||
Python can't assume that "len" refers to the builtin function "len", or even
|
||||
that all three instances of "len" refer to the same thing within a single
|
||||
call (let alone across calls). As to what "+" may mean here, it's even
|
||||
hairier. In effect, the current semantics require that Python look up every
|
||||
non-local name and access path from scratch every time it (dynamically) hits
|
||||
one.
|
||||
|
||||
This leads to some pretty disgusting convolutions for speeding "inner
|
||||
loops", in support of a generality that's wonderful to have but actually
|
||||
*needed* by very little code. Because of a professional background in
|
||||
compiler optimization, I'm supposed to be appalled by this <wink>.
|
||||
|
||||
> 2) Which reminds me: does anyone have a URL for that Ousterhut (sp?)
|
||||
> article at Sunlabs about Scripting languages and why scripting rulz and
|
||||
> where he has a taxonomy of programming languages along 2 dimensions?
|
||||
> Lost that bookmark and cannot find it again.
|
||||
|
||||
It's one of the White Papers at:
|
||||
|
||||
http://www.scriptics.com/scripting/white.html
|
||||
|
||||
|
||||
> 3) What's the Python equivalent of depends.exe? --something to find what
|
||||
> modules your script is depending upon?
|
||||
|
||||
Suggest searching python.org and DejaNews and Starship for "freeze" and
|
||||
"squeeze".
|
||||
|
||||
> It seems like one would be able to create a very slim distribution if one
|
||||
> needed an .exe, couple of .dll only a handful of .py files.
|
||||
|
||||
Why do I suspect you're a Windows programmer <wink>? The most advanced
|
||||
Python distribution system for Win32 is likely Gordon McMillan's, available
|
||||
for free at
|
||||
|
||||
http://www.mcmillan-inc.com/install.html
|
||||
|
||||
May also want to visit the Python DistUtils SIG.
|
||||
|
||||
> A Java+Swing application can be 1-2 MB not including the VM! bloat--ed.
|
||||
|
||||
Doubt you're going to get off much cheaper with Python + Tcl/Tk, although it
|
||||
includes two complete language implementations.
|
||||
|
||||
> What's a typical size of a bare-bones Python distribution?
|
||||
|
||||
Download one, unpack it, and do "dir" <wink>.
|
||||
|
||||
soon-even-light-bulbs-will-have-20Gb-hard-drives-ly y'rs - tim
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,26 @@
|
||||
From: boud at rempt.xs4all.nl (boud at rempt.xs4all.nl)
|
||||
Date: Sun, 25 Apr 1999 19:03:05 GMT
|
||||
Subject: GUI other than Tkinter
|
||||
References: <3721567f.1748033@news> <m2g15oygtk.fsf@desk.crynwr.com>
|
||||
Message-ID: <FArE96.5A@rempt.xs4all.nl>
|
||||
X-UID: 26
|
||||
|
||||
Russell Nelson <nelson at crynwr.com> wrote:
|
||||
: mrfusion at bigfoot.com writes:
|
||||
:
|
||||
:> Well, I've just about given up on EVER getting Tkinter to work on my
|
||||
:> Win98 machine. Is there any other GUI module that I can get that
|
||||
:> doesn't require TCL/TK to be installed on my machine? Isn't there
|
||||
:> something called GD?
|
||||
:
|
||||
: There's pygtk, which uses the gtk toolkit.
|
||||
:
|
||||
|
||||
On Windows 98?
|
||||
--
|
||||
|
||||
Boudewijn Rempt | www.xs4all.nl/~bsarempt
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
From: justin at linus.mitre.org (Justin Sheehy)
|
||||
Date: 23 Apr 1999 22:09:54 -0400
|
||||
Subject: Python too slow for real world
|
||||
References: <372068E6.16A4A90@icrf.icnet.uk> <3720A21B.9C62DDB9@icrf.icnet.uk> <3720C4DB.7FCF2AE@appliedbiometrics.com> <3720C6EE.33CA6494@appliedbiometrics.com> <y0jaevznhha.fsf@vier.idi.ntnu.no>
|
||||
Message-ID: <glmvhemn4zx.fsf@caffeine.mitre.org>
|
||||
X-UID: 27
|
||||
|
||||
mlh at idt.ntnu.no (Magnus L. Hetland) writes:
|
||||
|
||||
> (And... How about builtin regexes in P2?)
|
||||
|
||||
Um, why? I don't see any need at all for them to move from
|
||||
module-status to core-language-status.
|
||||
|
||||
The only way that I could understand the desire for it would be if one
|
||||
wanted to write little scripts that were basically just some control
|
||||
flow around regexes and string substitution. That is, something that
|
||||
looked like most of the programs written in that other P language. ;-)
|
||||
|
||||
In all seriousness, what reason do you have for making that
|
||||
suggestion? I am willing to believe that there might be a good reason
|
||||
to do so, but it certainly isn't immediately obvious.
|
||||
|
||||
-Justin
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
From: tim_one at email.msn.com (Tim Peters)
|
||||
Date: Thu, 8 Apr 1999 06:26:21 GMT
|
||||
Subject: Crappy Software was Re: [OffTopic: Netscape] Re: How should
|
||||
In-Reply-To: <1288614834-78399188@hypernet.com>
|
||||
References: <1288614834-78399188@hypernet.com>
|
||||
Message-ID: <000a01be8188$b7f56280$749e2299@tim>
|
||||
Content-Length: 1037
|
||||
X-UID: 28
|
||||
|
||||
[Gordon McMillan, among others with Netscape vs IE experience]
|
||||
> ...
|
||||
> Having recently ported a sophisticated applet using JNI (Sun's new
|
||||
> native interface) to JRI (older Netscape) and RNI (older IE), I too
|
||||
> can kick and scream.
|
||||
> [guess the outcome <wink>]
|
||||
|
||||
I'm no browser wizard -- just took a few stabs over the past year & a half
|
||||
at writing some relatively simple Java applets, JavaScript and HTML for the
|
||||
amusement of my family. No CSS, no frames, nothing at all even remotely
|
||||
cutting-edge. One Netscape-using sister had dozens of problems with *all*
|
||||
of these, most eventually determined to be cases of NS not meeting the
|
||||
appropriate std, and-- far too often --crashing her machine.
|
||||
|
||||
Fact is NS dropped the browser ball a couple years ago, then poked holes in
|
||||
it, then attached industrial-strength vacuum cleaners on the off chance any
|
||||
air remained.
|
||||
|
||||
> ...
|
||||
> When's the last time you closed a GUI from the file menu??
|
||||
|
||||
Hey, I'll close a stinking GUI any way I can <wink>.
|
||||
|
||||
right-next-to-my-reboot-foot-pedal-ly y'rs - tim
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,50 @@
|
||||
From: mwh21 at cam.ac.uk (Michael Hudson)
|
||||
Date: 18 Apr 1999 01:09:48 +0100
|
||||
Subject: Plugins, or selecting modules to import at runtime
|
||||
References: <924379180.825429211@news.intergate.bc.ca> <924385178.948235039@news.intergate.bc.ca>
|
||||
Message-ID: <m34smeyek3.fsf@atrus.jesus.cam.ac.uk>
|
||||
Content-Length: 1063
|
||||
X-UID: 29
|
||||
|
||||
Gerald Gutierrez <gutier at intergate.bc.ca> writes:
|
||||
> Never mind. I just found the module "imp".
|
||||
|
||||
That's waay overkill for what you need; the builtin function
|
||||
__import__ will do nicely:
|
||||
|
||||
Python 1.5.2 (#2, Apr 14 1999, 13:02:03) \
|
||||
[GCC egcs-2.91.66 19990314 (egcs-1.1.2 on linux2
|
||||
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
|
||||
>>> __import__("sys")
|
||||
<module 'sys' (built-in)>
|
||||
>>> s=__import__("sys")
|
||||
>>> s
|
||||
<module 'sys' (built-in)>
|
||||
>>>
|
||||
|
||||
HTH
|
||||
|
||||
Michael
|
||||
|
||||
> Thanks.
|
||||
>
|
||||
> On Sat, 17 Apr 1999, Gerald Gutierrez wrote:
|
||||
> >Hi all.
|
||||
> >
|
||||
> >I'd like to write a program in Python in which the user can select one of
|
||||
> >several modules to execute through a function that has the same name in all the
|
||||
> >modules. I don't believe "import" lets me pass it a string. There is also
|
||||
> >reload(), but the module to reload must be previously imported.
|
||||
> >
|
||||
> >This is very similar to plugins like that used in Netscape, Photoshop and the
|
||||
> >GIMP.
|
||||
> >
|
||||
> >Can someone please give me a hint?
|
||||
> >
|
||||
> >Thanks.
|
||||
> >
|
||||
> >Please forward replies to gutier at intergate.bc.ca.
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,45 @@
|
||||
From: tavares at connix.com (Chris Tavares)
|
||||
Date: Sat, 10 Apr 1999 12:14:26 -0400
|
||||
Subject: pythonwin COM Update link out of date
|
||||
References: <slrn7gt244.3s6.bernhard@alpha1.csd.uwm.edu> <7em639$fto$1@m2.c2.telstra-mm.net.au>
|
||||
Message-ID: <370F78E2.8EA7433E@connix.com>
|
||||
Content-Length: 1039
|
||||
X-UID: 30
|
||||
|
||||
Mark Hammond wrote:
|
||||
|
||||
> Bernhard Reiter wrote in message ...
|
||||
> >http://www.python.org/ftp/python/pythonwin/pwindex.html#oadist
|
||||
> >
|
||||
> >Gives a bad link to the MS Microsoft Knowledge Base article Q164529.
|
||||
> >The link is bad and I cannot relocate the article with the search
|
||||
> >engine on that site and other methods... :(
|
||||
> >
|
||||
> >The closest I could get was:
|
||||
> > http://support.microsoft.com/support/kb/articles/Q139/4/32.asp
|
||||
> >from
|
||||
> > http://support.microsoft.com/support/downloads/LNP195.asp
|
||||
> >
|
||||
> >Hmmmm.... is there a potential danger in installing oadist.exe?
|
||||
>
|
||||
> There _shouldnt_ be any danger!
|
||||
>
|
||||
> These days it is getting quite unnecessary. If you have (I believe) IE4 or
|
||||
> Office 97, you are pretty up-to-date, and that includes many PCs these days.
|
||||
>
|
||||
> You could try installing the Python stuff, and see if it works. Also, see
|
||||
> my other post this morning as to why the install may fail - try this out
|
||||
> first.
|
||||
>
|
||||
> Mark.
|
||||
|
||||
Another option is to download DCOM for Win95 - that'll get the user up to date
|
||||
and then some!
|
||||
|
||||
-Chris
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,52 @@
|
||||
From: bernhard at alpha1.csd.uwm.edu (Bernhard Reiter)
|
||||
Date: 18 Apr 1999 04:31:27 GMT
|
||||
Subject: NT: win32api and win32ui import error
|
||||
References: <7fbcpq$2jb$1@nnrp1.dejanews.com>
|
||||
Message-ID: <slrn7hio0v.vlp.bernhard@alpha1.csd.uwm.edu>
|
||||
Content-Length: 1230
|
||||
X-UID: 31
|
||||
|
||||
On Sun, 18 Apr 1999 01:33:46 GMT, hj_ka at my-dejanews.com <hj_ka at my-dejanews.com> wrote:
|
||||
>I don't know whether this is also related: when I installed
|
||||
>win32all-124.exe, I got a few warnings:
|
||||
>
|
||||
>"Registration of the (AXScript/Python Interpreter/Python Dictionary)
|
||||
>failed. Installation will continue, but this server will require
|
||||
>manual registration before it will function."
|
||||
|
||||
I had the same warnung and also cannot run the win32 extentions.
|
||||
(import win32com.client e.g. fails for me.)
|
||||
|
||||
Mark Hammond suggested to update some DLLs and it might
|
||||
very well be a problem related to old DLL version.
|
||||
(I didn't manage for some reasons to update my DLLs here on my
|
||||
Windows95 system, so I finally gave up. Any Windows Hacker with
|
||||
experience in this speak up and offer help! ;-) )
|
||||
|
||||
Mark said, that the following dll and their versions might
|
||||
be relevant:
|
||||
|
||||
ole32.dll
|
||||
oleaut32.dll
|
||||
msvcrt.dll
|
||||
|
||||
The following are used, but should be fine:
|
||||
pywintypes15.dll
|
||||
python15.dll
|
||||
kernel32.dll
|
||||
user32.dll
|
||||
|
||||
You can check the version number in the explorer im C:windows/system
|
||||
with properties.
|
||||
|
||||
Maybe an upgrade package including these .DLLs from support.microsoft.com
|
||||
can help.
|
||||
|
||||
|
||||
Please report back, If you found a solution...
|
||||
|
||||
Bernhard
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,51 @@
|
||||
From: bill_seitz at my-dejanews.com (bill_seitz at my-dejanews.com)
|
||||
Date: Thu, 15 Apr 1999 15:02:28 GMT
|
||||
Subject: stupid Win-CGI getting started question
|
||||
References: <7f0f0h$pfb$1@nnrp1.dejanews.com> <8DA86302Bduncanrcpcouk@news.rmplc.co.uk> <7f2no0$n80$1@nnrp1.dejanews.com> <8DA9637FEduncanrcpcouk@news.rmplc.co.uk>
|
||||
Message-ID: <7f4v1u$jpd$1@nnrp1.dejanews.com>
|
||||
Content-Length: 2001
|
||||
X-UID: 32
|
||||
|
||||
In article <8DA9637FEduncanrcpcouk at news.rmplc.co.uk>,
|
||||
Duncan Booth <duncan at rcp.co.uk> wrote:
|
||||
|
||||
> I didn't say it was impossible to run .py files as CGI, simply that I had
|
||||
> problems getting it to work. Since my number one priority was not to take
|
||||
> the web server off-line at all, there were limits to how far I could play
|
||||
> around with it. I'm sure there must be some way to get it to work, but I
|
||||
> got enough for my purposes.
|
||||
|
||||
Gotcha.
|
||||
|
||||
I did some more playing around. No success, but here's what I did/found: When
|
||||
I try to call a .py file I get the "This server has encountered an internal
|
||||
error which prevents it from fulfilling your request" message. The NES error
|
||||
log shows: [15/Apr/1999:10:35:53] failure: for host 192.246.193.43 trying to
|
||||
GET /pcgi/dntest.py, send-cgi reports: could not send new process (File Not
|
||||
Found Error) [15/Apr/1999:10:35:53] failure: cgi_send:cgi_start_exec
|
||||
d:\program files\python\lib\dntest.py failed
|
||||
|
||||
If I rename the .py file to .cmd and call it with that name, it works fine.
|
||||
|
||||
I'm defining a /pcgi/ path to point to the location of the python files, so
|
||||
I'm not counting on the suffix to mean anything. All the various CGI folders
|
||||
get mapped to object name="cgi", but again, since suffix is irrelevant, that
|
||||
shouldn't be the problem.
|
||||
|
||||
I went into mime.types and added the py extension to the cgi reference (note
|
||||
that cmd is not in that extension list). Still get an error, but the log
|
||||
changes to [15/Apr/1999:10:52:57] failure: for host 192.246.193.43 trying to
|
||||
GET /pcgi/dntest.py, send-cgi reports: could not send new process (Error
|
||||
Number is unknown) [15/Apr/1999:10:52:57] failure: cgi_send:cgi_start_exec
|
||||
d:\program files\python\lib\dntest.py failed
|
||||
|
||||
Does this suggest any clues? I've asked a friend who doesn't know Python but
|
||||
knows Netscape pretty well. Will report back if he has any suggestions.
|
||||
|
||||
|
||||
-----------== Posted via Deja News, The Discussion Network ==----------
|
||||
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,30 @@
|
||||
From: garryh at att.com (Garry Hodgson)
|
||||
Date: Fri, 9 Apr 1999 17:37:27 GMT
|
||||
Subject: Is Python dying?
|
||||
References: <7dos4m$usi$1@nnrp1.dejanews.com> <7e30fp$8vf$1@news1.rmi.net> <14085.18282.936883.727575@bitdiddle.cnri.reston.va.us> <7ectjd$516$1@srv38s4u.cas.org> <e5XO2.32678$FZ5.12416@news.rdc1.sfba.home.com> <19990408075544.B983383@vislab.epa.gov>
|
||||
Message-ID: <370E3AD7.16C48C5F@att.com>
|
||||
X-UID: 33
|
||||
|
||||
Randall Hopper wrote:
|
||||
|
||||
> I believe that was Fredrik Lundh <fredrik at pythonware.com>.
|
||||
>
|
||||
> In shopping for Python books late last month, I happened upon his announced
|
||||
> plan to write a Tkinter book. So I slipped him an e-mail query asking how
|
||||
> the book was going and if he had an estimated timeframe (in case it was
|
||||
> close to market), but I haven't received a response. I assume he's just
|
||||
> busy like the rest of us.
|
||||
|
||||
for what it's worth, fredrik has never replied to any of the mail i've
|
||||
sent him.
|
||||
your mileage may vary.
|
||||
|
||||
--
|
||||
Garry Hodgson seven times down
|
||||
garry at sage.att.com eight times up
|
||||
Software Innovation Services
|
||||
AT&T Labs - zen proverb
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,35 @@
|
||||
From: fdrake at cnri.reston.va.us (Fred L. Drake)
|
||||
Date: Tue, 20 Apr 1999 13:18:38 GMT
|
||||
Subject: Can't work this XDR out
|
||||
In-Reply-To: <371C0CF7.2D1260D7@hons.cs.usyd.edu.au>
|
||||
References: <371C0CF7.2D1260D7@hons.cs.usyd.edu.au>
|
||||
Message-ID: <14108.32430.842541.785124@weyr.cnri.reston.va.us>
|
||||
X-UID: 34
|
||||
|
||||
Matthew Robert Gallagher writes:
|
||||
> Whilst trying to pack a list xdr packer asks for
|
||||
>
|
||||
> (list, pack_item)
|
||||
>
|
||||
> what is the pack_item can't work this out as there are no examples
|
||||
|
||||
Matthew,
|
||||
pack_item will typically be another method from the same packer
|
||||
object. For example, to pack a list of ints, use this:
|
||||
|
||||
import xdrlib
|
||||
p = xdrlib.Packer()
|
||||
p.pack_list([1, 2, 3], p.pack_int)
|
||||
|
||||
I hope this helps. I'll add an example to the documentation.
|
||||
|
||||
|
||||
-Fred
|
||||
|
||||
--
|
||||
Fred L. Drake, Jr. <fdrake at acm.org>
|
||||
Corporation for National Research Initiatives
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,35 @@
|
||||
From: holger at phoenix-edv.netzservice.de (Holger Jannsen)
|
||||
Date: Thu, 22 Apr 1999 13:48:58 GMT
|
||||
Subject: sort of multiple dictonaries
|
||||
Message-ID: <371F28CA.2240BB7B@phoenix-edv.netzservice.de>
|
||||
X-UID: 35
|
||||
|
||||
Hi there,
|
||||
|
||||
perhaps a typical newbie-question:
|
||||
|
||||
I've got a list of dictonaries like that:
|
||||
|
||||
mydics=[{'sortit': 'no412', 'mode': 'nothing'},
|
||||
{'sortit': 'no112', 'mode': 'something'},
|
||||
{'sortit': 'no02', 'mode': 'something else'}]
|
||||
|
||||
Is there an easy way to get that list sorted like that:
|
||||
|
||||
def sortDictonary(aDictonary, theSortKey="sortit"):
|
||||
....
|
||||
|
||||
Result have to be:
|
||||
|
||||
mydics=[{'sortit': 'no02', 'mode': 'something else'},
|
||||
{'sortit': 'no112', 'mode': 'something'},
|
||||
{'sortit': 'no412', 'mode': 'nothing'}]
|
||||
|
||||
Any hints?
|
||||
|
||||
Ciao,
|
||||
Holger
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
From: justin at linus.mitre.org (Justin Sheehy)
|
||||
Date: 29 Apr 1999 11:45:50 -0400
|
||||
Subject: Designing Large Systems with Python
|
||||
References: <m37lqz0yoa.fsf@solo.david-steuber.com> <372599D6.C156C996@pop.vet.uu.nl> <7g4a3l$atk$1@news.worldonline.nl> <m3vhehxjhr.fsf@solo.david-steuber.com>
|
||||
Message-ID: <glm1zh3h1ld.fsf@caffeine.mitre.org>
|
||||
X-UID: 36
|
||||
|
||||
David Steuber <trashcan at david-steuber.com> writes:
|
||||
|
||||
> I would like better python support in XEmacs. There is a python
|
||||
> mode, but I haven't seen anything about evaluating Python code
|
||||
> ineteractivly the way you can with Lisp and elisp.
|
||||
|
||||
The support for Python in XEmacs will obviously never be as good as
|
||||
the support for emacs lisp. However, it is already about as good as
|
||||
it is for other lispy things like clisp, scheme, etc.
|
||||
|
||||
One can run a python interpreter in an emacs window. This can be
|
||||
interacted with directly, or you can send code to it from a
|
||||
python-mode buffer. It has served my needs fairly well.
|
||||
|
||||
> -> ehh, Python?
|
||||
>
|
||||
> It looks interesting. |