First Public Release of ANUGA - Hydrodynamic Modelling.

2006-12-28 Thread Ole Nielsen
I am pleased to announce the first release of ANUGA which is a implements a computational model for simulation of shallow water flows. ANUGA is available at https://sourceforge.net/projects/anuga/. The user manual can also be viewed direcly at

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-28 Thread Amaury Forgeot d'Arc
Hello, Pyenos a écrit : Thanks for clarifying the definitions of nested class and subclass. However, it did not solve my original problem, and I have redefined my question: class Class1: class Class2: class Class3: def __init__(self): self.var=var

Re: Feasible in Python ? list of object , with two exeptional objects

2006-12-28 Thread Osiris
On Wed, 27 Dec 2006 23:27:08 +0100, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: In [EMAIL PROTECTED], Osiris wrote: I have an array (I come from C) of identical objects, called sections. These sections have some feature, say a length, measured in mm, which is calculated by a method

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-28 Thread Gabriel Genellina
At Thursday 28/12/2006 01:31, Pyenos wrote: class Class3: def method():print Class1.Class2.variable #problem In all your examples, you wrote def method() instead of def method(self). Error messages are usually meaningful, they give you valuable

Re: DOS, UNIX and tabs

2006-12-28 Thread Sebastian 'lunar' Wiesner
Erik Johnson ej at somewhere.com typed Ben Finney [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sebastian 'lunar' Wiesner [EMAIL PROTECTED] writes: Just a tip for you: In python you never use tabs for indentation. For some value of you. The python style guide [1]

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-28 Thread Gabriel Genellina
At Thursday 28/12/2006 01:39, Pyenos wrote: class Class1: class Class2(Class1): variable=variable class Class3(Class2): print Class1().Class2().variable #problem Also, why is this wrong? Again, don't write just problem! What do

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-28 Thread Gabriel Genellina
At Thursday 28/12/2006 03:18, Pyenos wrote: class Class1: class Class2: class Class3: def __init__(self): self.var=var class Class4: print Class1.Class2.Class3.var This code gives me the error: Traceback (most recent call

Re: BeautifulSoup bug when found in attribute value

2006-12-28 Thread Anne van Kesteren
Duncan Booth schreef: The / was in the original input that you gave it: param name=movie value=/images/offersBanners/sw04.swf?binfot=We offer fantastic rates for selected weeks or days!!blinkt=Click here linkurl=/Europe/Spain/Madrid/Apartments/Offer/2408 / You don't actually *have* to

Re: Feasible in Python ? list of object , with two exeptional objects

2006-12-28 Thread Osiris
On Wed, 27 Dec 2006 16:29:29 -0600, Paul McGuire [EMAIL PROTECTED] wrote: Osiris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is the following intuitively feasible in Python: I have an array (I come from C) of identical objects, called sections. These sections have some feature,

Python Wrapper for C# Com Object

2006-12-28 Thread bg_ie
Hi, I wish to write a Python wrapper for my C# COM object but am unsure where to start. I have a dll and a tlb file, and I can use this object in C via the following code - // ConsolApp.cpp : Defines the entry point for the console application. // #include stdafx.h #include windows.h #include

problems with socket

2006-12-28 Thread Flávio Ribeiro
Hi all, I will try to explain my problem, and wait for someone here give me solutions: (sorry for the bad, bad english) I have a server application that talks with another client applications using socket. The problem isnt this, i did and works very well. The problem is open the router

Unexpected output while walking dirs

2006-12-28 Thread Evan Carmi
hi, i am creating a program to go through a directory structure recursively (including directories below it) and move all files that end in .msf to a directory above the current level. the code i have so far is as follows: code #!/usr/bin/python #Author: Evan Carmi #Date: 20061101 #Purpose: To

Re: DOS, UNIX and tabs

2006-12-28 Thread Steven D'Aprano
On Thu, 28 Dec 2006 09:26:28 +0100, Sebastian 'lunar' Wiesner wrote: It is, and especially the problems with tabs shows you, why it is good practice to follow the standard in your own code, too... I don't know what problems with tabs you are talking about. I never have problems with tabs.

Re: BeautifulSoup bug when found in attribute value

2006-12-28 Thread Duncan Booth
Anne van Kesteren [EMAIL PROTECTED] wrote: Mind you, the sentence before that says 'should' for quoting characters which is just plain silly. For quoted attribute values it isn't silly at all. It's actually part of how HTML works. Yes, but the sentence I was complaining about isn't

Re: Feasible in Python ? list of object , with two exeptional objects

2006-12-28 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Osiris wrote: Would I put all the stuff that is the same in both classes in the base class and only the differing stuff in the subclasses ? Yes that's the intent of base/sub class relationships. Baseclasses contain the behavior common to all their subclasses and

Re: can't instantiate following inner class

2006-12-28 Thread Gian Mario Tagliaretti
Gabriel Genellina wrote: class One(object): pass ... a = One(1,2) Traceback (most recent call last): File stdin, line 1, in ? TypeError: default __new__ takes no parameters How do you make Python silently ignore the arguments? sorry, my bad, that beauvoir was python 2.2 it was

Re: DOS, UNIX and tabs

2006-12-28 Thread Christophe Cavalaria
Steven D'Aprano wrote: On Thu, 28 Dec 2006 09:26:28 +0100, Sebastian 'lunar' Wiesner wrote: It is, and especially the problems with tabs shows you, why it is good practice to follow the standard in your own code, too... I don't know what problems with tabs you are talking about. I never

Scaling pictures

2006-12-28 Thread Kajsa Anka
I would like some advice, I'm going to build a small app that will, among other things, scale images so that they can be published on a web site. I've never done any image processing in python before so I would like to ask what is the best way of doing this, I will not do anything else than

answers.py v0.0.1 - source

2006-12-28 Thread Pyenos
#!/usr/bin/python # answers.py --- A simple answer bot # Copyright (C) 2006 Logan Lee # # MESSAGE: # # This program is a simple text-console program #+that asks for a problem and its solution then #+persists the problem-solution dictionary to

Re: DOS, UNIX and tabs

2006-12-28 Thread Sebastian 'lunar' Wiesner
Steven D'Aprano [EMAIL PROTECTED] typed On Thu, 28 Dec 2006 09:26:28 +0100, Sebastian 'lunar' Wiesner wrote: It is, and especially the problems with tabs shows you, why it is good practice to follow the standard in your own code, too... I don't know what problems with tabs you are talking

Re: Combining C and Python

2006-12-28 Thread Osiris
On Thu, 28 Dec 2006 08:48:53 +0100, Osiris [EMAIL PROTECTED] wrote: On Wed, 27 Dec 2006 16:12:02 +0100, Osiris [EMAIL PROTECTED] wrote: I found this text about combining C-code with Pyton scripting on the P2P networks in PDF: Python Scripting for Computational Science Hans Petter Langtangen

Re: Feasible in Python ? list of object , with two exeptional objects

2006-12-28 Thread Osiris
On Thu, 28 Dec 2006 11:14:27 +0100, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: In [EMAIL PROTECTED], Osiris wrote: Would I put all the stuff that is the same in both classes in the base class and only the differing stuff in the subclasses ? Yes that's the intent of base/sub class

Re: DOS, UNIX and tabs

2006-12-28 Thread Felix Benner
Sebastian 'lunar' Wiesner schrieb: Ben [EMAIL PROTECTED] typed I have a python script on a windows system that runs fine. Both use tabs to indent sections of the code. Just a tip for you: In python you never use tabs for indentation. The python style guide [1] recommends four spaces per

Re: DOS, UNIX and tabs

2006-12-28 Thread Felix Benner
Christophe Cavalaria schrieb: Steven D'Aprano wrote: You gave the reason in your post : because other people who are using software that doesn't understand tabs as YOU expect them to have problems with your code. Tabs aren't a problem at all as long as nobody else than you edit your code.

Re: Scaling pictures

2006-12-28 Thread buffi
Kajsa Anka wrote: I would like some advice, I'm going to build a small app that will, among other things, scale images so that they can be published on a web site. I've never done any image processing in python before so I would like to ask what is the best way of doing this, I will not do

Re: DOS, UNIX and tabs

2006-12-28 Thread Christophe Cavalaria
Felix Benner wrote: Christophe Cavalaria schrieb: Steven D'Aprano wrote: You gave the reason in your post : because other people who are using software that doesn't understand tabs as YOU expect them to have problems with your code. Tabs aren't a problem at all as long as nobody else

Re: answers.py v0.0.1 - source

2006-12-28 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Pyenos wrote: global ANSWER_PATH ``global`` at module level has no effect. That keyword is used to declare names in functions or methods global that would be local to the function otherwise and it's only needed if you want to *assign* to the global name from within a

Re: DOS, UNIX and tabs

2006-12-28 Thread Duncan Booth
Felix Benner [EMAIL PROTECTED] wrote: So what's the point in typing four spaces for indentation instead of one tab? So long as you always use only tabs there is no problem. So long as you only use spaces there is no problem. If you mix tabs and spaces you can introduce bugs. In particular,

Re: DOS, UNIX and tabs

2006-12-28 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Felix Benner wrote: I like using tabs. And the style guide doesn't give a reason why one shouldn't and neither does the thread http://www.python.org/search/hypermail/python-1994q2/0198.html in the archive. So what's the point in typing four spaces for indentation

Re: answers.py v0.0.1 - source

2006-12-28 Thread Peter Otten
Marc 'BlackJack' Rintsch wrote:  def __init__(self,answers={}):  self.answers=answers Default arguments are only evaluated once when the ``def`` is executed, so all your `Storage` classes share the same dictionary.  One idiom to solve this is: def __init__(self, 

Re: Scaling pictures

2006-12-28 Thread Ravi Teja
Kajsa Anka wrote: I would like some advice, I'm going to build a small app that will, among other things, scale images so that they can be published on a web site. I've never done any image processing in python before so I would like to ask what is the best way of doing this, I will not do

Re: Scaling pictures

2006-12-28 Thread bearophileHUGS
Kajsa Anka: I found the Python Imaging Library but before I dive into that I would like to know if there is a better way of doing this. PIL is very fit for that. Note that it creates thumbnails already by itself, you can use that for bigger images too. Bye, bearophile --

Re: Python Wrapper for C# Com Object

2006-12-28 Thread bg_ie
[EMAIL PROTECTED] skrev: Hi, I wish to write a Python wrapper for my C# COM object but am unsure where to start. I have a dll and a tlb file, and I can use this object in C via the following code - // ConsolApp.cpp : Defines the entry point for the console application. // #include

Re: answers.py v0.0.1 - source

2006-12-28 Thread bearophileHUGS
Marc 'BlackJack' Rintsch: You give lot of comments and I agree with most of them. One idiom to solve this is: def __init__(self, answers=None): self.answers = answers or dict() I suggest to avoid such usage of or/and (expecially for newbies), that is triky and can produce bugs,

Re: Unexpected output while walking dirs

2006-12-28 Thread [EMAIL PROTECTED]
On Dec 28, 10:25 am, Evan Carmi [EMAIL PROTECTED] wrote: hi, i am creating a program to go through a directory structure recursively (including directories below it) and move all files that end in .msf to a directory above the current level. the code i have so far is as follows: code

__getattr__ possible loop

2006-12-28 Thread bearophileHUGS
I have tried this, with Psyco it segfaults, and with Python 2.5 (on Win) hangs the interpreter, is it possible to improve the situation? class T(object): def __getattr__(self, x): dir(self) #import psyco #psyco.full() T().method() (Probably dir calls __getattr__). Bye, bearophile --

Generating text files (newbie)

2006-12-28 Thread Doran, Harold
Assume I have a tab-delimited text file called foo.txt organized as follows: x11 -0.04 x22 -0.42 x33 0.3 My goal is to read in this file and use the information therein to output a new file that is organized as follows: x11 IRM=3PL IPB= -0.04 x22 IRM=3PL IPB=

Re: persistant gloabl vars (very newbie) ?

2006-12-28 Thread Stef Mientki
Erik Johnson wrote: but it's still not quit handy # initialization file (init1.py) import time; xx = 44 # main file was print xx x=time.time() # main file should become print init1.xx x=init1.time.time() so even for the standard functions like time I've to include the preceeding

How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Stef Mientki
I want to return a simple variable from a function, not using the function result. Is that in any way possible ?? The code below is from O'Reilly, Learning Python, and there seems no way to return a simple var like z in the example below. Is that true ? thanks, Stef Mientki Python def

Re: DOS, UNIX and tabs

2006-12-28 Thread Grant Edwards
On 2006-12-28, Steven D'Aprano [EMAIL PROTECTED] wrote: I've spent a lot of time reading both sides of the tabs versus spaces argument, and I haven't found anything yet that explains why tabs are, in and of themselves, bad. They aren't. Using tabs isn't bad. Using both tabs and spaces is

Re: Fuzzy string comparison

2006-12-28 Thread jmw
Gabriel Genellina wrote: At Tuesday 26/12/2006 18:08, John Machin wrote: I'm looking for a module to do fuzzy comparison of strings. [...] Other alternatives: trigram, n-gram, Jaro's distance. There are some Python implem. available. Quick question, you mentioned the data you need to

Re: DOS, UNIX and tabs

2006-12-28 Thread Grant Edwards
On 2006-12-28, Felix Benner [EMAIL PROTECTED] wrote: I like using tabs. And the style guide doesn't give a reason why one shouldn't and neither does the thread http://www.python.org/search/hypermail/python-1994q2/0198.html in the archive. So what's the point in typing four spaces for

Re: __getattr__ possible loop

2006-12-28 Thread Maksim Kasimov
[EMAIL PROTECTED] wrote: I have tried this, with Psyco it segfaults, and with Python 2.5 (on Win) hangs the interpreter, is it possible to improve the situation? class T(object): def __getattr__(self, x): dir(self) #import psyco #psyco.full() T().method() (Probably dir calls

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Stef Mientki wrote: I want to return a simple variable from a function, not using the function result. Why? The code below is from O'Reilly, Learning Python, and there seems no way to return a simple var like z in the example below. Is that true ? To return objects

Re: Fuzzy string comparison

2006-12-28 Thread jmw
Gabriel Genellina wrote: At Tuesday 26/12/2006 18:08, John Machin wrote: I'm looking for a module to do fuzzy comparison of strings. [...] Other alternatives: trigram, n-gram, Jaro's distance. There are some Python implem. available. Quick question, you mentioned the data you need to

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Paul Hummer
How about restructuring your function like this: def some_function( z,y ): z = 2 y[2] = 'global ?' return z And then you'll have to react to the returning variable, like this in your code: x = 5 y = [1,2,3,4] print x,y print some_function( x, y ) print x,y Now, it appears like you want

per interpreter storage for C extensions

2006-12-28 Thread Robin Becker
As part of some django usage I need to get some ReportLab C extensions into a state where they can be safely used with mod_python. Unfortunately we have C code that seems incompatible with mod_python and I'm looking for ways to improve the situation. Basically the main things that are wrong

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Carsten Haese
On Thu, 2006-12-28 at 16:14 +0100, Stef Mientki wrote: I want to return a simple variable from a function, not using the function result. Is that in any way possible ?? The code below is from O'Reilly, Learning Python, and there seems no way to return a simple var like z in the example

Re: __getattr__ possible loop

2006-12-28 Thread bearophileHUGS
Maksim Kasimov: how to improve the situation depends on what do you expect to get by calling T().method() You are right, sorry for being cryptic. I think that's a kind of bug of Python (produced maybe by an infinite loop), so an improvement can be a traceback or some automatic breaking of that

db access

2006-12-28 Thread king kikapu
Hi to all, is there a way to use an RDBMS (in my case, SQL Server) from Python by using some built-in module of the language (v. 2.5) and through ODBC ?? I saw some samples that use statements like import dbi or import odbc but neither modules (dbi, odbc) are present on my system... Any hint(s)

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Carsten Haese
On Thu, 2006-12-28 at 15:28 +, Paul Hummer wrote: You'd have to either pass the variables by reference into the function, [...] In Python, all function calls are call by reference. Period. The key difference between Python and other programming languages is in the behavior of the assignment

Re: db access

2006-12-28 Thread Martin P. Hellwig
king kikapu wrote: Hi to all, is there a way to use an RDBMS (in my case, SQL Server) from Python by using some built-in module of the language (v. 2.5) and through ODBC ?? I saw some samples that use statements like import dbi or import odbc but neither modules (dbi, odbc) are present on

Re: DOS, UNIX and tabs

2006-12-28 Thread Sebastian 'lunar' Wiesner
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] typed In [EMAIL PROTECTED], Felix Benner wrote: I like using tabs. And the style guide doesn't give a reason why one shouldn't and neither does the thread http://www.python.org/search/hypermail/python-1994q2/0198.html in the archive. This is a

Re: db access

2006-12-28 Thread king kikapu
Hey Martin, thanks for the fast reply! I have already seen that link and i just downloaded the pyodbc module but isn't Python already containing a built-in odbc module so to allow for db communication ?? On Dec 28, 6:06 pm, Martin P. Hellwig [EMAIL PROTECTED] wrote: king kikapu wrote: Hi to

Slowdown in Jython

2006-12-28 Thread tac-tics
I have an application written in jython which has to process a number of records. It runs fine until it gets to about 666 records (and maybe that's a sign), and then, it's performance and responsiveness goes down the toilet. It looks like it's running out of memory and is being forced to use

Re: __getattr__ possible loop

2006-12-28 Thread Chris Mellon
On 28 Dec 2006 07:45:05 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Maksim Kasimov: how to improve the situation depends on what do you expect to get by calling T().method() You are right, sorry for being cryptic. I think that's a kind of bug of Python (produced maybe by an infinite

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Laszlo Nagy
You should also think long and hard about *why* you want to return a value from a function by modifying an input parameter instead of just using the return statement. The return by modifying an input parameter approach comes from C where that's the only way to return more than one value from

Re: db access

2006-12-28 Thread Martin P. Hellwig
king kikapu wrote: Hey Martin, thanks for the fast reply! I have already seen that link and i just downloaded the pyodbc module but isn't Python already containing a built-in odbc module so to allow for db communication ?? cut Not that I'm aware of, but it is possible to do odbc with

Re: per interpreter storage for C extensions

2006-12-28 Thread Chris Mellon
On 12/28/06, Robin Becker [EMAIL PROTECTED] wrote: As part of some django usage I need to get some ReportLab C extensions into a state where they can be safely used with mod_python. Unfortunately we have C code that seems incompatible with mod_python and I'm looking for ways to improve the

Re: __getattr__ possible loop

2006-12-28 Thread Chris Mellon
On 12/28/06, Chris Mellon [EMAIL PROTECTED] wrote: On 28 Dec 2006 07:45:05 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Maksim Kasimov: how to improve the situation depends on what do you expect to get by calling T().method() You are right, sorry for being cryptic. I think

Re: db access

2006-12-28 Thread Laszlo Nagy
king kikapu írta: Hey Martin, thanks for the fast reply! I have already seen that link and i just downloaded the pyodbc module but isn't Python already containing a built-in odbc module so to allow for db communication ?? There is no built-in ODBC module. We all know that Python comes

Re: db access

2006-12-28 Thread Chris Mellon
On 12/28/06, Martin P. Hellwig [EMAIL PROTECTED] wrote: king kikapu wrote: Hey Martin, thanks for the fast reply! I have already seen that link and i just downloaded the pyodbc module but isn't Python already containing a built-in odbc module so to allow for db communication ??

Some basic newbie questions...

2006-12-28 Thread jonathan.beckett
Hi all, While working on support at work, I have been picking away at Python - because I think it could be a valuable scripting tool for building utilities from. I have been reading the python.org tutorials, and playing around with some basic code, but I have ended up with a few questions that

Re: Some basic newbie questions...

2006-12-28 Thread Grant Edwards
On 2006-12-28, jonathan.beckett [EMAIL PROTECTED] wrote: Hi all, While working on support at work, I have been picking away at Python - because I think it could be a valuable scripting tool for building utilities from. I have been reading the python.org tutorials, and playing around with

Re: per interpreter storage for C extensions

2006-12-28 Thread Robin Becker
Chris Mellon wrote: On 12/28/06, Robin Becker [EMAIL PROTECTED] wrote: As part of some django usage I need to get some ReportLab C extensions into a state where they can be safely used with mod_python. . Just off the top of my head, I'd think that using thread-local storage instead

Re: Some basic newbie questions...

2006-12-28 Thread Chris Mellon
On 28 Dec 2006 08:40:02 -0800, jonathan.beckett [EMAIL PROTECTED] wrote: Hi all, While working on support at work, I have been picking away at Python - because I think it could be a valuable scripting tool for building utilities from. I have been reading the python.org tutorials, and playing

Re: __getattr__ possible loop

2006-12-28 Thread Maksim Kasimov
[EMAIL PROTECTED] wrote: Maksim Kasimov: how to improve the situation depends on what do you expect to get by calling T().method() You are right, sorry for being cryptic. I think that's a kind of bug of Python (produced maybe by an infinite loop), so an improvement can be a traceback or

Anyone persuaded by merits of Lisp vs Python?

2006-12-28 Thread Paddy3118
This month there was/is a 1000+ long thread called: merits of Lisp vs Python In comp.lang.lisp. If you followed even parts of the thread, AND previously used only one of the languages AND (and this is the crucial bit), were persuaded to have a more positive view of the other language; (deep

(PyGTK) Disabling ToolButton when no TreeView item is selected?

2006-12-28 Thread cypher543
I have a TreeView and a ToolButton. The ToolButton should only be active if the user has selected an item in the TreeView. What signal should I use to achieve this? Thanks, David -- http://mail.python.org/mailman/listinfo/python-list

Re: __getattr__ possible loop

2006-12-28 Thread Maksim Kasimov
Chris Mellon wrote: Nothing so clever. dir() eats and ignores all exceptions, so when you hit the recursion limit it eats the RecursionLimitExceeded exception and continues merrily along the way. This is probably not good behavior... class Foo: def __getattr__(self, attr):

Re: Some basic newbie questions...

2006-12-28 Thread jonathan.beckett
Chris Mellon wrote: On 28 Dec 2006 08:40:02 -0800, jonathan.beckett [EMAIL PROTECTED] wrote: Hi all, While working on support at work, I have been picking away at Python - because I think it could be a valuable scripting tool for building utilities from. I have been reading the

Re: per interpreter storage for C extensions

2006-12-28 Thread Robin Becker
Robin Becker wrote: Chris Mellon wrote: On 12/28/06, Robin Becker [EMAIL PROTECTED] wrote: As part of some django usage I need to get some ReportLab C extensions into a state where they can be safely used with mod_python. . Just off the top of my head, I'd think that using

Re: keypressed() function

2006-12-28 Thread BJörn Lindqvist
I know that this probably does not exist in the Python library already as a platform-independant abstraction (even though it probably could), but then I would at least like solutions that works on Windows and on Linux. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892 But it is

Re: per interpreter storage for C extensions

2006-12-28 Thread Chris Mellon
On 12/28/06, Robin Becker [EMAIL PROTECTED] wrote: Robin Becker wrote: Chris Mellon wrote: On 12/28/06, Robin Becker [EMAIL PROTECTED] wrote: As part of some django usage I need to get some ReportLab C extensions into a state where they can be safely used with mod_python. .

dictionary containing instances of classes behaving oddly

2006-12-28 Thread Ben
Hello... I have a dictionary, where each value is a seperate instance of the same class: self.mop_list[record_number]=record(self.mops[:]) In my case I know that record_number takes the values 0,3,and 7 thanks to a loop, giving me three instances of the record class instantiaterd with some

Re: Some basic newbie questions...

2006-12-28 Thread jonathan.beckett
Hi Grant, thanks for the code snippets - made total sense. On the evidence of the last couple of hours, Python is still feeling very alien, but I'm starting to get my head around it. I'm just finding it a bit weird that some of the built in functions are static, rather than methods of objects

Re: Some basic newbie questions...

2006-12-28 Thread Grant Edwards
On 2006-12-28, jonathan.beckett [EMAIL PROTECTED] wrote: Given the code below, why does the count method return what it does? How *should* you call the count method? a = [] a.append(1) print a.count print a.count(). Which will cause an exception, BTW, since the count method

Re: Some basic newbie questions...

2006-12-28 Thread Grant Edwards
On 2006-12-28, jonathan.beckett [EMAIL PROTECTED] wrote: I'm just finding it a bit weird that some of the built in functions are static, rather than methods of objects (such as len() being used to find the length of a list). Well, they actually are methods of objects (at least they are now --

Re: SPAM-LOW: (PyGTK) Disabling ToolButton when no TreeView item is selected?

2006-12-28 Thread Scripter47
cypher543 skrev: I have a TreeView and a ToolButton. The ToolButton should only be active if the user has selected an item in the TreeView. What signal should I use to achieve this? Thanks, David Hey I use the curselection() function. Example: id = self.listbox.curselection() id = id[0]

Re: Some basic newbie questions...

2006-12-28 Thread jonathan.beckett
I normally work with PHP, C#, Javascript, and the odd bit of C++, Do any of them call functions w/o parens? That's a really good point :) -- http://mail.python.org/mailman/listinfo/python-list

New IRC Channel: #moderncalcs

2006-12-28 Thread RadSurfer
IRC Server:Freenode IRC Channel: #moderncalcs Purpose: #moderncalcs created December 2005 is intended as a real-time chat channel for anyone using any model of scientific/graphing/programmable calculator, especially those of modern design. However, any calculator-related topic is acceptable.

Re: Some basic newbie questions...

2006-12-28 Thread Scott David Daniels
jonathan.beckett wrote: Hi all, While working on support at work, I have been picking away at Python - because I think it could be a valuable scripting tool for building utilities from. I have been reading the python.org tutorials, and playing around with some basic code, but I have ended

Re: Some basic newbie questions...

2006-12-28 Thread jonathan.beckett
Too many misconceptions here (I changed to a more PEP-8 style naming): class Gun(object): def __init__(self): self.shells = 10 class Battleship(object): def __init__(self): self.guns = [Gun(), Gun()] def getShellsLeft(self):

Reverse of SendKeys??

2006-12-28 Thread Scripter47
Hey! I know there is a module named SendKeys. SendKeys module it can type strings as you where typing it, on the keyboard. But is there a module that does the reverse. A module that gets _anything_ what the keyboard writes. For example. If i type hey on my keyboard. Will the program get the

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Erik Johnson
Ben [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] snip This seems to work without any errors. But bizzarely I find that whatever my record number, the instance of my_class is appended to every list. So in this case self.mop_list[0].my_list.append(my_class(Some data for the

Python 2.4/2.5 hang on bad reference?

2006-12-28 Thread Christian Convey
Has anyone seen the following? I've got a somewhat complicated program that includes pygtk, some C/C++ code, and lots of Python code. My problem is that when some code tries to use a global variable that hasn't yet been created, or tries to invoke a method/function that doesn't exist in

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Stef Mientki
Carsten Haese wrote: On Thu, 2006-12-28 at 15:28 +, Paul Hummer wrote: You'd have to either pass the variables by reference into the function, [...] In Python, all function calls are call by reference. Period. The key difference between Python and other programming languages is in the

Re: getting a process's PID

2006-12-28 Thread Tom Plunket
eldorado wrote: g = os.popen(ps -ef | grep HUB | grep -v grep | awk '{ print $2 }') h = g.readlines() g.close() h ['87334\012'] h = h[:-1] h [] I understand you're probably set, but instead of using readlines() you could also do this: g = os h = g.read().split('\n') and

xml bug?

2006-12-28 Thread Imbaud Pierre
I am using the standard xml library to create another library able to read, and maybe write, xmp files. Then an xml library bug popped out: xml.dom.minidom was unable to parse an xml file that came from an example provided by an official organism.(http://www.iptc.org/IPTC4XMP) The parsed file

Re: DOS, UNIX and tabs

2006-12-28 Thread Tom Plunket
Steven D'Aprano wrote: I don't know what problems with tabs you are talking about. I never have problems with tabs. *Other people* who choose to use software that doesn't understand tabs have problems. I've spent a lot of time reading both sides of the tabs versus spaces argument, and I

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Ben
Ah - ok. In fact I simply had: class record: my_list =[] mops=[] def __init__(self,mops): self.mops=mops Where mops is something I pass in when i create the instance. I had thought that then each time I created an instance of the record class as an

Re: xml bug?

2006-12-28 Thread Erik Johnson
Imbaud Pierre [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Now my points are: - how do I spot the version of a given library? There is a __version__ attribute of the module, is that it? Yes, the module maintainer should be incrementing this version for each new release and so

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Ben
Ah - I have been very silly indeed! I had not realised that by creating my lists outside of the def__init___() constructor they would always be class rather than instance variables, and so there was only one of them when I referred to it. Thanks to Erik and Chris for your help! Ben Ben wrote:

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Erik Johnson
Ben [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] class record: my_list =[] mops=[] def __init__(self,mops): self.mops=mops Similar to the example I gave, the lists my_list and mops shown above are executed just once: when your class

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Ben
Yes- I can see that my_list and mops, being outside def __init__() only get created once, hence the confusion. Surely def __init__() gets called each time an instance is created however? But the snag is that if they have default values set these are shared between all instances, even if they

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Carsten Haese
On Thu, 2006-12-28 at 19:49 +0100, Stef Mientki wrote: [...] When I replace the assignment to filter_prev, by a loop, the function works as expected. Python #filter_prev = Extended [ len(Signal_IN) : ] for i in range( len(filter_prev )): filter_prev[i] = Extended [ len(Signal_IN)

Re: answers.py v0.0.1 - source

2006-12-28 Thread Pyenos
#!/usr/bin/python # answers.py --- A simple answer-bot. # Copyright 2006 Logan Lee # # RELEASE NOTES: # # - I have fixed an error where the program crashes on query of #+unknown string to answers dictionary. # - Rephrased 'Do you

Re: Hooking any/all 'calls'

2006-12-28 Thread Kevin Little
Thanks, Robert! That was exactly what I was looking for. -k fumanchu [EMAIL PROTECTED] wrote: Kevin Little wrote: In Python 2.4 or 2.5, what is the easiest way to hook any and all callables such that designated code is executed at the very start and end of each call? (Yes, I'm trying to

Re: textwrap.dedent replaces tabs?

2006-12-28 Thread Frederic Rentsch
Tom Plunket wrote: Frederic Rentsch wrote: It this works, good for you. I can't say I understand your objective. (You dedent common leading tabs, except if preceded by common leading spaces (?)). I dedent common leading whitespace, and tabs aren't equivalent to spaces. E.g.

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Erik Johnson
Ben [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Yes- I can see that my_list and mops, being outside def __init__() only get created once, hence the confusion. Surely def __init__() gets called each time an instance is created however? But the snag is that if they have default

  1   2   >