Hello Pythonistas,
Running the script 'instantiate_and_reload.py' gives me the error
TypeError: unbound method __init__() must be called with ParentClass
instance as first argument (got ChildClass instance instead)
on the last call to ChildClass(), at line 23. The earlier calls don't trigge
Danny Yoo wrote:
> [snip]
> First, it ignores zero, which is a cardinal sin.
Or is it an ordinal sin?
[snip]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 24/01/2008, Ricardo Aráoz <[EMAIL PROTECTED]> wrote:
> Isn't dictionary access faster than list access? Why are three lists
> 'much more efficient'?
Well, not necessarily.
If you want a dictionary, you could use a list of tuples:
myDict = [('a', 'one'), ('b', 'two), ('c', 'three')]
Then you
> Isn't dictionary access faster than list access? Why are three lists
> 'much more efficient'?
Oh no, no, no. Dictionaries are faster when you are *searching through* for
a particular value. If you already know the index of the item in the list,
lists are much faster.
Dictionaries are hash ba
> This could be written much more efficiently. It can be done with only
> these
> lists~
> ones =
> ['zero','one','two','three','four','five','six','seven','eight','nine']
> teens =
> ['ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']
What is it
Tiger12506 wrote:
>> up to a thousand (not tested)
>>
>> words = {0:'zero', 1:'one', 2:'two', 3:'three', ... , 10:'ten',
>> 11:'eleven', 12:'twelve', ..., 19:'nineteen',
>> 20:'twenty', , 90:'ninety', 100:'one hundred' }
>> def digitToString(n) :
>>try :
>>retStr = words[n]
> up to a thousand (not tested)
>
> words = {0:'zero', 1:'one', 2:'two', 3:'three', ... , 10:'ten',
> 11:'eleven', 12:'twelve', ..., 19:'nineteen',
> 20:'twenty', , 90:'ninety', 100:'one hundred' }
> def digitToString(n) :
>try :
>retStr = words[n]
>except KeyError :
>
Danny Yoo wrote:
> Hi Jason,
>
>
> Looking back at that Java code:
>
>
> static String convertDigitToEnglish(int d) {
> switch ( d )
> {
>case 1: return "one";
>case 2: return "two";
>case 3
Hi Jason,
Looking back at that Java code:
static String convertDigitToEnglish(int d) {
switch ( d )
{
case 1: return "one";
case 2: return "two";
case 3: return "three";
case 4: retu
> However, Debian is known for stability and security, right? I don't know
> if I should install things without apt in a production environment, so I
> first have to ask my guru if it's alright.
The *point* of buildout is that the entire installation is *local* to
the application. There is no chan
Sounds very good! I think I read something about Python eggs some time
ago, but didn't look deeper into it then. I'll do so tomorrow (if I find
some spare time - there's so much to do...)
However, Debian is known for stability and security, right? I don't know
if I should install things without
Terry Carroll wrote:
> I'm no Java expert, but isn't Java's Map more or less equivalent to
> Python's dictionary?
More or less, except Python dicts are about 10x easier to use.
Some (overly complicated) examples here:
http://personalpages.tds.net/~kent37/stories/00017.html
Kent
On Wed, 23 Jan 2008, Jason Massey wrote:
> An example routine to translate a number into [its] english equivalent
> was given (again, this is Java):
> static String convertDigitToEnglish(int d) {
> switch ( d )
> {
>
> case 1: return "one";
> case 2: return "two"
I've done similar with pexpect:
http://pexpect.sourceforge.net/
washakie wrote:
> Hello, I'm trying to write a script which will allow me to create a reverse
> tunnel from a remote machine using SSH -R
>
> I know the reverse tunnel script works on it's own run from the shell, but I
> don't want
It's a distribution issue. As far as what I've found as having cutting
edge (or even reasonably fresh) python packages in your package
manager is dictated by the distro, who vary wildly in this.
Debian SID at times> All the Ubuntus > Debian SID at times> Fedora
Core > Debian testing > Debian stabl
It's a distribution issue. As far as what I've found as having cutting
edge (or even reasonably fresh) python packages in your package
manager is dictated by the distro, who vary wildly in this.
Debian SID at times> All the Ubuntus > Debian SID at times> Fedora
Core > Debian testing > Debian stabl
washakie wrote:
> Hello, I'm trying to write a script which will allow me to create a reverse
> tunnel from a remote machine using SSH -R
>
> I know the reverse tunnel script works on it's own run from the shell, but I
> don't want to leave it open always... does anyone have any ideas on how to
> m
I run MySQLdb with Python 2.5.1, but I had to build it manually. It was not
part of any prebuilt package on my RedHat box. You should be able to do the
same.
J
On Jan 23, 2008 10:01 AM, <[EMAIL PROTECTED]> wrote:
> I decided to install Python2.5 on the server machine to save me the time
> for
I decided to install Python2.5 on the server machine to save me the time
for low-level debugging >;) but it doesn't find the MySQLdb module...
I searched through aptitude - the only thing I find is MySQLdb for Py2.4
... What's happening here?
I have to say that the client PC (on which my script
Have you looked into Paramiko?
http://www.lag.net/paramiko/
Its a port of the ssh2 protocol for python. It might be easier to do this
using that that subprocess calls. Paramiko is quite nice, I use it a lot at
work. Just a suggestion
J
On Jan 23, 2008 3:42 AM, washakie <[EMAIL PROTECTED]
On Jan 22, 2008 5:10 PM, Damian Archer <[EMAIL PROTECTED]> wrote:
> So anyone have any good project ideas, perhaps projects that people have
> undertaken before??
>
>
I'm taking a Java class this semester and our first program is a number
translator. Here's the assignment:
*Below is a sample
[EMAIL PROTECTED] wrote:
> I guess that's it - my client has 2.5 while the server runs 2.4 ... I
> don't think any differences are mentioned in the library reference for
> csv but I'll have a second look.
According to
http://www.python.org/doc/2.5/whatsnew/modules.html
"The csv module, which par
Kent Johnson schrieb:
> [EMAIL PROTECTED] wrote:
>
>> import csv
>> import MySQLdb
>> import sys
>>
>> try:
>> datei = sys.argv[1]
>> except:
>> print("Usage: insert_into_db <.csv-file>")
>>
>> # convert csv to list
>> reader = csv.reader(open(datei, "rb"), delimiter = ";", quote
[EMAIL PROTECTED] wrote:
> import csv
> import MySQLdb
> import sys
>
> try:
> datei = sys.argv[1]
> except:
> print("Usage: insert_into_db <.csv-file>")
>
> # convert csv to list
> reader = csv.reader(open(datei, "rb"), delimiter = ";", quotechar = "",
> quoting = csv.QUOTE_N
hi,
I have hello.cpp and hello.py file. I want to access hello.cpp from
hello.py. How can I do that.
I tried to find the solutions, I got Boost python. I saw the tutorial
I tried to do what they mentioned in the tutorial. I confused with "jamfile"
and "project-root". I am using debian I
I don't get this.
I wrote a script that reads data from a .csv file and puts them into a
MySQL database. It works fine on my machine.
Here's the relevant part:
import csv
import MySQLdb
import sys
try:
datei = sys.argv[1]
except:
print("Usage: insert_into_db <.csv-file>")
Damian Archer wrote:
> So anyone have any good project ideas, perhaps projects that people have
> undertaken before??
This just came up on the list:
http://mail.python.org/pipermail/tutor/2008-January/059653.html
Kent
___
Tutor maillist - Tutor@pyth
On Tue, Jan 22, 2008 at 11:10:18PM +, Damian Archer wrote:
>So anyone have any good project ideas, perhaps projects that people
>have
>undertaken before??
I am in the same situation as you are. What I now did was doing
something practical and some fun stuff: such as writing a sta
Hello, I'm trying to write a script which will allow me to create a reverse
tunnel from a remote machine using SSH -R
I know the reverse tunnel script works on it's own run from the shell, but I
don't want to leave it open always... does anyone have any ideas on how to
make this work? There seems
29 matches
Mail list logo