Re: [Tutor] passing arguments to functions - problem with argument order

2008-03-11 Thread tetsuo2k6
Alan Gauld schrieb: > > Fine, but I would seriously consider learning dicts as a prioritry. > Certainly way higher that learning OOP. In fact being comfortable > with dictionaries will make understanding OOP much easier > since a class is really just a special type of dictionary!. > > Alan G. >

Re: [Tutor] passing arguments to functions - problem with argument order

2008-03-11 Thread tetsuo2k6
Alan Gauld schrieb: > <[EMAIL PROTECTED]> wrote > >> And I thought I might get away without using dicts... > > Why would you want to? Dicts are one of the most > powerful data structures around. > > And besides Python is built from dicts so you can > never truly get away without using them. E

Re: [Tutor] passing arguments to functions - problem with argument order

2008-03-10 Thread tetsuo2k6
That's it! Paul Andreas Kostyrka schrieb: > What you probably want is to pass: > > writer(None, "field1", "field2") > > Andreas > > Am Montag, den 10.03.2008, 16:28 +0100 schrieb [EMAIL PROTECTED]: >> And I thought I might get away without using dicts... >> >> Thanks, Greg >> >> >> >> Greg G

Re: [Tutor] passing arguments to functions - problem with argument order

2008-03-10 Thread tetsuo2k6
And I thought I might get away without using dicts... Thanks, Greg Greg Graham schrieb: > Paul, > > Python does not allow mixing variable length arguments and keyword arguments > in that way. To accomplish what you want, you must add an argument preceded > by a "**" which will be a dict cont

[Tutor] passing arguments to functions - problem with argument order

2008-03-10 Thread tetsuo2k6
I don't get this - what is the clean way of the order of passing arguments to functions? The called function goes like this: def csvwriter(output_csv_filename=None, *coloumn_definitions): """Edit Me!""" if output_csv_filename == None: output_csv_filename = raw_

Re: [Tutor] identifying the calling module/function

2008-03-10 Thread tetsuo2k6
Kent Johnson schrieb: > [EMAIL PROTECTED] wrote: > >> in dgf.py: (hope the formatting gets good for you, t-bird breaks the >> lines badly on my machine...) >> >> def csvwriter(*column_definitions): >> """Edit Me!""" >> if sys.argv[0] == /usr/local/bin/xyz.py: >> output_c

Re: [Tutor] identifying the calling module/function

2008-03-08 Thread tetsuo2k6
Jeff Younker schrieb: > > Telling us your goal might allow us to recommend a better > and faster way of accomplishing it. > > - Jeff Younker - [EMAIL PROTECTED] - > > > in dgf.py: (hope the formatting gets good for you, t-bird breaks the lines badly on my machine...) def csvwriter(*column_d

Re: [Tutor] identifying the calling module/function

2008-03-07 Thread tetsuo2k6
Kent Johnson schrieb: > [EMAIL PROTECTED] wrote: >> Hello Tutor! >> >> I am building a couple of scripts to manage a database for our >> company. The projects name is 'dgf'. As a lot of the functionality is >> used in more than one of these scripts, I moved this functionality to >> a module (dgf

[Tutor] identifying the calling module/function

2008-03-07 Thread tetsuo2k6
Hello Tutor! I am building a couple of scripts to manage a database for our company. The projects name is 'dgf'. As a lot of the functionality is used in more than one of these scripts, I moved this functionality to a module (dgf.py). It has several functions now. Question: Is there an easy wa

Re: [Tutor] MySQLdb for Python 2.5? (Debian related)

2008-01-24 Thread tetsuo2k6
Michael Langford schrieb: >> 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

Re: [Tutor] MySQLdb for Python 2.5? (Debian related)

2008-01-23 Thread tetsuo2k6
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

[Tutor] MySQLdb for Python 2.5? (Debian related) (was: csv.reader: bad argument type)

2008-01-23 Thread tetsuo2k6
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

Re: [Tutor] csv.reader: bad argument type

2008-01-23 Thread tetsuo2k6
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

[Tutor] csv.reader: bad argument type

2008-01-23 Thread tetsuo2k6
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>")