hello

2004-12-17 Thread matthew
testing ... -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Python like VB?

2005-03-17 Thread Matthew
"Mike Cox" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > As you may or may not know, Microsoft is discontinuing Visual Basic in favor > of VB.NET and that means I need to find a new easy programming language. I > heard that Python is an interpreted language similar to VB. Thi

Python / Win32 extensions compatibility with Windows XP

2005-04-12 Thread Matthew
? Thank You Matthew Harelick -- http://mail.python.org/mailman/listinfo/python-list

Testing Python updates

2007-03-21 Thread Matthew
Hello: What is the methodology for testing the updates to the Python language? Thanks Matthew Harelick -- http://mail.python.org/mailman/listinfo/python-list

pyOpenGL tom demo segmentation fault

2006-07-26 Thread matthew
Hi, I have Python 2-4-2, Numpy 24.2, and PyOpenGL-2.0.2.01 install, along with glut 3.7. The 1st 'funny' thing is that I always seem to get two pythons in /usr/local/bin, ie python and python2.4. These are exactly the same timestamp and size. The other problem is that the demos in ../site-pack

Re: do you master list comprehensions?

2004-12-15 Thread Matthew Moss
Diez B. Roggisch wrote: > >>> data = [['foo','bar','baz'],['my','your'],['holy','grail']] > >>> [e for l in data for e in l] > ['foo', 'bar', 'baz', 'my', 'your', 'holy', 'grail'] Okay, I tried this in an interactive Python session and it works as stated. My question is, why? How is the interpre

trouble building python2.4

2004-12-22 Thread Matthew Thorley
hat the tarball I downloaded wasn't really python2.4, even though it was 'official' and named Python-2.4.tgz. Can anyone please tell me what might of happened, or if they have had a similar experience? Thanks -Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble building python2.4

2004-12-22 Thread Matthew Thorley
Erik Max Francis wrote: Matthew Thorley wrote: Greetings, I just downloaded the python2.4 source from python.org and built it the usual way, i.e. ./configure && make. What I don't understand is that the resulting binary, when run, prints this line Python 2.3.4 (#1, Nov 15 2004, 10:

problem with tk and pass by refference (I think :)

2005-02-11 Thread Matthew Thorley
ry thing I can think of to fix this. If any one has any thoughts I would really appreciate it. Thanks very much! -Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with tk and pass by refference (I think :)

2005-02-11 Thread Matthew Thorley
Diez B. Roggisch wrote: Hi, button = Button(self.songWin, text=verse, command=(lambda num=verseNum: self.showVerse(num)) ) should do the trick. The reason is basically that your version kept a reference to verseNum - and when executed, the value verseNum points to is the lasts one stored. Rebinding

Re: problem with tk and pass by refference (I think :)

2005-02-11 Thread Matthew Thorley
would have asked somebody sooner :) -Matthew -- http://mail.python.org/mailman/listinfo/python-list

Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
gt;>> class child: ... def get_parent_index(self): parent = self.magic_parent_discovery() ... return parent.index(self) ... Thanks much -- Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
Can you please elaborate on this? -Matthew Diez B. Roggisch wrote: >>keeping a additional mapping between values and keys. > -- http://mail.python.org/mailman/listinfo/python-list

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
under-the-hood? I mean is list.index(y) just the same as itemnum = 0 for item in list: if y == item: return itemnum else: itemnum = itemnum+1 I think I am going to have to reevaluate my system design... grrr. thanks -- Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
rfuly beautiful use of python an oop, but perhaps I am mistaken and there is a much more pragmatic way to get the job done. In the end preformance doesn't matter a lot. The front end will be web based, so if the db can process faster than http/javascript and user Bob who has to mouse, then everything will be fine. Let me know what you think Thanks much --Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
Scott David Daniels wrote: > Matthew Thorley wrote: > >> This may be a very rudimentary question, but here goes: > > From your questions, I believe you are not thinking of values as > being distinct from the names and data structures that refer to them. > > What

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
rt of > its first round of grant funding last year, so there's at least one > other person working on this stuff! > I did see that and I was quite pleased! :) I am currently using the authors 'old' pysnmp which gets me by, but I am very excited to try out the new version

Re: Can dictionary values access their keys?

2005-04-08 Thread Matthew Thorley
e it with a reference to the collection of parent > objects and let it work out which one it wants. Where's the benefit? All right then. > Happy to help, but I can't take credit for the grant, since all I did as > a PSF director was vote affirmatively on the recommendations of

Re: Utah Python Users Group

2005-04-13 Thread Matthew Thorley
lugal wrote: > Is anyone aware if there's a Utah-based Python User Group? If not, does > any else from Utah have any interest in forming a Utah-based Python > User Group? > I'm in Utah, I don't know of any groups but I might be interested. -Matthew -- http://mail.

How do you convert a string obj to a file obj?

2005-05-04 Thread Matthew Thorley
hat I have is that the function that processes the archive expects a file object. So far the only solution I have found it to write the file to disk and then read it back. Is there an easy way to convert data, in the example above into a file object? Thanks -Matthew -- http://mail.python.org/ma

Re: How do you convert a string obj to a file obj?

2005-05-04 Thread Matthew Thorley
John Abel wrote: > Matthew Thorley wrote: > >> I'm writing a web app whereby a user uploads a tar acrhive which is then >> opened and processed. My web form reads the file like this: >> >> while 1: >>data = value.file.read(1024 * 8) # Read blocks

Re: How do you convert a string obj to a file obj?

2005-05-04 Thread Matthew Thorley
Esben Pedersen wrote: > Matthew Thorley wrote: > >> I'm writing a web app whereby a user uploads a tar acrhive which is then >> opened and processed. My web form reads the file like this: >> >> while 1: >> data = value.file.read(1024 * 8) # Read b

Re: How do you convert a string obj to a file obj?

2005-05-04 Thread Matthew Thorley
Peter Otten wrote: > Matthew Thorley wrote: > > >>Esben Pedersen wrote: >> >>>Matthew Thorley wrote: >>> >>> >>>>I'm writing a web app whereby a user uploads a tar acrhive which is then >>>>opened and pr

using tarfile with an open file object

2005-05-04 Thread Matthew Thorley
need to use tarfile to manipulate an already open file object. I searched in the docs but didn't find anything. Maybe I just over looked the obvious. Does any one know how to do this? Thanks -matthew -- http://mail.python.org/mailman/listinfo/python-list

Multiple-reader-one-writer (MROW) locking -- soliciting improvements

2005-05-05 Thread Matthew Scott
://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413393 I'm posting a link to it here in case others find it useful, and also to solicit feedback for improving the recipe. Enjoy! - Matthew -- http://mail.python.org/mailman/listinfo/python-list

object oriented inheritance problem

2005-05-10 Thread Matthew Thorley
hat my problem *really* is I would appreciate it greatly. Thanks very much. -Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: object oriented inheritance problem

2005-05-10 Thread Matthew Thorley
So is elementtree a module of modules? I didn't know you could do that. I just assumed that from elementtree import ElementTree imported a class from the module elementtree. It works now. Thanks guys. Fredrik Lundh wrote: > Matthew Thorley wrote: > > >>I am trying to inhe

ElemenTree and namespaces

2005-05-16 Thread Matthew Thorley
Does any one know if there a way to force the ElementTree module to print out name spaces 'correctly' rather than as ns0, ns1 etc? Or is there at least away to force it to include the correct name spaces in the output of tostring? I didn't see anything in the api docs or the list archive, but befo

Re: ElemenTree and namespaces

2005-05-16 Thread Matthew Thorley
Thanks Andrew & Oren, that should do the trick. -- http://mail.python.org/mailman/listinfo/python-list

ElementTree and xsi to xmlns conversion?

2005-05-18 Thread Matthew Thorley
p://www.chpc.utah.edu/~baites/mgacML"; />' If some one could please explain where I'm off I'd really appreciate it. I need to use xsi: to validate the document, and I'm not sure how to pass it on to the children when I reformat the doc. Thanks -Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree and xsi to xmlns conversion?

2005-05-19 Thread Matthew Thorley
I an told, I need the second namespace, so that I can point to the schema, so that I can validate the document. Is that the wrong way to link to the schema? Can I force both namespaces to be inherited by the child elements? Thanks for all the help -Matthew -- http://mail.python.org/mailman

how do you return an exit code with out exiting

2005-05-23 Thread Matthew Thorley
hangs, waiting for my program to exit 1 or 0. My program never does exits because its looping every 30 seconds. Is there a way I can pass an exit value with out actualy exiting? or is there are better way to do this? Thanks -- Matthew Thorley -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you return an exit code with out exiting

2005-05-23 Thread Matthew Thorley
thanks thats perfect! Grant Edwards wrote: > On 2005-05-23, Matthew Thorley <[EMAIL PROTECTED]> wrote: > > >>I wrote a simple python program that scrapes a web page every >>30 secons and dumps the result in a data base. I want to use >>my linux distros build i

Errno 8 Exec format error

2005-10-25 Thread Matthew Fowler
Hi there I have been porting python to the Etrax platform and everything seems to be working. However when I run the program in question I get: "problem with execution of xhpl on AxisProduct: [Errno 8] Exec format error" Im looking for any help to try and solve this issue. Am I correct in th

Setup/install issues including site.py

2005-10-25 Thread Matthew Fowler
Hello there Im trying to port Python 2.4.3 to the Etrax platform, things have been working but im having some issues I dont get. if I issue #python I get ... Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] (i do get the interpreter prompt) so I set PYTHONHOME #

Re: ANN: Circe 0.0.3b1 released

2005-11-07 Thread Matthew Nuzum
lly combines the two. On 6 Nov 2005 20:41:10 -0800, Nick <[EMAIL PROTECTED]> wrote: > === Whats Circe? === > Circe is a multiplatform IRC client written in the Python language that > utilizes the wxpython library for the graphical interface. Circe > features Unicode, Scripting, and

python win32 and COM? for internet monitoring

2005-11-22 Thread Matthew Thorley
e one please tell me if I'm way off and point me in the right direction? Thanks very much --Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: python win32 and COM? for internet monitoring

2005-11-22 Thread Matthew Thorley
Python; Google should > turn up numerous existing implementations. > > Graham > Thanks for the tip, I'll check that out. -- Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Louie-1.0b2 - Signal dispatching mechanism

2005-12-06 Thread Matthew Scott
> > > http://louie.berlios.de/changes.html > > Ok, so I won't need it (yet). One difference that may help you out if you ever experiment with PJE's RuleDispatch, is that the 'louie' top-level package name does not conflict with RuleDispatch's 'dispatch' top-level package name. - Matthew -- http://mail.python.org/mailman/listinfo/python-list

formatted xml output from ElementTree inconsistency

2005-06-23 Thread Matthew Thorley
be nice if their was a way to create 'standard' formatted output for all elements regardless of how they were created. Comments and suggestions are greatly appreciated. regards -Matthew -- http://mail.python.org/mailman/listinfo/python-list

Re: formatted xml output from ElementTree inconsistency

2005-06-23 Thread Matthew Thorley
Jarek Zgoda wrote: > Matthew Thorley napisał(a): > >> The output I get shows xmla as nicely formatted text, with elements on >> different lines and everything all tabbed and pretty. Inverly, xmlb is >> one long string on one line. >> >> Is that because

chi-squared tests in python?

2006-01-17 Thread Matthew Vernon
s you random numbers from a chi-squared distribution with a set number of degrees of freedom - not really what I want. Does there exist python code to do this? preferably something vaguely standard? Thanks, Matthew ps: given the "batteries included" philosphy, there's a re

Nested loops confusion

2006-05-10 Thread Matthew Graham
Hi, I expect this is very obvious for anyone who knows what they're doing - but I don't understand what's the problem with the following code. I was intending that the program cycle through all i and j (ie. all possible (i,j) coordinates, but the output when I run the program shows me up to

Re: Nested loops confusion

2006-05-10 Thread Matthew Graham
Oops, I forget to reset the j after the inner loop. Always manage to work these things out just after asking for help! ;-) Matthew Graham wrote: > Hi, > > I expect this is very obvious for anyone who knows what they're doing - > but I don't understand what's the

Re: Nested loops confusion

2006-05-11 Thread Matthew Graham
Thanks very much for the advice, have tidied it up and tested and seems to be working as needed. I'm still not sure what was stopping the inner loop from working earlier - but removing the redundancy in "j=0" and so on seems to have solved it. Matt Dennis Lee Bieber wrote: > If that wor

Re: optparse docs

2006-09-27 Thread Matthew Woodcraft
tobiah <[EMAIL PROTECTED]> wrote: > In > http://docs.python.org/lib/optparse-terminology.html > > The GNU project introduced "-" followed by a series of hyphen-separated > words, e.g. "-file" or "-dry-run". These are the only two option > syntaxes provided by optparse. [...] > So my ques

BoaConstructor

2006-09-29 Thread Matthew Warren
..I'm just about to start a project, I have a threaded python app currently around 3000 lines / 12-15 source files that is cli driven, and I am about to start using boaConstructor to build a GUI around it.   Has anyone here any advice on wether boaConstructor is actually a good tool for this

RE: Problems with Python 2.5 installer.

2006-09-29 Thread Matthew Warren
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of paw Sent: 29 September 2006 11:01 To: python-list@python.org Subject: Re: Problems with Python 2.5 installer. John Machin wrote: > paw wrote: > > I have ran the MSI installer for Python 2.5 several times at

RE: Making sure script only runs once instance at a time.

2006-09-29 Thread Matthew Warren
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hari SekhonSent: 29 September 2006 14:55To: python-list@python.orgSubject: Re: Making sure script only runs once instance at a time. I'm not sure if that is a very old way of doing it, which is why I wa

How to iterate through a sequence, grabbing subsequences?

2006-09-29 Thread Matthew Wilson
I wrote a function that I suspect may already exist as a python builtin, but I can't find it: def chunkify(s, chunksize): "Yield sequence s in chunks of size chunksize." for i in range(0, len(s), chunksize): yield s[i:i+chunksize] I wrote this because I need to take a string of a

How to query a function and get a list of expected parameters?

2006-09-29 Thread Matthew Wilson
I'm writing a function that accepts a function as an argument, and I want to know to all the parameters that this function expects. How can I find this out in my program, not by reading the source? For example, I would want to know for the function below that I have to pass in two things: def f(

Re: for: else: - any practical uses for the else clause?

2006-09-29 Thread Matthew Woodcraft
[EMAIL PROTECTED] wrote: > And so on. For every use of the for/else clause there exists a better > alternative. Which sums up my opinion about the construct -- if you > are using it, there's something wrong with your code. How do you transform this? height = 0 for block in stack: if block.is_

RE: Making sure script only runs once instance at a time.

2006-09-30 Thread Matthew Warren
Apologies for repost. not sure what happened.   This email is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately and delete the email from your computer. You should not copy the email, use it for any purpose or disclose its contents

How to coerce a list of vars into a new type?

2006-10-02 Thread Matthew Wilson
I want to verify that three parameters can all be converted into integers, but I don't want to modify the parameters themselves. This seems to work: def f(a, b, c): a, b, c = [int(x) for x in (a, b, c)] Originally, I had a bunch of assert isinstance(a, int) statements at the top of

How can I make a class that can be converted into an int?

2006-10-02 Thread Matthew Wilson
What are the internal methods that I need to define on any class so that this code can work? c = C("three") i = int(c) # i is 3 I can handle the part of mapping "three" to 3, but I don't know what internal method is called when int(c) happens. For string conversion, I just define the __str__ me

Raw strings and escaping

2006-10-03 Thread Matthew Warren
Hi, I would expect this to work, rawstring=r'some things\new things\some other things\' But it fails as the last backslash escapes the single quote. ..although writing this I think I have solved my own problem. Is \' the only thing escaped in a raw string so you can place ' in a raw string? Alt

RE: Escapeism

2006-10-03 Thread Matthew Warren
> -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > rg] On Behalf Of Kay Schluehr > Sent: 30 September 2006 18:02 > To: python-list@python.org > Subject: Re: Escapeism > > Sybren Stuvel wrote: > > Kay Schluehr enlightened us with: > > > Usually I struggle a

RE: Escapeism

2006-10-03 Thread Matthew Warren
> -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > rg] On Behalf Of Matthew Warren > Sent: 03 October 2006 16:07 > To: python-list@python.org > Subject: RE: Escapeism > > > > > -Original Message- > &

Improving telnetlib

2006-10-04 Thread Matthew Warren
Hi, I use telnetlib in an app I am writing, and would like to add functionality to it to support interactive terminal sessions , IE: be able to 'vi' a file. Currently it seems telnetlib isnt quite sophisticated enoguh to support such a thing. The trouble is, I havent got a clue where to start

RE: Raw strings and escaping

2006-10-04 Thread Matthew Warren
> -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > rg] On Behalf Of Scott David Daniels > Sent: 03 October 2006 18:11 > To: python-list@python.org > Subject: Re: Raw strings and escaping > > Matthew Warren wrote: > >

Why do this?

2006-10-05 Thread Matthew Warren
Ok, not really python focused, but it feels like the people here could explain it for me :) Now, I started programming when I was 8 with BBC Basic. I never took any formal classes however, and I have never become an expert programmer. I'm an average/hobbyist programmer with quite a few languages

RE: Why do this?

2006-10-05 Thread Matthew Warren
> > | Now, I started programming when I was 8 with BBC Basic. > > Hey, likewise! (Except I was 12 when it came out!) I think it came out before I was 8, and I started out with print and input. Not sure if that's 'real' programming - I don't think I graduated to ifs and thens and gotos and gosubs

RE: Why do this?

2006-10-05 Thread Matthew Warren
> Also, having a variable of type str called 'number' seems > perverse (and > probably error prone), so I suspect I might need something like: > And not something I would normally do, but for hastily written contrived examples I might :) >print "There are "+str(number)+" ways to skin a "

RE: Why do this?

2006-10-05 Thread Matthew Warren
> Duncan Booth wrote: > > > print "There are"+number+"ways to skin a"+furryanimal > > > > or at least something equivalent to it. If I try to make > the same mistake > > with a format string it jumps out to me as wrong: > > > > "There are%sways to skin a%s" % (number, furryanimal) > > Relate

RE: Why do this?

2006-10-05 Thread Matthew Warren
> [Matthew Warren] > > | Blame outlook and AutoCaps. If number were a number I would write > | > | print "There are",number,"ways to skin a "+furryanimal > > You see now that strikes me as a bit mixed up. Why not simply use? > > print "a"

RE: dictionary of list from a file

2006-10-05 Thread Matthew Warren
> -> > Python 2.5 introduced a dictionary type with automatic > > creation of values, > > ala Perl: > > > > === > > from collections import defaultdict > > > > d = defaultdict(list) > > for line in fl: > > k, v = line.strip().split() > > d[k].append(v

RE: dictionary of list from a file

2006-10-05 Thread Matthew Warren
> -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > rg] On Behalf Of Giovanni Bajo > Sent: 04 October 2006 15:17 > To: python-list@python.org > Subject: Re: dictionary of list from a file > > [EMAIL PROTECTED] wrote: > > > while(){ > > @info=split

RE: building strings from variables

2006-10-05 Thread Matthew Warren
> -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > rg] On Behalf Of Gal Diskin > Sent: 05 October 2006 16:01 > To: python-list@python.org > Subject: building strings from variables > > Following a discussion with an associate at work about various ways to > b

Using twisted, not telnetlib for interactive telnet (WAS: RE: Improving telnetlib)

2006-10-06 Thread Matthew Warren
> >The trouble is, I havent got a clue where to start and would > appreciate > >a couple of pointers to get me going... > > > > I'd suggest taking a look at Twisted, which contains a more complete > telnet implementation (not as important for being able to launch vi), > an ssh implementation (

Bad Code (that works) help me re-write!

2006-10-11 Thread Matthew Warren
I have the following piece of code, taken from a bigger module, that even as I was writing I _knew_ there were better ways of doing it, using a parser or somesuch at least, but learning how wasn't as fun as coding it... And yes alarm bells went off when I found myself typing eval(), and I'm sure th

RE: Bad Code (that works) help me re-write!

2006-10-11 Thread Matthew Warren
> -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > rg] On Behalf Of Giles Brown > Sent: 11 October 2006 12:38 > To: python-list@python.org > Subject: Re: Bad Code (that works) help me re-write! > > Matthew Warren wrote: >

RE: Any idea how to do this in Python?

2006-10-17 Thread Matthew Warren
> On 17 Oct 2006 02:56:45 -0700, Lad <[EMAIL PROTECTED]> wrote: > > > > Dennis, > > Thank you for your reply > > You say: > > >Pretend you are the computer/application/etc. How would YOU > > > perform such a ranking? > > That is what I do not know , how to perform such ranking. > > Do you have any

Return returns nothing in recursive function

2006-10-17 Thread Matthew Warren
Hallo people, I have the following code that implements a simple recursive tree like structure. The trouble is with the GetTreeBranch function, the print statement prints a valid value but the return immediatley afterward doesn't return anything. Can anyone help me with why? Thanks, Matt. Co

RE: Return returns nothing in recursive function

2006-10-17 Thread Matthew Warren
> break > else: > _DoThingsToTree(path[1:],value,item[path[0]],delete) > The '_' in front of DoThingsToTree shouldn't be there. That's what I get for trimming off the '_' elsewhere after I pasted the code in. Matt. This email is confidential and

RE: making a valid file name...

2006-10-18 Thread Matthew Warren
> > Hi I'm writing a python script that creates directories from user > input. > Sometimes the user inputs characters that aren't valid > characters for a > file or directory name. > Here are the characters that I consider to be valid characters... > > valid = > ':./,^0123456789abcdefghijklmno

RE: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-20 Thread Matthew Warren
> -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > rg] On Behalf Of Fredrik Lundh > Sent: 20 October 2006 06:43 > To: python-list@python.org > Subject: Re: Tkinter--does anyone use it for sophisticated > GUI development? > > Kevin Walzer wrote: > > > Comi

RE: [Tutor] How to get the width of teh button widget..??

2006-10-20 Thread Matthew Warren
    Folks,   Sorry for asking you such a trivial question.!!! But i want to size up all the buttons with the same size as the largest one in the interface.. And thats why I am asking this question..   Regards, Asrarahmed      Hi Asrarahmed.  I think, from yo

Telnetlib to twisted

2006-10-27 Thread Matthew Warren
Hallo, >>> import telnetlib >>> l=telnetlib.Telnet('dbprod') >>> l.interact() telnet (dbprod) Login: Could anyone show how the above would be written using the twisted framework? All I'm after is a more 'intelligent' interactive telnet session (handles 'vi' etc..) rather than the full capabilit

Asyncore Medusa Example

2006-11-29 Thread Graeme Matthew
Hi all does anyone know where you can find examples of how to write a native python webserver, I have looked at medusa and asyncore but there are no real examples and the doco is very light any help is appreciated regards graeme -- http://mail.python.org/mailman/listinfo/python-list

ftplib errors/exceptions

2006-07-30 Thread Matthew Little
I'm new to Python and I am writing a simple FTP client.  I am having trouble handling errors like connection refused, invalid username or password, and the like.  I can use a try exception block like thistry:  ftp=FTP('some_server')   ftp.login()  # more linesexcept:  print "An error has occured.\n

Re: upgrading python...

2006-08-02 Thread Matthew Miller
ritten in python. > is there a way to point 'yum' at my new python RPM, and let yum take care of > dealing with any dependcy issues? and how would yum handle weird dependency > issues with RPMs that don't exist.. does yum have the ability to actually > buil

Need advice on how to improve this function

2006-08-20 Thread Matthew Wilson
I wrote a function that converts a tuple of tuples into html. For example: In [9]: x Out[9]: ('html', ('head', ('title', 'this is the title!')), ('body', ('h1', 'this is the header!'), ('p', 'paragraph one is boring.'), ('p', 'but paragraph 2 ',

Re: Allowing ref counting to close file items bad style?

2006-08-30 Thread Matthew Woodcraft
Dan <[EMAIL PROTECTED]> wrote: > Is this discouraged?: > > for line in open(filename): > > > That is, should I do this instead?: > > fileptr = open(filename) > for line in fileptr: > > fileptr.close() One reason to use close() explicitly is to make sure tha

Re: Name of the file associated with sys.std*

2006-08-30 Thread Matthew Woodcraft
Henryk Modzelewski <[EMAIL PROTECTED]> wrote: >It might be a trivial question, but I seem to be lost. > >Is there a way to get names of the files associated with stdin/out/ >err if those are redirected to the files at the shell command-line? I doubt there is a portable way. On most linux-based s

Re: python extension modules within packages not loading

2006-09-07 Thread Matthew Woodcraft
tyler <[EMAIL PROTECTED]> wrote: > I've written a small python extension but I'm having difficulty loading > it at runtime. The source for my extension is a module which is a > member of a package is organized as follows. > > test/setup.py > test/myutils/__init__.py > test/myutils/netmodule.c [..

I wish I could add docstrings to vars.

2006-09-12 Thread Matthew Wilson
I build a lot of elaborate dictionaries in my interpreter, and then I forget exactly how they work. It would be really nice to be able to add notes to the dictionary. Is there some way to do this now? Matt -- A better way of running series of SAS programs: http://overlook.homelinux.net/wilso

Code to add docstrings to classes

2006-09-12 Thread Matthew Wilson
On Tue 12 Sep 2006 10:06:27 AM EDT, Neil Cerutti wrote: > Writing a thin wrapper around the dictionary might be beneficial, > and would also furnish a place for the docstrings. I wrote a function that hopefully does just that. I'm not very savvy at doing this class-factory stuff, so any advice w

eval(repr(object)) hardly ever works

2006-09-13 Thread Matthew Wilson
I understand that idea of an object's __repr__ method is to return a string representation that can then be eval()'d back to life, but it seems to me that it doesn't always work. For example it doesn't work for instances of the object class: In [478]: eval(repr(object())) --

Re: eval(repr(object)) hardly ever works

2006-09-13 Thread Matthew Wilson
On Wed 13 Sep 2006 10:38:03 AM EDT, Steve Holden wrote: > That's intentional. Would you have it return the code of all the methods > when you take the repr() of a class? I don't think that would be required. Couldn't you return a string with a call to the constructor inside? That's what sets.Se

Re: Thoughts on using isinstance

2007-01-24 Thread Matthew Woodcraft
abcd <[EMAIL PROTECTED]> wrote: > Well my example function was simply taking a string and printing, but > most of my cases would be expecting a list, dictionary or some other > custom object. Still propose not to validate the type of data being > passed in? There are many people here who will in

assertions to validate function parameters

2007-01-25 Thread Matthew Wilson
Lately, I've been writing functions like this: def f(a, b): assert a in [1, 2, 3] assert b in [4, 5, 6] The point is that I'm checking the type and the values of the parameters. I'm curious how this does or doesn't fit into python's duck-typing philosophy. I find that when I detect inv

Re: Thoughts on using isinstance

2007-01-25 Thread Matthew Woodcraft
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Matthew Woodcraft a écrit : >> Adding the validation code can make your code more readable, in that >> it can be clearer to the readers what kind of values are being >> handled. > This is better expressed in the

Re: assertions to validate function parameters

2007-01-26 Thread Matthew Woodcraft
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > The less your function does, the more constrained it is, the less > testing you have to do -- but the less useful it is, and the more work > you put onto the users of your function. Instead of saying something > like > a = MyNumericClass(1) > b = MyNum

Can I undecorate a function?

2007-01-29 Thread Matthew Wilson
The decorator as_string returns the decorated function's value as string. In some instances I want to access just the function f, though, and catch the values before they've been decorated. Is this possible? def as_string(f): def anon(*args, **kwargs): y = f(*args, **kwargs)

Re: Synchronous shutil.copyfile()

2007-01-30 Thread Matthew Woodcraft
Hugo Ferreira <[EMAIL PROTECTED]> wrote: > I have a problem. I'm using calling shutil.copyfile() followed by > open(). The thing is that most of the times open() is called before > the actual file is copied. I don't have this problem when doing a > step-by-step debug, since I give enough time for t

Re: Create a cookie with cookielib

2007-02-03 Thread Matthew Franz
he code of cookie.php that i've create for this example: > > setcookie("user", "Alex Porter", time()+3600); > ?> > // Print a cookie > echo $_COOKIE["user"]; > // A way to view all cookies > print_r($_COOKIE); > ?> > > if anyone could help... Thank you > -- > http://mail.python.org/mailman/listinfo/python-list > -- Matthew Franz http://www.threatmind.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: python linux distro

2007-02-08 Thread Matthew Franz
> thanks guys > > when i wrote this, i thought that out there is some crazy guy like me. > i was hoping for more support but after these arguments, there is > nothing more then to say:you are right. the world doesnt need another > distro. but if one day I mange to do it, hope you will be glade that

Re: starship.python.net is down

2007-02-21 Thread Matthew . Cahn
Hi, Any news on starship.python.net? It still seems to be down. Matthew On Feb 16, 8:57 am, Tom Bryan <[EMAIL PROTECTED]> wrote: > One of the system administrators had to reboot starship.python.net last > night, but it appears that the machine did not come back

Curious UnboundLocalError Behavior

2007-02-28 Thread Matthew Franz
k.local', '8.8.5', 'Darwin Kernel Version 8.8.5: Mon Dec 11 19:39:17 PST 2006; root:xnu-792.16.5.obj~1/RELEASE_I386', 'i386') 2.4.3 (#1, Feb 24 2007, 23:01:32) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] {'__builtins__': , '__file__': 'unboundlocal.py', 'SOMEGLOBAL': 1, 'sys': , '__name__': '__main__', 'foo': , 'os': , '__doc__': None} SOMEGLOBAL: 0 -- Matthew Franz http://www.threatmind.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: starship.python.net is down

2007-03-01 Thread Matthew . Cahn
with the host company to > determine what's going on. I think that they are still in the > "investigation" stage at the moment, so it's hard to give an estimate of > when the problem will be fixed. > > Thanks for your patience, > ---Tom I appreciate the update. Thank

  1   2   >