Re: [Tutor] Subclassing list

2009-06-18 Thread Luis N
On Fri, Jun 19, 2009 at 12:56 AM, bob gailer wrote: > > Luis N wrote: >> >> I get an error "TypeError: 'rounding' is an invalid keyword argument >> for this function" on my list subclass. >> >> How might I subclass list without this er

[Tutor] Subclassing list

2009-06-18 Thread Luis N
I get an error "TypeError: 'rounding' is an invalid keyword argument for this function" on my list subclass. How might I subclass list without this error? This is the code: class SeriesList(list): def __new__(cls, *args, **kwargs): series_list = list.__new__(cls, *args) serie

Re: [Tutor] Nested, line by line, file reading

2007-12-16 Thread Luis N
On Dec 16, 2007 10:17 PM, jon vs. python <[EMAIL PROTECTED]> wrote: > Hi everyone, > I have a file with this content: > > "1 > 1 > 1 > 1 > 1 > 1 > 1 > 2 > 1 > 1" > > I wanted a little script that would print the line containing "2" and every > line containing "1" after it. I've tried this: > > >>>

Re: [Tutor] Introspect function or class' required arguments

2007-12-13 Thread Luis N
On Dec 14, 2007 12:08 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > Luis N wrote: > > Is there a way to introspect a function or class' required arguments, > > particularly keyword arguments? > > See inspect.getargspec() and formatargspec(). > Look at the sour

[Tutor] Introspect function or class' required arguments

2007-12-13 Thread Luis N
Is there a way to introspect a function or class' required arguments, particularly keyword arguments? I can easily use a dictionary since it is my own function that I wish to introspect. I haven't tested the below code yet, but e.g. obj = getattr(self, 'obj')() preprocessors = {'Card':[{'obj_attr

Re: [Tutor] Python Versions

2007-12-12 Thread Luis N
On Dec 13, 2007 3:38 PM, earlylight publishing <[EMAIL PROTECTED]> wrote: > Do people really write whole applications just using the shell? > The shell isn't intended for writing whole applications. However, it's invaluable for testing. For writing whole applications I'd recommend The One True Edit

Re: [Tutor] Still Can't Find Timed While Loops

2007-12-07 Thread Luis N
I can't recall what your initial project was. I think it was a text adventure. I imagine that you have bigger ideas regarding timers then your current code suggests. Maybe you should investigate a time aware long-running process. Twisted Python is such a beast. While I can't recommend it's use as

[Tutor] Help with modulus.

2007-11-27 Thread Luis N
I'd like the below to be a single line if possible. hours = metrics.totaltime/360 minutes = (metrics.totaltime - 360*hours)/6 seconds = (metrics.totaltime - 360*hours - 6*minutes)/1000 Would it be possible to simplify this with a generator expression e.g. total_time = tuple((

Re: [Tutor] Any good Glade and python tutorials?

2005-10-18 Thread Luis N
You might want to search for how it fits together with twisted's reactor http://www.google.com/search?q=twisted+glade+reactor Luis. On 10/15/05, Adam <[EMAIL PROTECTED]> wrote: > I'm making a Twisted app that needs a client side GUI and GTK seems like the > best way to go about this. Can anybody

Re: [Tutor] Boa-Constructor

2005-09-15 Thread Luis N
> Luis, > > I was actually asking how usable Boa-Constructor is right now for project > purposes, since I had "heard" it was kind of unstable and crashes a lot. Is > that your experience with Boa-Constructor? Or was the information I found > misleading? > > Thanks, > Terry I found Boa-co

Re: [Tutor] Venom / Python23.dll missing

2005-09-13 Thread Luis N
On 9/11/05, Damien Gouteux <[EMAIL PROTECTED]> wrote: > Hi all. > I try to run Venom, a Python binding for the Irrlicht engine. But I need > python23.dll. Download a game from pygame.org Luis. ___ Tutor maillist - Tutor@python.org http://mail.python

Re: [Tutor] Boa-Constructor

2005-09-13 Thread Luis N
On 9/12/05, Terry Kemmerer <[EMAIL PROTECTED]> wrote: > Hey Guys, > > I am trying to pick an IDE, and it seems to me that Boa-Constructor has > great potential. Did you check Boa out of CVS? It tends not to have an intermittent schedule of releases. Luis

Re: [Tutor] Python2.3.4, PySqlite2 and Solaris

2005-09-02 Thread Luis N
On 9/1/05, Luis N <[EMAIL PROTECTED]> wrote: > Hi, > > After fighting with installing pysqlite2 Apologizes, I started over. It went much better the second time. bash-2.05

[Tutor] Python2.3.4, PySqlite2 and Solaris

2005-09-01 Thread Luis N
Hi, After fighting with installing pysqlite2, (although you require the .tar.gz for a *Nix build, the header file required, sqlite3.h, was actually in the source .zip supplied for windows users sans a unix build environment) Anyway, I have pysqlite2, but: Python 2.3.4 (#1, Aug 23 2004, 13:59:34)

Re: [Tutor] Website Retrieval Program

2005-08-24 Thread Luis N
On 8/24/05, Daniel Watkins <[EMAIL PROTECTED]> wrote: > I'm currently trying to write a script that will get all the files > necessary for a webpage to display correctly, followed by all the > intra-site pages and such forth, in order to try and retrieve one of the > many sites I have got jumbled u

Re: [Tutor] Counting help

2005-08-23 Thread Luis N
On 8/23/05, Scott Oertel <[EMAIL PROTECTED]> wrote: > I have extracted a list of names, i.e. > > "Joe Smith" > "Joe Smith" > "Jack Smith" > "Sam Love" > "Joe Smith" > > I need to be able to count the occurances of these names and I really > don't have any idea where to begin. > > Any ideas? exc

Re: [Tutor] Remove a number from a string

2005-08-23 Thread Luis N
On 8/23/05, Shitiz Bansal <[EMAIL PROTECTED]> wrote: > Hi, > Suppose i have a string '347 liverpool street'. > I want to remove all the numbers coming at the starting of the string. > I can think of a few ways but whats the cleanest way to do it? > > Shitiz > I believe this question to be

Re: [Tutor] LiveWires problems

2005-08-16 Thread Luis N
On 8/15/05, ZIYAD A. M. AL-BATLY <[EMAIL PROTECTED]> wrote: > On Mon, 2005-08-15 at 11:52 -0400, Michael Murphy wrote: > > Hi all > > > > I'm having problems with installing LiveWire for python for Linux > > (Linspire 5.0 to be exact) and I'm having trouble compiling setup.py. > > Heres the results

Re: [Tutor] Replacement for 'Find' Module

2005-08-15 Thread Luis N
On 8/15/05, Simon Gerber <[EMAIL PROTECTED]> wrote: > You could probably do something like this... (Note: This example is > for Linux - but you can adapt it fairly easily to Windows.) > > > # E.g. Find every .inf file on a CD-ROM. > path = '/cdrom' > # 'E:\\' or whatever for Windows > inf_lis

Re: [Tutor] Python hosting again

2005-08-15 Thread Luis N
On 8/11/05, Jorge Louis De Castro <[EMAIL PROTECTED]> wrote: > Hello, > > I'm interested in writing with my own Python implementation of a Jabber IM > server and client. > Anyone knows where I could host my Python Jabber IM server for a reasonable > monlthy fee? It doesn't need to be a top-not

Re: [Tutor] web gallery

2005-08-15 Thread Luis N
On 8/15/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi All, > > I'd like to write some web gallery software from scratch for my girlfriend. > I've looked at the > PIL (python imaging library) and I'm using it to > generate thumbnails from given images. > Something else i'd like to get done

Re: [Tutor] python and xml

2005-08-13 Thread Luis N
On 8/13/05, David Holland <[EMAIL PROTECTED]> wrote: > What is a good way of using xml and python ? ElementTree? http://effbot.org/zone/element-index.htm or, lxml http://codespeak.net/lxml/ Luis. ___ Tutor maillist - Tutor@python.org http://mail.pyth

Re: [Tutor] Assistance!

2005-08-07 Thread Luis N
On 8/7/05, gordnjen <[EMAIL PROTECTED]> wrote: > > I am now stuck again. I am at my wit's end. The course I am taking is a > supposed "beginners" course. It is a distance education class, and our > textbook does NOT contain the information required to do all of the > assignments (perhaps it was de

Re: [Tutor] Is there a qucker method than the following?

2005-08-05 Thread Luis N
On 8/5/05, Nathan Pinno <[EMAIL PROTECTED]> wrote: > > Hi all, > > Is there a quicker method than the following? > > import random > numbers = [0,1,2,3,4,5,6,7,8,9,10,11,12] > cards = > ["Ace","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King"] > hand = {

Re: [Tutor] [Metakit] Mk4py

2005-08-04 Thread Luis N
On 8/4/05, Brian Kelley <[EMAIL PROTECTED]> wrote: > Yeah the spaces kill me as well sometimes, and then I think that the > spaces are okay sometimes. > > The real issue is that a metakit column name can include any printable > character except a comma ",". > > So, now you know :) > > Here is an

Re: [Tutor] Zope/Python web devel

2005-08-03 Thread Luis N
On 8/3/05, Jay Loden <[EMAIL PROTECTED]> wrote: > I've been considering some web projects recently, but I have some concerns > about selecting the tools I plan to use. I like Python, and I was immediately > thinking of using Zope to build on. > > However, I am concerned about performance, resource

Re: [Tutor] Web Browser in Python

2005-08-03 Thread Luis N
On 8/3/05, Shitiz Bansal <[EMAIL PROTECTED]> wrote: > Hi, > I need to program a web browser in python.I dont have any idea of how to > start, what i do have is time and willingness to learn.Could anyone direct > me to some suitable reference? > Shitiz > How about Grail http://grail.sourceforge.

Re: [Tutor] single executable

2005-07-31 Thread Luis N
On 7/31/05, Jorge Louis de Castro <[EMAIL PROTECTED]> wrote: Hi,Thanks for your reply. I have been googling this issue and found thisarticle:http://starship.python.net/crew/theller/moin.cgi/SingleFileExecutable that seems to indicate what I want is possible and it is available. Hi, I looked at th

Re: [Tutor] How do I go about this?

2005-07-27 Thread Luis N
On 7/27/05, Luis N <[EMAIL PROTECTED]> wrote: On 7/27/05, Nathan Pinno <[EMAIL PROTECTED] > wrote: Hi all,   How do I go about the following: I want to write a program that will print two lists one after another, then show all the available possibilities for matches e.g a0 an

Re: [Tutor] How do I go about this?

2005-07-27 Thread Luis N
On 7/27/05, Nathan Pinno <[EMAIL PROTECTED]> wrote: Hi all,   How do I go about the following: I want to write a program that will print two lists one after another, then show all the available possibilities for matches e.g a0 and x0.   Here is what I have so far:   lista = [x0, x1, x2, x3

Re: [Tutor] String slicing from tuple list

2005-07-21 Thread Luis N
On 21 Jul 2005 20:39:36 +0100, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi,I have a list of tuples like this:[(1423, 2637),(6457, 8345),(9086, 10100),(12304, 15666)] Each tuple references coordinates of a big long string and they are in the'right' order, i.e. earliest coordinate first within ea

Re: [Tutor] hello

2005-07-21 Thread Luis N
On 7/21/05, dina lenning <[EMAIL PROTECTED]> wrote: YES...heres my problem  I am a university student..will be a teacher in 2 years hopefully..andhave taken a first year computing course that said it required NO PRIORknowledge, but i am having great difficulty. The students (71 of them) are all co

Re: [Tutor] globals and map()

2005-07-19 Thread Luis N
On 7/19/05, Kent Johnson <[EMAIL PROTECTED]> wrote: Luis N wrote:> I'd appreciate some comments on my use of globals and the map function.>> import metakit> import marshal>> db = metakit.storage('addy.mk <http://addy.mk>',1)> dbs = db.getas(&#

[Tutor] globals and map()

2005-07-19 Thread Luis N
I'd appreciate some comments on my use of globals and the map function. The idea here is that (simple) Metakit database definitions can be loaded dynamically from another Metakit database detifintion. (Yes this would likely be easier with a SQL database, don't ask!) Nasty code ahead: import metak

Re: [Tutor] OT, Tcl & Python

2005-07-19 Thread Luis N
27;ve skimmed through it a bit, and will give it a more thorough read shortly. Thanks! Luis N  ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] OT, Tcl & Python

2005-07-16 Thread Luis N
Hi, I was wondering if someone knowledgeable of both Tcl and Python could suggest whether it would be a good or a bad idea to write a Python/Tk application, with the motive to rewrite the application in Tcl/Tk once completed. My reason for considering this route is that I have never written a sing

Re: [Tutor] Iterating over nested lists part2

2005-07-03 Thread Luis N
On 7/2/05, Kent Johnson <[EMAIL PROTECTED]> wrote: Luis N wrote:> def listItems():> l= []> d = {}> for r in range(len(vw)):> for x in range(lt):> ed = desc[x]> exec("d['%s']=vw[%d].%s" % (ed,r,ed)) &g

[Tutor] Iterating over nested lists part2

2005-07-02 Thread Luis N
m vw by 5. How can I have: for each record in the database:     for each column in the record:     do stuff. Without multiplying the result i.e len(vw) * lt Thanks. Luis N. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] slicing nested lists/dicts/tuples

2005-07-02 Thread Luis N
On 7/2/05, Luis N <[EMAIL PROTECTED]> wrote: Umm, sorry, I meant: d[desc[x]] = exec("""'vw[%s].desc[%s]'""" % (r,x )) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] slicing nested lists/dicts/tuples

2005-07-02 Thread Luis N
dded without changing the code. I thought that if: def listItems():     l= []     d = {}     lt = len(desc)     for r in range(len(vw)):     for x in range(len(lt)):     d[desc[x]] = exec("""'vw'+[r]+'.'+desc[x]""")     l.append(d)

[Tutor] slicing nested lists/dicts/tuples

2005-06-28 Thread Luis N
Hi, >>> l [{'last': 'Bar', 'first': 'Foo'}, {'last': 'Bar', 'first': 'Foo'}, {'last': 'Bar', 'first': 'Foo'}, {'last': 'Bar', 'first': 'Foo'}] This is how I imagine it: for i in l:     for j in l[i]:         for k in l[i][j]:             print k.get('first')     print k.get('last') Is

Re: [Tutor] how to setup gnu.py

2005-04-01 Thread Luis N
I grabbed this from the docs: Gnuplot.py uses Python distutils and can be installed by untarring the package, changing into the top-level directory, and typing "python setup.py install". The Gnuplot.py package is pure Python--no compilation is necessary. On Mar 30, 2005 11:13 PM, jrlen balane <[

[Tutor] xmlrpc server

2005-03-23 Thread Luis N
Hi, I've been exploring xmlrpc implementations, and am somewhat confused as to what I should use. I've spent the most time poking at Twisted, which took me a while to figure out the basics of, and have spent a moment or two exploring py-xmlrpc as well as SimpleXMLRPCServer in the standard library.

[Tutor] slow html generation code

2005-03-02 Thread Luis N
This code seems a little slow, is there anything in particular that jumps out as being not quite right. The idea is that a file is opened that contains path names to other files, that are appended and outputed into a directory of choice. I plan to move this off the filesystem into a database when

[Tutor] Class in a class

2005-02-17 Thread Luis N
Does it make sense to do this: In [2]: class AB: ...: pass ...: In [3]: a = AB() In [4]: a Out[4]: <__main__.AB instance at 0x8428bec> In [5]: class BC: ...: def __init__(self, foo): ...: self.foo = foo In [6]: b = BC(a) In [7]: b.foo Out[7]: <__main__.AB instance a

Re: [Tutor] elementtree, lists, and dictionaries

2005-02-17 Thread Luis N
Thanks that's much nicer. On Fri, 11 Feb 2005 22:28:55 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > If you iterate over the author nodes you can check the user name and password > of each in turn. > > Not tested code! > > def authenticateAuthor(author, password): > authorxml = 'author.x

[Tutor] elementtree, lists, and dictionaries

2005-02-11 Thread Luis N
Hi, This code works, but I don't like it much: def authenticateAuthor(author, password): authorxml = 'author.xml' path = os.path.join(xml, authorxml) try: if not os.path.exists(path): authorfile = False else: authorfile = True tree = E.ElementTree(file=path

Re: [Tutor] ascii encoding

2005-01-25 Thread Luis N
In other words I have to do some arithmetic: >>> import time >>> time.timezone 0 The server is located in Dallas, Texas. On Wed, 26 Jan 2005 15:44:48 +1300, Tony Meyer <[EMAIL PROTECTED]> wrote: > > time.timezone gives you, I think, the offset between > > your current timezone and GMT. However,

Re: [Tutor] ascii encoding

2005-01-25 Thread Luis N
Ok, urllib.quote worked just fine, and of course so did urllib.pathname2url. I should have run a dir() on urllib. Those functions don't appear in http://docs.python.org/lib/module-urllib.html Now, how might one go about calculating the New York time off-set from GMT? The server is in the U.S. but

[Tutor] ascii encoding

2005-01-24 Thread Luis N
How would I best turn this string: '2005-01-24 00:00:00.0' into this string: '2005%2D01%2D24%2000%3A00%3A00%2E0' In order to call a URL. I've hunted through the standard library, but nothing seemed to jump out. Thank You. ___ Tutor maillist - Tuto

[Tutor] CGI and cookies.

2005-01-05 Thread Luis N
When the script begins with main(f), it gets a KeyError and goes to the login page, but when the form data is submitted it returns a 404. Am I not setting/getting the cookie properly? Absolutely nothing is printed until zptIO is called. import os import Cookie from spanishlabs.conf import * from s

[Tutor] *args, **kwargs

2005-01-01 Thread Luis N
Hi, I gave this a quick read: http://aspn.activestate.com/ASPN/Mail/Message/573292 I'm wondering how I can turn a variable number of keyword arguments passed to a class into variables for use in said class: #This so doesn't work class SomethingLikeThis: def __init__(self, **kwargs):

[Tutor] cgi.FieldStorage and dictionary.get(' ')

2004-12-30 Thread Luis N
Hi, I've passed this through the interperter line-by-line, yet still can't get it to work right. The first time the cgi driver script initiates it runs the login function which renders a zpt. Upon submission of their vitals, the user is authenticated via sqlobject, and if they pass the chapters

Re: [Tutor] Comments appreciated

2004-12-29 Thread Luis N
> [Jeff] > > Also, even though this is intended to be a quick shell script, it's > > not a bad idea to make everything except function defs into a little > > main() function, and call it in a script-only section. > > > [Luis] > > > The only thing I'm not clear about is how 'trashcan' can be a >

Re: [Tutor] Comments appreciated

2004-12-26 Thread Luis N
Hi, Jeff Shanon, thanks for your help. I was wondering if there was a function to automatically get the user on a *nix system, and had tried the if __name__ == __main__ but didn't really get it until your example. The only thing I'm not clear about is how 'trashcan' can be a local variable inside

[Tutor] Comments appreciated

2004-12-21 Thread Luis N
This is the most meaningful thing this newbie has ever done. Comments are appreciated: #!/usr/local/bin/python trashcan = "/home/anewby/.trashcan" import os, sys, shutil junk = [] for arg in sys.argv: junk.append(arg) junk = junk[1:] empty = False if "-e" in junk: empty = True ju