I agree with Andrei:
Use an instance variable until you need it to do something special, and then
convert it to a property.
Thanks,
Ryan
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrei
Sent: Wednesday, April 13, 2005 2:41 AM
To: tutor@python.org
Make a flowchart, by hand, on paper of what this program does. That should
help explain the why.
Basically, after 3 attempts, your "while" loop becomes an infinte loop. Once
you are over the count, the user is never prompted for
another password, so the password remains not equal to "unicorn"
I couldn't compile it either, but got it working by copying the MSSQL.py and
bin/python2.3/mssqldb.pyd from the archive to my
site-packages directory.
He scarcely mentions that option at the bottom of the install page:
http://www.object-craft.com.au/projects/mssql/install.html.
Not sure if the b
I had the same question. The best I found is this:
http://www.object-craft.com.au/projects/mssql/
but that has a lot of strong language saying "this isn't ready for use".
I found it perfectly usable for simply running queries, but haven't tried to do
anything more complicated with it. Not sure
Does anyone know of a decent way to access a SQL Server 2000 database?
I've gotten some versions working using dbi,odbc and defining a DSN on the
computer, but I'd like to be able to specify a server,
user, pass, and database in code. As far as I can tell, I'd have to define a
DSN for every dat
Sure.
Thanks,
Ryan
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin
Sent: Wednesday, March 30, 2005 4:00 PM
To: tutor@python.org
Subject: [Tutor] A simple question about creating a program
I was wondering, can you make a program the uses alot of cla
HTML page?
If not, making a GUI might be an alternative that sidesteps this altogether.
Thanks,
Ryan
-Original Message-
From: Mike Hall [mailto:[EMAIL PROTECTED]
Sent: Friday, March 25, 2005 3:46 PM
To: Ryan Davis
Cc: tutor@python.org
Subject: Re: [Tutor] Python and Javascript
Ryan
Depends on your environment.
If your js is on a webpage, you can have it make http calls to a python web
service. Look for articles on XMLHttpRequest in
javascript to see some examples.
I don't know how else that could be done, but I imagine there are other ways.
Thanks,
Ryan
-Original M
A comprehension and range?
#
>>> list1 = [1 for x in range(0,96)]
>>> len(list1)
96
#
Thanks,
Ryan
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jrlen balane
Sent: Friday, March 25, 2005 2:03 PM
To: Tutor Tutor
Subject: [Tutor] a shorter way to write
Did you put them in quotes?
#
If choice == 'c':
...
#
Thanks,
Ryan
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Carmona
Sent: Thursday, March 24, 2005 5:52 PM
To: tutor@python.org
Subject: [Tutor] Defining functions
Hi there,
I have written
I'm not sure if you can or want to do this solely one list comprehension.
You could make a helper function and use map:
###
def helper(i):
i.pop(3)
return map(int, i)
a = map(helper, x)
###
Description of map:
http://docs.python.org/lib/built-in-funcs.html
I think map is a little clea
You could make the __init__ take the filename:
def __init__(self, filename=None):
#do whatever
And then instantiate the object like:
>>>x = someClass(filename="someFile")
Alternatively, you could make the Open function a module level function,
defined in someClass.py, but not in the actual c
You could use split() to split the contents of the file into a list of strings.
###
>>> x = 'asdf foo bar foo'
>>> x.split()
['asdf', 'foo', 'bar', 'foo']
###
Here's one way to iterate over that to get the counts. I'm sure there are
dozens.
###
>>> x = 'asdf foo bar foo'
>>> counts = {}
>>> for
s,
Ryan
-Original Message-
From: Alan Gauld [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 12, 2005 3:52 AM
To: EJP; Ryan Davis; tutor@python.org
Subject: Re: [Tutor] Larger program organization
> without trying to make this one of those classic threads of great,
> do you f
pay for before I can make any reasonable
argument.
Thanks,
Ryan
Ryan Davis
Director of Programming Services
http://www.acceleration.net/
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Check out COG (http://www.nedbatchelder.com/code/cog/), a macro system for any
language created by Ned Batchelder
(http://www.nedbatchelder.com/).
I'm not sure if that's what you're looking for, but allows some good macro
capabilities.
Thanks,
Ryan
-Original Message-
From: [EMAIL PROT
I'm having the same problem, and am eager to hear the responses. As far as a
"real" IDE, emacs works pretty well, and check out
Komodo, the ActiveState IDE:
http://www.activestate.com/Products/Komodo/
Thanks,
Ryan
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] O
each
script:
>>> import sys
>>> sys.path.append('../')
Thank you all very much for you help.
Thanks,
Ryan
-Original Message-
From: Jacob S. [mailto:[EMAIL PROTECTED]
Sent: Friday, January 07, 2005 9:37 PM
To: Alan Gauld; Ryan Davis; Tutor@python.org
Subject: Re:
I think you want to be doing something like:
>>>for r,d,f in os.walk('.'):
... for filename in f:
... print os.path.join(r,filename)
I think that would give you the full path of every file, and then you can open
it, do a regex substitution or whatever close it and
keep going.
Th
Hello all,
I'm just starting to use python seriously, and am having
problems understanding exactly what is going on with import statements and the sys.path variable.
I'm trying to import classes and functions across several
directories. Here's a simple
example of my filesystem:
/D
20 matches
Mail list logo