Re: how to print newline in xml?

2006-06-01 Thread [EMAIL PROTECTED]
Thank you for a possible solution, but it's not what I'm looking for, cause something like !-- comment -- would look quite similar... for big elements like robot it would be ok to use comment as a child of element - but imagine I'd like to comment transformation: transformation x=0 y=0 z=0/ I

Python Programmerwanted

2006-06-01 Thread Laura van Tuin
Python programmer wantedOur fast-growing team of software developers is currently looking for a (junior) Python programmer to assist in the development of our core technology.To extend the core team we're looking for a talented individual with specifically:thorough knowledge of Linux and

Re: shuffling elements of a list

2006-06-01 Thread Gerard Flanagan
Ben Finney wrote: [snip] Please don't write C in Python. The 'for' statement allows iteration directly over a sequence, no need to maintain an index. Also, the modulus operator is called for with your cycling of the pile index. pile_index = 0 for card in deck:

Best way to do data source abstraction

2006-06-01 Thread Arthur Pemberton
What is the best way to do data source abtraction? For example have different classes with the same interface, but different implementations. I was thinking of almost having classA as my main class, and have classA dynamically absorb classFood into to based on the extension of the input file

Re: shuffling elements of a list

2006-06-01 Thread Ben Finney
Gerard Flanagan [EMAIL PROTECTED] writes: Ben Finney wrote: pile_index = 0 for card in deck: piles[pile_index].append(card) pile_index = (pile_index + 1) % numpiles no need to maintain an index ;-) piles = [ list() for _ in range(n)

Re: shuffling elements of a list

2006-06-01 Thread Peter Otten
Gerard Flanagan wrote: Ben Finney wrote: pile_index = 0 for card in deck: piles[pile_index].append(card) pile_index = (pile_index + 1) % numpiles no need to maintain an index ;-) piles = [ list() for _ in range(n) ] for i, card

Re: os.popen3() - how to close cmd window automatically?

2006-06-01 Thread Nico Grubert
replace console=[... by windows=[... in your setup.py Works perfect. Thank you, Rony! -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes pointers and SendMessage

2006-06-01 Thread Michele Petrazzo
Metalone wrote: I would like to call windll.user32.SendMessageA(hwnd, win32con.WM_COMMAND, wParam, lParam) where lParam represents a pointer to an object. and the others? And also convert this pointer back to an object reference inside of wnd_proc def wnd_proc(hwnd, msg, wParam,

Re: Best way to do data source abstraction

2006-06-01 Thread Sybren Stuvel
Arthur Pemberton enlightened us with: What is the best way to do data source abtraction? That depends on your data source. For files, file-like objects are an abstraction. For databases there is PEP 249. I was thinking of almost having classA as my main class, and have classA dynamically

Re: Best Python Editor

2006-06-01 Thread [EMAIL PROTECTED]
If we could go back to emacs again for a second... I'm still using emacs but have been playing with a few other ide's (wing, komodo + pydev) are the ones i've given a go recently. However I still end up coming back to emacs for what I consider to be emacs mode's piece of 'killer functionality',

Re: Best Python Editor

2006-06-01 Thread [EMAIL PROTECTED]
Can anyone tell me a good python editor/IDE? It would be great if you can provide the download link also. WingIDE is very good. It gives very nice completions and has a nice thing called source assistant that shows the help of the function you're standing on and etc. But I don't think it's

RE: Is device Connected Windows?

2006-06-01 Thread Tim Golden
[placid] | Just wondering is there a way (not brute force) to check if a usb | storage device is connected? Hmmm. How do you identify a usb storage device to know that it is or isn't connected? You can certainly do something useful with wmi. eg, code import wmi c = wmi.WMI () for usb_disk in

How do you practice Python?

2006-06-01 Thread Ray
In our field, we don't always get to program in the language we'd like to program. So... how do you practice Python in this case? Say you're doing J2EE right now. How do you practice Python to keep your skills sharp? I liked Python Challenge, but there were too many PIL there, something that I

How do you practice programming?

2006-06-01 Thread Ray
OK, maybe I shoot a more general question to the group since there are so many great programmers here: how do you practice your craft? I do it in the following way: 1. Set aside 30 minutes to 1 hour a day to read up on the latest development, be it about the tool I'm using, the language, or the

losing handles of open files

2006-06-01 Thread Anthra Norell
Hi If a piece of code exits with an exception before it closes an open file, that file seems to remain locked, which is real pain in the butt if Idevelop a file in parallel with a piece of code.Is there a way to close such lost files short of starting a new session? Frederic --

Re: How do you practice Python?

2006-06-01 Thread bruno at modulix
Ray wrote: In our field, we don't always get to program in the language we'd like to program. So... how do you practice Python in this case? Say you're doing J2EE right now. Hopefully not ! How do you practice Python to keep your skills sharp? How *would* I do ? Well, perhaps I'd use

Re: How do you practice Python?

2006-06-01 Thread Ray
bruno at modulix wrote: In our field, we don't always get to program in the language we'd like to program. So... how do you practice Python in this case? Say you're doing J2EE right now. Hopefully not ! I am :-( How do you practice Python to keep your skills sharp? How *would* I do

Re: How do you practice programming?

2006-06-01 Thread bruno at modulix
Ray wrote: OK, maybe I shoot a more general question to the group since there are so many great programmers here: how do you practice your craft? I'm certainly not one of them, but... (snip) How do you do your practice? 1/ programming 2/ programming 3/ lurking here, reading posts and

Re: How do you practice programming?

2006-06-01 Thread Ray
bruno at modulix wrote: 1/ programming 2/ programming 3/ lurking here, reading posts and sometimes trying to answer, reading source code of the oss apps/frameworks I'm working with, searching practical solutions in the cookbook etc 4/ programming Yeah, but that's what most of us are doing

Re: Best way to do data source abstraction

2006-06-01 Thread bruno at modulix
Arthur Pemberton wrote: What is the best way to do data source abtraction? For example have different classes with the same interface, but different implementations. I was thinking of almost having classA as my main class, and have classA dynamically absorb classFood into to based on the

Re: Best Python Editor

2006-06-01 Thread dwelch91
Maric Michaud wrote: Le Mercredi 31 Mai 2006 12:03, Manoj Kumar P a écrit : Hi, Can anyone tell me a good python editor/IDE? It would be great if you can provide the download link also. I didn't see on this list much PyQT users, is there a consensus about it ? I vote for linux+kdevelop

what is the reasonable (best?) Exception handling strategy?

2006-06-01 Thread Petr Jakes
I am a little bit confused by all possibilities for exceptions handling in Python (probably because I am not skilled enough??) I did try to search trough this list and reading Python tutorial about Errors and Exceptions but didn't find some general answer about exception handling policy

Re: shuffling elements of a list

2006-06-01 Thread David C.Ullrich
On Wed, 31 May 2006 23:05:14 +0200, Fredrik Lundh [EMAIL PROTECTED] wrote: Roger Miller wrote: DSU seems like a lot of trouble to go through in order to use an O(n log n) sorting algorithm to do what can be done in O(N) with a few lines of code. The core code of random.shuffle() shows how

Re: Best Python Editor

2006-06-01 Thread Rony Steelandt
I have to admit that I'm testing eclipse with pydev at the moment, and it looks realy good Rony Hi, Can anyone tell me a good python editor/IDE? It would be great if you can provide the download link also. Thank You, -Manoj- SASKEN RATED Among THE Top 3 BEST COMPANIES TO WORK FOR IN

Re: shuffling elements of a list

2006-06-01 Thread Erik Max Francis
David C. Ullrich wrote: Good example, because we know that EMF is not dumb. I've seen the same algorithm many times - the best example is ... Man, an error made _six years ago_ and people are still bringing it up ... -- Erik Max Francis [EMAIL PROTECTED] http://www.alcyone.com/max/ San

Re: TSV to HTML

2006-06-01 Thread Brian
Dennis, Thank you for that response. Your code was very helpful to me. I think that actually seeing how it should be done in Python was a lot more educational than spending hours with trial and error. One question (and this is a topic that I still have trouble getting my arms around). Why is

Re: shuffling elements of a list

2006-06-01 Thread Gerard Flanagan
Peter Otten wrote: Gerard Flanagan wrote: Ben Finney wrote: pile_index = 0 for card in deck: piles[pile_index].append(card) pile_index = (pile_index + 1) % numpiles no need to maintain an index ;-) piles = [ list() for _ in

Re: what is the reasonable (best?) Exception handling strategy?

2006-06-01 Thread Duncan Booth
Petr Jakes wrote: I am a little bit confused by all possibilities for exceptions handling in Python (probably because I am not skilled enough??) I did try to search trough this list and reading Python tutorial about Errors and Exceptions but didn't find some general answer about exception

Re: Best Python Editor

2006-06-01 Thread Fabio Zadrozny
On 1 Jun 2006 01:14:28 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:If we could go back to emacs again for a second...I'm still using emacs but have been playing with a few other ide's (wing, komodo + pydev) are the ones i've given a go recently.However I still end up coming back to emacs for

Re: Watching serial port activity.

2006-06-01 Thread Sergei Organov
Grant Edwards [EMAIL PROTECTED] writes: On 2006-05-31, Sergei Organov [EMAIL PROTECTED] wrote: It seems that sniff on a real tty device could be implemented using the same technique strace uses to intercept and show syscalls, though I'm not aware of any sniffer application that does it.

Function mistaken for a method

2006-06-01 Thread Eric Brunel
Hi all, I just stepped on a thing that I can't explain. Here is some code showing the problem: - class C: f = None def __init__(self): if self.f is not None: self.x = self.f(0) else: self.x = 0 class C1(C): f = int class C2(C):

Re: Function mistaken for a method

2006-06-01 Thread Maric Michaud
Le Jeudi 01 Juin 2006 13:12, Eric Brunel a écrit : class C1(C): f = int int is not a function but a type, but it's callable so int(0) return 0. class C2(C): f = lambda x: x != 0 lambda is a function, applied as a class attribute it becomes a method so it's called with a first

Re: Function mistaken for a method

2006-06-01 Thread Maric Michaud
Le Jeudi 01 Juin 2006 13:29, Maric Michaud a écrit : this exactly the same as :    def f(self, val) :        return x != 0 oops, def f(self, val) : return val != 0 -- _ Maric Michaud _ Aristote - www.aristote.info 3 place des tapis 69004 Lyon Tel: +33

Re: Function mistaken for a method

2006-06-01 Thread Peter Otten
Eric Brunel wrote: My actual question is: why does it work in one case and not in the other? As I see it, int is just a function with one parameter, and the lambda is just another one. So why does the first work, and not the second? What 'black magic' takes place so that int is not mistaken

Re: Function mistaken for a method

2006-06-01 Thread Maric Michaud
Le Jeudi 01 Juin 2006 13:34, Peter Otten a écrit : A python-coded function has a __get__ attribute, a C-function doesn't. Therefore C1.f performs just the normal attribute lookup while C2.f also triggers the f.__get__(C2(), C2) call via the descriptor protocol which happens to return a bound

Re: How do you practice Python?

2006-06-01 Thread bruno at modulix
Ray wrote: bruno at modulix wrote: In our field, we don't always get to program in the language we'd like to program. So... how do you practice Python in this case? Say you're doing J2EE right now. Hopefully not ! I am :-( Can we do something to help you out of this bad situation ?

Re: struct: type registration?

2006-06-01 Thread Giovanni Bajo
John Machin wrote: given the ongoing work on struct (which I thought was a dead module), I was wondering if it would be possible to add an API to register custom parsing codes for struct. Whenever I use it for non-trivial tasks, I always happen to write small wrapper functions to adjust the

Re: Function mistaken for a method

2006-06-01 Thread Peter Otten
Maric Michaud wrote: Le Jeudi 01 Juin 2006 13:34, Peter Otten a écrit : A python-coded function has a __get__ attribute, a C-function doesn't. Therefore C1.f performs just the normal attribute lookup while C2.f also triggers the f.__get__(C2(), C2) call via the descriptor protocol which

Re: How do you practice programming?

2006-06-01 Thread bruno at modulix
Ray wrote: bruno at modulix wrote: 1/ programming 2/ programming 3/ lurking here, reading posts and sometimes trying to answer, reading source code of the oss apps/frameworks I'm working with, searching practical solutions in the cookbook etc 4/ programming Yeah, but that's what most of us

Re: Function mistaken for a method

2006-06-01 Thread John Machin
On 1/06/2006 9:46 PM, Maric Michaud wrote: Le Jeudi 01 Juin 2006 13:34, Peter Otten a écrit : A python-coded function has a __get__ attribute, a C-function doesn't. Therefore C1.f performs just the normal attribute lookup while C2.f also triggers the f.__get__(C2(), C2) call via the descriptor

py2exe qt4/qimage

2006-06-01 Thread aljosa
i'm trying to convert python (image resizer script using PyQt4) script to exe but support for jpeg and tiff image formats is located in Qt4.1\plugins\imageformats (dll files) and when script is converted exe file doesn't support jpeg and tiff. i tryed using all file formats in script: tmp1 =

Re: creating a new database with mysqldb

2006-06-01 Thread Frithiof Andreas Jensen
John Salerno [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Since the connect method of mysqldb requires a database name, it seems like you can't use it without having a database already created. The web hotel I use create *one* database together with the account. I.O.W: I cannot

DB-API: how can I find the column names in a cursor?

2006-06-01 Thread A.M
Hi I use a code similar to this to retrieve data from Oracle database: import cx_Oracle con = cx_Oracle.connect(me/[EMAIL PROTECTED]) cur = con.cursor() outcur = con.cursor() cur.execute( BEGIN MyPkg.MyProc(:cur); END;, cur=outcur) for row in out_cur:

Re: Best Python Editor

2006-06-01 Thread vadim . feelsgood
I use WingIDE too. It is very convenient. Good auto-completion feature. It is not so heavy as Komodo. WingIDE was my the second step after Komodo. Just try it and u'll understand how it is good. [EMAIL PROTECTED] wrote: Can anyone tell me a good python editor/IDE? It would be great if you can

Re: Function mistaken for a method

2006-06-01 Thread bruno at modulix
Peter Otten wrote: Eric Brunel wrote: My actual question is: why does it work in one case and not in the other? As I see it, int is just a function with one parameter, and the lambda is just another one. So why does the first work, and not the second? What 'black magic' takes place so that

Tkinter - changing existing Dialog?

2006-06-01 Thread Michael Yanowitz
Hello: I have a Tkinter GUI Dialog with many buttons and labels and text widgets. What I would like to do is, can I: 1) Disable/deactivate/hide a button, text widget that is already drawn (and of course the opposite enable/activate/show it)? 2) Change the text of a label or button that

PythonDoc Ant Task

2006-06-01 Thread abcd
Anyone ever use the PythonDoc ant task? I have the following... path id=myPyPath pathelement location=src/ pathelement location=resources/ /path target name=pyDoc mkdir dir=docs/ py-doc pythonpathref=myPyPath destdir=docs fileset dir=src include name=**/*.py/ /fileset

Re: Function mistaken for a method

2006-06-01 Thread Eric Brunel
On Thu, 01 Jun 2006 13:34:53 +0200, Peter Otten [EMAIL PROTECTED] wrote: Eric Brunel wrote: My actual question is: why does it work in one case and not in the other? As I see it, int is just a function with one parameter, and the lambda is just another one. So why does the first work,

Re: struct: type registration?

2006-06-01 Thread Giovanni Bajo
Giovanni Bajo wrote: You need struct.unpack() to parse these datas, and you need custom packer/unpacker to avoid post-processing the output of unpack() just because it just knows of basic Python types. In binary structs, there happen to be *types* which do not map 1:1 to Python types, nor

Re: struct: type registration?

2006-06-01 Thread John Machin
On 1/06/2006 9:52 PM, Giovanni Bajo wrote: John Machin wrote: given the ongoing work on struct (which I thought was a dead module), I was wondering if it would be possible to add an API to register custom parsing codes for struct. Whenever I use it for non-trivial tasks, I always happen to

Re: Function mistaken for a method

2006-06-01 Thread Maric Michaud
Le Jeudi 01 Juin 2006 13:12, Eric Brunel a écrit : Thanks for your explanations, Peter. I'll have to find another way to do   what I want... maybe : class C:    f = None    def __init__(self):      if self.f is not None:        self.x = self.f(0)      else:        self.x = 0 class

Re: Tkinter - changing existing Dialog?

2006-06-01 Thread John Machin
Michael Yanowitz wrote: Hello: I have a Tkinter GUI Dialog with many buttons and labels and text widgets. So start a *new* thread. -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to get FreeImagePy to work.

2006-06-01 Thread Iain King
Michele Petrazzo wrote: Iain King wrote: Michele Petrazzo wrote: I downloaded and installed 0.9.9.3, and it now works. Thanks! I advice you to don't use that ctypes version... Better is to use the newest one and update freeimagepy! Iain Michele OK, Ive installed the latest

Re: what is the reasonable (best?) Exception handling strategy?

2006-06-01 Thread Rene Pijlman
Petr Jakes: What about unexpected exceptions? :( I asked a similar question some time ago: http://groups.google.nl/group/comp.lang.python/browse_thread/thread/25963b99da4b2653 -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Function mistaken for a method

2006-06-01 Thread Peter Otten
Eric Brunel wrote: On Thu, 01 Jun 2006 13:34:53 +0200, Peter Otten [EMAIL PROTECTED] wrote: Eric Brunel wrote: My actual question is: why does it work in one case and not in the other? As I see it, int is just a function with one parameter, and the lambda is just another one. So why

Re: DB-API: how can I find the column names in a cursor?

2006-06-01 Thread Fredrik Lundh
A.M wrote: The problem is I don't know how to find out what are the column name and type that comes out of query (each row in cursor). Is there any possibility that my Python code can find out the column name and type in each row in cursor? From cursor objects in the DB-API

Re: Function mistaken for a method

2006-06-01 Thread bruno at modulix
Eric Brunel wrote: Hi all, I just stepped on a thing that I can't explain. Here is some code showing the problem: - class C: Do yourself a favour : use new-style classes. class C(object) f = None def __init__(self): if self.f is not None:

Re: PythonDoc Ant Task

2006-06-01 Thread abcd
i found that the problem is because of an import, which is strange. The imported module looks something like this [code] import time class Foo: pass class Bar: global javax.swing import javax.swing [/code] so it seems that pydoc cant giggity-giggit! --

Re: How do you practice Python?

2006-06-01 Thread Harry George
Ray [EMAIL PROTECTED] writes: bruno at modulix wrote: In our field, we don't always get to program in the language we'd like to program. So... how do you practice Python in this case? Say you're doing J2EE right now. Hopefully not ! I am :-( How do you practice Python to

Re: DB-API: how can I find the column names in a cursor?

2006-06-01 Thread A.M
Thank you Fredrik for help. Would you be able to help with the second part of question: The other problem is accessing data in each row by column name. In Ruby I can say: Print row[ColName] In Python; however, I must access to row contents by integer index, like PRINT ROW[0], which reduces my

Re: Function mistaken for a method

2006-06-01 Thread Christophe
Eric Brunel a écrit : On Thu, 01 Jun 2006 13:34:53 +0200, Peter Otten [EMAIL PROTECTED] wrote: Eric Brunel wrote: My actual question is: why does it work in one case and not in the other? As I see it, int is just a function with one parameter, and the lambda is just another one. So

Re: PythonDoc Ant Task

2006-06-01 Thread Fredrik Lundh
abcd wrote: class Bar: global javax.swing import javax.swing [/code] so it seems that pydoc cant giggity-giggit! global javax.swing is not valid Python syntax. what is that global/import combo supposed to do, and what environment do you run this under ? /F --

default argument values qns

2006-06-01 Thread micklee74
hi i have declared a function like this: def aFunction ( arg1 , arg2 = 0): print type(arg2) when i try to print the type of arg2, it gives me 'str' type..why is it not integer type, since i have declared it as 0 ?? thanks --

Re: default argument values qns

2006-06-01 Thread Tim Chase
i have declared a function like this: def aFunction ( arg1 , arg2 = 0): print type(arg2) when i try to print the type of arg2, it gives me 'str' type..why is it not integer type, since i have declared it as 0 ?? def a(arg1, arg2=0): ... print type(arg2)

Re: default argument values qns

2006-06-01 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: i have declared a function like this: def aFunction ( arg1 , arg2 = 0): print type(arg2) when i try to print the type of arg2, it gives me 'str' type..why is it not integer type, since i have declared it as 0 ?? because you or someone else is

Re: default argument values qns

2006-06-01 Thread Alexandre Fayolle
Le 01-06-2006, [EMAIL PROTECTED] [EMAIL PROTECTED] nous disait: hi i have declared a function like this: def aFunction ( arg1 , arg2 = 0): print type(arg2) when i try to print the type of arg2, it gives me 'str' type..why is it not integer type, since i have

Re: Function mistaken for a method

2006-06-01 Thread Maric Michaud
Le Jeudi 01 Juin 2006 15:36, Christophe a écrit :        self.x = self.__class__.f(0) nope, this will result in a TypeError unbound method must be called with instance as first argument -- _ Maric Michaud _ Aristote - www.aristote.info 3 place des tapis 69004 Lyon Tel:

Re: DB-API: how can I find the column names in a cursor?

2006-06-01 Thread Luis M. González
I don't know if it works this way with Oracle, but the python dbpai has the cursor.description method that can help. For example: cur.execute( your query here ) columns = [i[0] for i in cur.description] cur.description gives a lot of data about your recordset, and the first field is the column

Re: Best way to do data source abstraction

2006-06-01 Thread Larry Bates
Arthur Pemberton wrote: What is the best way to do data source abtraction? For example have different classes with the same interface, but different implementations. I was thinking of almost having classA as my main class, and have classA dynamically absorb classFood into to based on the

Re: DB-API: how can I find the column names in a cursor?

2006-06-01 Thread Daniel Dittmar
A.M wrote: for row in out_cur: print row [...] The other problem is accessing data in each row by column name. One useful technique is for col1, col2, col3 in out_cur: sum = sum + col3 Access is still by index, but your code uses ordinary Python variables. It works better

Re: creating a new database with mysqldb

2006-06-01 Thread John Salerno
Frithiof Andreas Jensen wrote: John Salerno [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Since the connect method of mysqldb requires a database name, it seems like you can't use it without having a database already created. The web hotel I use create *one* database together

argmax

2006-06-01 Thread David Isaac
1. Why is there no argmax built-in? (This would return the index of the largest element in a sequence.) 2. Is this a good argmax (as long as I know the iterable is finite)? def argmax(iterable): return max(izip( iterable, count() ))[1] 3. If this is the only place in a module where I need count

Re: shuffling elements of a list

2006-06-01 Thread Alex Martelli
Peter Otten [EMAIL PROTECTED] wrote: Gerard Flanagan wrote: Ben Finney wrote: pile_index = 0 for card in deck: piles[pile_index].append(card) pile_index = (pile_index + 1) % numpiles no need to maintain an index ;-) piles = [

Re: Trying to get FreeImagePy to work.

2006-06-01 Thread Michele Petrazzo
Iain King wrote: Michele Petrazzo wrote: Iain King wrote: Michele Petrazzo wrote: I downloaded and installed 0.9.9.3, and it now works. Thanks! I advice you to don't use that ctypes version... Better is to use the newest one and update freeimagepy! Iain Michele OK, Ive

Starting New Process

2006-06-01 Thread D
Hello, I need to write a server program that performs the following tasks: 1) Listens on TCP port for a connection 2) When client connects, launches application (for example, vi), then closes connection with client 3) Goes back to listening on TCP port for an incoming connection The

image lib Qt4

2006-06-01 Thread aljosa
i'm looking for image lib which supports common image types (maybe freeimagepy?) and is relatively easy to display image loaded through that lib in PyQt4. any ideas? Aljosa -- http://mail.python.org/mailman/listinfo/python-list

New to Python: Do we have the concept of Hash in Python?

2006-06-01 Thread A.M
Hi, I am new to Python, with C#/Java background Is there any built-in Hash implementation in Python? I am looking for a container that I can access to it's items by name. Something like this: Print container[memeberName] I am asking this because I learned that DB-API in Python

os.walk trouble

2006-06-01 Thread The Prophet
As my first Python script, I am trying to make a program that recurses a directory searching for files whose names match a pattern. I have a basic idea of what the regexp would look like (and I can get more information about that), but I am stuck with incorrect understanding of os.walk. I've

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-01 Thread infidel
Is there any built-in Hash implementation in Python? I am looking for a container that I can access to it's items by name. Something like this: Print container[memeberName] You obviously haven't read the tutorial, they're called dictionaries in Python I am asking this because I learned that

An oddity in list comparison and element assignment

2006-06-01 Thread michael . f . ellis
The following script puzzles me. It creates two nested lists that compare identically. After identical element assignments, the lists are different. In one case, a single element is replaced. In the other, an entire column is replaced.

how to create a cgi folder???

2006-06-01 Thread elekis
hi there I have a host who suport python cgi script (www.frihost.com that's cool) and discovert python (and mysql) I would like to make my own site on python . But I woulud like to try before on my own machine (localhost.) So I would like to know how to create a CGI folder ??? I installed apache

Re: Starting New Process

2006-06-01 Thread Jean-Paul Calderone
On 1 Jun 2006 07:34:23 -0700, D [EMAIL PROTECTED] wrote: Hello, I need to write a server program that performs the following tasks: 1) Listens on TCP port for a connection 2) When client connects, launches application (for example, vi), then closes connection with client 3) Goes back to

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-01 Thread Brian Quinlan
A.M wrote: Is there any built-in Hash implementation in Python? I am looking for a container that I can access to it's items by name. Something like this: Print container[memeberName] d = {memberName : some value} print d[memberName] I am asking this because I learned that DB-API in

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Alex Martelli
[EMAIL PROTECTED] wrote: ... operations. I think what must be going on is that the 'b' list contains replicated references instead of copies of [range(1,3)]*2 . Right. IMO, python's == operator should detect this difference in list structure since it leads to different behavior under

Re: Trying to get FreeImagePy to work.

2006-06-01 Thread Iain King
Michele Petrazzo wrote: Iain King wrote: Michele Petrazzo wrote: Iain King wrote: Michele Petrazzo wrote: I downloaded and installed 0.9.9.3, and it now works. Thanks! I advice you to don't use that ctypes version... Better is to use the newest one and update freeimagepy!

Re: os.walk trouble

2006-06-01 Thread Tim Chase
but I am stuck with incorrect understanding of os.walk. I've tried: root, dirs, files = os.walk(dirname) os.walk returns an iteratable sequence of those tuples. Thus, you want to have for filepath, dirs, files in os.walk(dirname): #you're looking at the dirs and files in filepath

Re: DB-API: how can I find the column names in a cursor?

2006-06-01 Thread Sion Arrowsmith
A.M [EMAIL PROTECTED] wrote: The other problem is accessing data in each row by column name. In Ruby I can say: Print row[ColName] In Python; however, I must access to row contents by integer index, like PRINT ROW[0], which reduces my program's readability. Can I access to row's contents by

Re: argmax

2006-06-01 Thread Duncan Booth
David Isaac wrote: 1. Why is there no argmax built-in? (This would return the index of the largest element in a sequence.) Probably there isn't a built-in because it isn't a commonly needed function. What is your use-case for argmax? If for example you want to repeatedly remove the largest

Re: argmax

2006-06-01 Thread Max Erickson
David Isaac [EMAIL PROTECTED] wrote: 1. Why is there no argmax built-in? (This would return the index of the largest element in a sequence.) 2. Is this a good argmax (as long as I know the iterable is finite)? def argmax(iterable): return max(izip( iterable, count() ))[1] use len:

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-01 Thread Jeffrey Froman
A.M wrote: I am asking this because I learned that DB-API in Python doesn't offer access to cursor columns by name. The only option is access by index. I hope that I've got it wrong! While it's not part of the DB-API as far as I know, the MySQLdb package (and perhaps other DB access modules

Re: argmax

2006-06-01 Thread George Sakkis
David Isaac wrote: 1. Why is there no argmax built-in? (This would return the index of the largest element in a sequence.) I guess because it's not used frequently enough. I've needed argmax/argmin more than once though, so I would welcome them as builtins. 2. Is this a good argmax (as long

Re: argmax

2006-06-01 Thread Alexandre Fayolle
Le 01-06-2006, David [EMAIL PROTECTED] nous disait: 1. Why is there no argmax built-in? (This would return the index of the largest element in a sequence.) You'll get argmin and argmax in Numeric and its descendants (numarray and numpy). -- Alexandre Fayolle

Re: Function mistaken for a method

2006-06-01 Thread Eric Brunel
On Thu, 01 Jun 2006 15:07:26 +0200, bruno at modulix [EMAIL PROTECTED] wrote: Do yourself a favour : use new-style classes. class C(object) I would if I could: I'm stuck with Python 2.1 for the moment (I should have mentionned it; sorry for that). [snip] Basically, I want an optional

Re: An oddity in list comparison and element assignment

2006-06-01 Thread michael . f . ellis
Hi Alex, With all due respect to your well-deserved standing in the Python community, I'm not convinced that equality shouldn't imply invariance under identical operations. Perhaps the most fundamental notion is mathematics is that the left and right sides of an equation remain identical after

Re: image lib Qt4

2006-06-01 Thread Diez B. Roggisch
aljosa wrote: i'm looking for image lib which supports common image types (maybe freeimagepy?) and is relatively easy to display image loaded through that lib in PyQt4. any ideas? Use PIL StringIO to create a in-memory representation of the image as e.g. PNG. Load that using Qt. Diez --

Re: argmax

2006-06-01 Thread Peter Otten
David Isaac wrote: 2. Is this a good argmax (as long as I know the iterable is finite)? def argmax(iterable): return max(izip( iterable, count() ))[1] There's a subtle difference to the builtin: argmax() gives you the (index of the) last maximum while max() returns the (value of the) first

Tkinter: select multiple entries in Listbox widget?

2006-06-01 Thread Bernard Lebel
Hello, Is there an option or a way to allow the selection of multiple entries in the Listbox widget? I could not find any, and would like to allow the end user to select multiple entries. Thanks Bernard -- http://mail.python.org/mailman/listinfo/python-list

Re: An oddity in list comparison and element assignment

2006-06-01 Thread michael . f . ellis
oops! last sentence of 2nd paragraph in previous message should read If my expectation is NOT met ... -- http://mail.python.org/mailman/listinfo/python-list

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-01 Thread Fredrik Lundh
A.M wrote: I am new to Python, with C#/Java background that's not really much of an excuse for not reading *any* Python tutorial before you jump in... I am asking this because I learned that DB-API in Python doesn't offer access to cursor columns by name. The only option is access by

Zope / Plone Groups

2006-06-01 Thread d . schulz81
Hi, are there any specific groups for zope / plone regarding questions? my question is: How is it possible to use Zope 3 Products with Plone, which is an extension based on Zope 2? Thank you Dennis -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   >