Re: Writing an applilcation that can easily adapt to any language

2006-03-01 Thread Mikael Olofsson
Chance Ginger wrote: > I am rather new at Python so I want to get it right. What I am doing > is writing a rather large application with plenty of places that > strings will be used. Most of the strings involve statements of > one kind or another. > > I would like to make it easy for the support

Re: How can I find the remainder when dividing 2 integers

2006-03-01 Thread George Sakkis
Learn about ther itertools module, one of the most useful and elegant modules in the standard library (http://docs.python.org/lib/module-itertools.html): import itertools as it colors = ["#ff", "#00FF00", "#FF"] words = "Itertools is a pretty neat module".split() for word_color in it.izip(

Rapid web app development tool for database

2006-03-01 Thread George Sakkis
Is there any tool in python (or with python bindings) like Oracle Application Express, former HTML DB (http://www.oracle.com/technology/products/database/application_express/index.html) ? Ideally it should be dbms-agnostic, e.g. by using SQLObject to talk to the database. The closest I can think of

Re: Numerical solver

2006-03-01 Thread David Isaac
"Laszlo Zsolt Nagy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would like to use a numerical solver for a specific problem. Another possibility: http://nlpy.sourceforge.net/ Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Weekly Python Patch/Bug Summary

2006-03-01 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 382 open ( -3) / 3079 closed (+12) / 3461 total ( +9) Bugs: 880 open (+16) / 5624 closed ( +3) / 6504 total (+19) RFE : 211 open ( +0) / 201 closed ( +1) / 412 total ( +1) New / Reopened Patches __ PEP 357 -

Re: Removing .DS_Store files from mac folders

2006-03-01 Thread Ben Cartwright
David Pratt wrote: > OSError: [Errno 2] No such file or directory: '.DS_Store' Ah. You didn't mention a traceback earlier, so I assumed the code was executing but you didn't see the file being removed. > >>for f in file_names: > >>current_file = os.path.basename

in need of some sorting help

2006-03-01 Thread ianaré
Hey all, if i use a os.walk() to append files to a list like so... files = [] root = self.path.GetValue() # wx.TextCtrl input filter = self.fileType.GetValue().lower() # wx.TextCtrl input not_type = self.not_type.GetValue() # wx.CheckBox input for base, dirs, walk_files in os.walk(root):

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Paul Rubin
Ben Finney <[EMAIL PROTECTED]> writes: > > I don't know about this. It makes athlon64_instructions a > > completely separate enum from pentium_instructions. It could be > > that athlon64_instructions.add should be the same as > > pentium_instructions.add . > > If you want the members of two dist

Re: Suggestions for documentation generation?

2006-03-01 Thread Terry Hancock
On Wed, 01 Mar 2006 19:58:50 -0500 "John M. Gabriele" <[EMAIL PROTECTED]> wrote: > kpd wrote: > > I have written a C++ library that I've then wrapped with > > Pyrex. Any suggestions to the best-in-class tool to > > create documentation for the libraries? > > > > I would love to document things in

Newbie in python

2006-03-01 Thread - C Saha -
Hello Python Experts   I am Chirantan, a beginner in python programming world. I have some programming knowledge in SHELL, BATCH and little bit PERL. I subscribed to this list with the hope that I will get support and help from all of you.   To start with, I thought it will be a good idea to s

Re: WxPython question re: embedded activex internet explorer and excel

2006-03-01 Thread David Pratt
Hi jojoba. I work with wxPython too but cannot answer this question. There is an active and friendly community of wxPython users on [EMAIL PROTECTED] Robin Dunn, the lead person behind wxPython and others provide excellent advice and support on this list. Regards, David jojoba wrote: > Hi > I

Re: Removing .DS_Store files from mac folders

2006-03-01 Thread David Pratt
My apologies Ben. I should have included the traceback in my message. The last line of the traceback I get from python when it gets to os.remove is OSError: [Errno 2] No such file or directory: '.DS_Store' The traceback occurs immediately after printing: Current File: .DS_Store a DS_Store item

WxPython question re: embedded activex internet explorer and excel

2006-03-01 Thread jojoba
Hi I currently am using an activex wrapper in wxpython to embed Internet Explorer in a wxPanel: IEmodule=win32com.client.gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7EB-C05BAE0B}', 0,1,1) InternetExplorerActiveXClass = MakeActiveXClass(IEmodule.WebBrowser, eventObj = self) self.WebBrowser

Re: Removing .DS_Store files from mac folders

2006-03-01 Thread Ben Cartwright
David Pratt wrote: > Hi Ben. Sorry about the cut and paste job into my email. It is part of a > larger script. It is actually all tabbed. This will give you a better idea: > > for f in file_names: > current_file = os.path.basename(f) > print

Friend brings a friend.

2006-03-01 Thread Shisha Girl
http://groups.google.com/group/Hookah-Lovers.All the best discussion and inside info on hookahs and smoking tobaccos from all over the world. Shisha Girl -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Ben Finney
Paul Rubin writes: > I don't know about this. It makes athlon64_instructions a > completely separate enum from pentium_instructions. It could be > that athlon64_instructions.add should be the same as > pentium_instructions.add . If you want the members of two distinct

Re: Removing .DS_Store files from mac folders

2006-03-01 Thread David Pratt
Hi Ben. Sorry about the cut and paste job into my email. It is part of a larger script. It is actually all tabbed. This will give you a better idea: for f in file_names: current_file = os.path.basename(f) print 'Current File: %s' % c

Re: newbie question

2006-03-01 Thread Michael Tobis
I think the answers so far are unnecessarily confusing and off the mark. Here is what I think you think you want to know: 1) import only works once. If you try import again, it will see the module already exists, and will ignore you 2) the functionality you think you want is reload. >>> reload m

Re: Is it better to use class variables or pass parameters?

2006-03-01 Thread James Stroud
Derek Basch wrote: > This one has always bugged me. Is it better to just slap a "self" in > front of any variable that will be used by more than one class method > or should I pass around variable between the methods? > > FlamewarNOW! > > jk, I really do want other opinions. > > Thanks,

Re: Removing .DS_Store files from mac folders

2006-03-01 Thread Ben Cartwright
David Pratt wrote: > # Clean mac .DS_Store > if current_file == '.DS_Store': > print 'a DS_Store item encountered' > os.remove(f) ... > I can't figure why > remove is not removing. It looks like your indentation is off. From what you posted, the "print" line is prepended with

Removing .DS_Store files from mac folders

2006-03-01 Thread David Pratt
Hi. I'm trying to clean files for packaging on mac using os.path.walk and want to clean the .DS_Store files that are hidden from view but could end up in code that I produce. # Clean mac .DS_Store if current_file == '.DS_Store': print 'a DS_Store item encountered' os.remove

Re: newbie question

2006-03-01 Thread John Zenger
orangeDinosaur wrote: > I wrote up a script in my preferred text editor. It contains maybe ten > lines of code. I want to be able to execute those code lines with a > single command either from the inline mode or from IDLE. How do I do > this? I saved the file (myscript.py) in a folder that I'

Encoding problems with gettext and wxPython: how to do things in "good style"

2006-03-01 Thread André
I'm trying to change an app so that it uses gettext for translations rather than the idiosyncratic way I am using. I've tried the example on the wxPython wiki http://wiki.wxpython.org/index.cgi/RecipesI18n but found that the accented letters would not display properly. I have found a workaround t

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Roy Smith
>> Should I amend the PEP to propose "either in the builtins >> or in the collections module"? Or should I propose two >> PEPs and let them compete? I see the issue of whether it's a built-in or part of the standard library as being a detail. My personal opinion is that they're important enough

Re: Suggestions for documentation generation?

2006-03-01 Thread John M. Gabriele
kpd wrote: > Hello, > > I have written a C++ library that I've then wrapped with Pyrex. > Any suggestions to the best-in-class tool to create documentation for > the libraries? > > I would love to document things in one spot (could be the code) and > generate html and PDF from there. > > Doxygen

Re: Proper class initialization

2006-03-01 Thread Steven Bethard
Leif K-Brooks wrote: > Steven Bethard wrote: >> class A(object): >> def _get_sum(): >> return sum(xrange(10)) >> sum = _get_sum() > > What's wrong with sum = sum(xrange(10))? Nothing, except that it probably doesn't answer the OP's question. The OP presented a "s

Help: Runtime Error when loading ".pyd" module

2006-03-01 Thread Terry Tang
Hi There, We are extending Python interpreter to support special functions of our tools. What we did is to compile Python's source code (which is got from the an installation on a Linux environment for Python 2.3.3) and our extensions (C++ code) on Windows with Microsoft Visual C++ 6.0 compiler t

Re: Proper class initialization

2006-03-01 Thread Leif K-Brooks
Steven Bethard wrote: > class A(object): > def _get_sum(): > return sum(xrange(10)) > sum = _get_sum() What's wrong with sum = sum(xrange(10))? -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Terry Hancock
On Wed, 01 Mar 2006 12:37:26 +1100 Ben Finney <[EMAIL PROTECTED]> wrote: > Ben Finney <[EMAIL PROTECTED]> writes: > > PEP:354 > > Title: Enumerations in Python > > Version:$Revision: 42186 $ > > Last-Modified: $Date: 2006-01-26 11:55:20 +1100 (Thu, > > 26 Jan 2006) $ >

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Terry Hancock
On Wed, 01 Mar 2006 12:26:19 +1100 Ben Finney <[EMAIL PROTECTED]> wrote: > Steven Bethard <[EMAIL PROTECTED]> writes: > > -1 on the proposal as-is. I don't have many use cases > > for enumerations, and I don't think they merit appearing > > in the builtins. If you put them in the collections > > m

Re: PythonWin: any way to delete all objects without exiting and without doing it with "del"?

2006-03-01 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > In PythonWin, is there any way to bulk-delete all objects without using > "del object" for each, and without having to exit out of PythonWin? I think you just want to modify the globals() dict: >>> list(globals()) ['__builtins__', 'text', 'glob', 'pywin', 're', 'match'

Re: Proper class initialization

2006-03-01 Thread Steven Bethard
Christoph Zwerschke wrote: > But I wonder whether it is possible to put all this init code into one > class initialization method, something like that: > > class A: > > @classmethod > def init_class(self): > sum = 0 > for i in range(10): > sum += i > s

Re: newbie question

2006-03-01 Thread Brain Murphy
i keep on getting this message that says socket error, then says that python was unable to connect to its start up process. what does this mean and how can i fix it? D <[EMAIL PROTECTED]> wrote: Yep, that should work. Just keep in mind that if python.exe is not inyour path, you will need to eith

Re: Is it better to use class variables or pass parameters?

2006-03-01 Thread Terry Hancock
On 1 Mar 2006 11:32:02 -0800 "Derek Basch" <[EMAIL PROTECTED]> wrote: > This one has always bugged me. Is it better to just slap a > "self" in front of any variable that will be used by more > than one class method or should I pass around variable > between the methods? My first reaction was that

why descriptors? (WAS: Make staticmethod objects callable?)

2006-03-01 Thread Steven Bethard
Steven Bethard wrote: > (For anyone else out there reading who doesn't already know this, > Steven D'Aprano's comments are easily explained by noting that the > __get__ method of staticmethod objects returns functions, and classes > always call the __get__ methods of descriptors when those desc

Decimal(1) > 0.0 == False

2006-03-01 Thread Konstantin Veretennicov
Hello, I'm having hard time trying to justify this decimal quirk to my coworker (he calls it a bug): ActivePython 2.4.1 Build 247 (ActiveState Corp.) based on Python 2.4.1 (#65, Jun 20 2005, 17:01:55) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more i

Re: [coding style] Searching for uniqness in a list of data

2006-03-01 Thread Bruno Desthuilliers
Claudio Grondi a écrit : (snip) > > list=['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8v_pol_ms','1p3m_3.3-18.v_sal_ms'] Avoid using 'list' as an identifier. (snip) -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Peter Maas
Paul Rubin schrieb: >> But if you have a good usage case for an empty enum, please feel free >> to tell us. > > Do you have a good usage case for the number > 647574296340241173406516439806634217274336603815968998799147348150763731 ? Yes, it could be the value of my property in any currency :) Bu

Re: Proper class initialization

2006-03-01 Thread Christoph Zwerschke
Jack Diederich wrote: > ... __metaclass__ = MyMeta Thanks. I was not aware of the __metaclass__ attribute. Still a bit complicated and as you said, difficult to read, as the other workarounds already proposed. Anyway, this is probably not needed so often. -- Christoph -- http://mail.python.o

Re: Is it better to use class variables or pass parameters?

2006-03-01 Thread Steven D'Aprano
On Wed, 01 Mar 2006 11:32:02 -0800, Derek Basch wrote: > This one has always bugged me. Is it better to just slap a "self" in > front of any variable that will be used by more than one class method > or should I pass around variable between the methods? That depends on whether the variable is con

Re: PythonWin: any way to delete all objects without exiting and without doing it with "del"?

2006-03-01 Thread Lawrence Oluyede
[EMAIL PROTECTED] writes: > In PythonWin, is there any way to bulk-delete all objects without using > "del object" for each, and without having to exit out of PythonWin? PythonWin is just an IDE. For what reason you have to delete all objects by yourself? Garbage collector is there for that :) -

PythonWin: any way to delete all objects without exiting and without doing it with "del"?

2006-03-01 Thread dananrg
In PythonWin, is there any way to bulk-delete all objects without using "del object" for each, and without having to exit out of PythonWin? -- http://mail.python.org/mailman/listinfo/python-list

Re: Make staticmethod objects callable?

2006-03-01 Thread Steven D'Aprano
On Wed, 01 Mar 2006 08:32:20 -0700, Steven Bethard wrote: > (For anyone else out there reading who doesn't already know this, Steven > D'Aprano's comments are easily explained by noting that the __get__ > method of staticmethod objects returns functions, and classes always > call the __get__ me

Re: Is it better to use class variables or pass parameters?

2006-03-01 Thread Dave Benjamin
On Wed, 1 Mar 2006, Derek Basch wrote: > This one has always bugged me. Is it better to just slap a "self" in > front of any variable that will be used by more than one class method > or should I pass around variable between the methods? As a general rule, I only turn a parameter into an instance

Re: Stopping Windows Service

2006-03-01 Thread D
Thanks guys. Larry - I inserted the rc lines right after I do the listen() and the service is not functioning properly (service is terminating). Where am I going wrong here? Doug -- http://mail.python.org/mailman/listinfo/python-list

Re: Stopping Windows Service

2006-03-01 Thread Larry Bates
D wrote: > I have a simple file server utility that I wish to configure as a > Windows service - using the examples of the Python Win32 book, I > configured a class for the service, along with the main class functions > __init__, SvcStop, and SvcDoRun (which contains my server code). After > regis

Re: Proper class initialization

2006-03-01 Thread Larry Bates
Christoph Zwerschke wrote: > Usually, you initialize class variables like that: > > class A: >sum = 45 > > But what is the proper way to initialize class variables if they are the > result of some computation or processing as in the following silly > example (representative for more: > > cla

Re: Cross compile generation of .pyc from .py files...

2006-03-01 Thread David Wahler
[EMAIL PROTECTED] wrote: > I was under the impression, that the .pyc files will be used (if found) > by python to speed up execution of scripts... and so we packaged, > deployed and installed the .py/.pyc files on to the ppc-target system. > That package includes, site.py(c), types.py(c) etc., amon

Re: newbie question

2006-03-01 Thread Paul Metzger
> I'm brand new to using/playing with Python, and I have what is likely a > very simple question but can't seem to figure it out. > Python is fun and it's easier to use a real OS to develop the programs, then if need be, not that difficult to move them to windows:) > I wrote up a script in my pr

Re: Stopping Windows Service

2006-03-01 Thread Paul Metzger
On Wed, 2006-03-01 at 12:41 -0800, D wrote: > I have a simple file server utility that I wish to configure as a > Windows service - using the examples of the Python Win32 book, I > configured a class for the service, along with the main class functions > __init__, SvcStop, and SvcDoRun (which conta

Re: newbie question

2006-03-01 Thread D
Yep, that should work. Just keep in mind that if python.exe is not in your path, you will need to either specify the entire path to it (i.e. 'C:\python24\python C:\path\to\script\myscript.py'), or cd into its directory first (i.e. if you want to just run 'python C:\path\to\script\myscript.py'). D

Re: Proper class initialization

2006-03-01 Thread Jack Diederich
On Wed, Mar 01, 2006 at 09:25:36PM +0100, Christoph Zwerschke wrote: > Usually, you initialize class variables like that: > > class A: > sum = 45 > > But what is the proper way to initialize class variables if they are the > result of some computation or processing as in the following silly

Stopping Windows Service

2006-03-01 Thread D
I have a simple file server utility that I wish to configure as a Windows service - using the examples of the Python Win32 book, I configured a class for the service, along with the main class functions __init__, SvcStop, and SvcDoRun (which contains my server code). After registering the service,

Re: Threading - will threads run in parallel?

2006-03-01 Thread Mc Osten
On 28 Feb 2006 11:20:05 -0800, SolaFide wrote: > (get() is a function which waits for a ping on a specific port, thus > stopping the program for a while.) It's a busy wait? -- USB Priests for only 10$ -- http://mail.python.org/mailman/listinfo/python-list

Proper class initialization

2006-03-01 Thread Christoph Zwerschke
Usually, you initialize class variables like that: class A: sum = 45 But what is the proper way to initialize class variables if they are the result of some computation or processing as in the following silly example (representative for more: class A: sum = 0 for i in range(10):

Re: newbie question

2006-03-01 Thread Steve Juranich
orangeDinosaur wrote: > Hi, > > I'm brand new to using/playing with Python, and I have what is likely a > very simple question but can't seem to figure it out. > > I wrote up a script in my preferred text editor. It contains maybe ten > lines of code. I want to be able to execute those code li

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
Steve Juranich wrote: > Gerard Flanagan wrote: > > > I tried that Steve but it didn't work, and i don't think I can do what > > I want in any case. There is no method '__write' in the base class, it > > is only declared as an instance attribute in the constructor, like so: > > > > def __init__

Re: calling a class method

2006-03-01 Thread John Salerno
Simon Percivall wrote: > Read this: http://users.rcn.com/python/download/Descriptor.htm > > Long story short: The type of the instance is passed along together > with the instance itself. > "Unlike static methods, class methods prepend the class reference to the argument list before calling the

Re: Make staticmethod objects callable?

2006-03-01 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >>> class Parrot: > ... def speak(): > ... return "dead parrot" > ... speak = staticmethod(speak) > ... def playdead(): > ... return "still dead" > ... > >>> type(Parrot.speak) > >

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-01 Thread dananrg
The other thing I didn't do a good job of explaining is that I want to have a layer of abstraction between the underlying RDBMS and the business logic. It's the business logic I want to use Python for, so that would stay roughly the same between RDBMS changes, if we ever have an RDBMS change. I agr

Re: Matplotlib logarithmic scatter plot

2006-03-01 Thread Derek Basch
Good tip John. Hopefully it will help someone out. Thanks again. Derek Basch -- http://mail.python.org/mailman/listinfo/python-list

Re: calling a class method

2006-03-01 Thread Simon Percivall
Read this: http://users.rcn.com/python/download/Descriptor.htm Long story short: The type of the instance is passed along together with the instance itself. -- http://mail.python.org/mailman/listinfo/python-list

Re: Matplotlib logarithmic scatter plot

2006-03-01 Thread John Hunter
> "Derek" == Derek Basch <[EMAIL PROTECTED]> writes: Derek> formatter = FuncFormatter(log_10_product) Derek> ax.xaxis.set_major_formatter(formatter) Derek> ax.yaxis.set_major_formatter(formatter) I would caution you against using identical objects for the x and y axis *Locators*.

calling a class method

2006-03-01 Thread John Salerno
I'm reading about class methods now and I have a question about calling them. I know it is wrong of me to assume it needs to work in a parallel manner to an instance method, but I'm curious why it doesn't. Here's the book's example: class Multi: def imeth(self, x): print self, x

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-01 Thread dananrg
Thanks Gerhard and Magnus. Magnus, thanks for the references. I will follow up on those. I was messing around with the native ODBC module you mentioned (I am using Python in a Win32 environment), e.g: import dbi, odbc ...and it seems to meet my needs. The only issue I've had so far is retrieving

newbie question

2006-03-01 Thread orangeDinosaur
Hi, I'm brand new to using/playing with Python, and I have what is likely a very simple question but can't seem to figure it out. I wrote up a script in my preferred text editor. It contains maybe ten lines of code. I want to be able to execute those code lines with a single command either from

Re: Cross compile generation of .pyc from .py files...

2006-03-01 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > ppc system. The "...has bad magic..." appears to indicate that The format of .pyc files, which are generated for greater speed of repeat runs, is considered an internal implementation detail subject to change. The exact details are

Re: Path completion in 'raw-input'?

2006-03-01 Thread Mc Osten
On Wed, 01 Mar 2006 10:00:43 -0800, Johannes Graumann wrote: > There's also the rlcompleter module, but in the interest of better platform > agnosis I'd like to stick with cmd ... I would have suggested readline.. This works on Windows: Th

Re: Is it better to use class variables or pass parameters?

2006-03-01 Thread Mc Osten
On 1 Mar 2006 11:32:02 -0800, Derek Basch wrote: > This one has always bugged me. Is it better to just slap a "self" in > front of any variable that will be used by more than one class method > or should I pass around variable between the methods? I think there is no clear "general" answer. A cri

Is it better to use class variables or pass parameters?

2006-03-01 Thread Derek Basch
This one has always bugged me. Is it better to just slap a "self" in front of any variable that will be used by more than one class method or should I pass around variable between the methods? FlamewarNOW! jk, I really do want other opinions. Thanks, Derek -- http://mail.python.org/mai

Re: type = "instance" instead of "dict"

2006-03-01 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Cruella DeVille wrote: > >> This is off topic, but if read the documentation is the answere to >> everything why do we need news groups? > > Because "read the documentation" is NOT the answer to > everything. However,

Re: error: argument after ** must be a dictionary

2006-03-01 Thread abcd
i was missing "self" in my method signature! doh! -- http://mail.python.org/mailman/listinfo/python-list

Re: Thread Question

2006-03-01 Thread Jarek Zgoda
Just napisał(a): > I always felt that subclassing Thread is very unpythonic. It seems like > an unfortunate leftover Javaism (much of threading.py was inspired by > Java, but I don't need to tell you that). If I need some state, I create > my own class, with a reference to the Thread object if

Suggestions for documentation generation?

2006-03-01 Thread kpd
Hello, I have written a C++ library that I've then wrapped with Pyrex. Any suggestions to the best-in-class tool to create documentation for the libraries? I would love to document things in one spot (could be the code) and generate html and PDF from there. Doxygen (www.doxygen.org) looks to be

Re: error: argument after ** must be a dictionary

2006-03-01 Thread abcd
Not sure if it matters, but this occurs when running a unittest. The trace back is: Traceback (most recent call last): File "C:\Python24\Lib\threading.py", line 442, in __bootstrap self.run() File "C:\Python24\Lib\threading.py", line 422, in run self.__target(*self.__args, **self.__kwa

Re: Use empty string for self

2006-03-01 Thread John Salerno
Duncan Booth wrote: > John Salerno wrote: > >>> The two calls are equivalent. >> can you also say instance.mymethod(instance, 1, 2) ? > > Only if mymethod is defined to take all 4 arguments you just passed to it. Got it. I understand how it works now. -- http://mail.python.org/mailman/listin

ihooks and Python eggs

2006-03-01 Thread Christoph Zwerschke
Is it a known problem that ihooks is incompatible with Python eggs? When I do the following: import ihooks ihooks.install(ihooks.ModuleImporter()) then I cannot import any Python egg afterwards. Can there be anything done about this? -- Christoph -- http://mail.python.org/mailman/listinfo/pyt

Re: Default Section Values in ConfigParser

2006-03-01 Thread Fuzzyman
mwt wrote: > I want to set default values for a ConfigParser. So far, its job is > very small, so there is only one section heading, ['Main']. Reading the > docs, I see that in order to set default values in a ConfigParser, you > initialize it with a dictionary or defaults. However, I'm not quite

Re: Use empty string for self

2006-03-01 Thread Duncan Booth
John Salerno wrote: >> The two calls are equivalent. > > can you also say instance.mymethod(instance, 1, 2) ? Only if mymethod is defined to take all 4 arguments you just passed to it. -- http://mail.python.org/mailman/listinfo/python-list

asynchat network send problems

2006-03-01 Thread Andreas R.
Hello, I'm using Python's asynchat module for network support in a Python-based game, and I run into two problems, both of which occur at random times. Most of the time, the network sending and receiving is perfect, but about 1 out of 10 times, it fails with one of these errors: -- Problem 1. Wh

Re: Searching for uniqness in a list of data

2006-03-01 Thread Paul McGuire
"rh0dium" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > I am having a bit of difficulty in figuring out an efficient way to > split up my data and identify the unique pieces of it. > > list=['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8_sal_log'] > > Now I want to split each item

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Steve Juranich
Gerard Flanagan wrote: > I tried that Steve but it didn't work, and i don't think I can do what > I want in any case. There is no method '__write' in the base class, it > is only declared as an instance attribute in the constructor, like so: > > def __init__(self, file, encoding="us-ascii"):

Re: looking for help about python-sane

2006-03-01 Thread none
JW wrote: > Every time, or just this run? > every time -- http://mail.python.org/mailman/listinfo/python-list

Re: why? [win32com/WMI]

2006-03-01 Thread rtilley
Tim Golden wrote: > [Sergey] > > | import win32com.client > | > | loc = win32com.client.Dispatch("WbemScripting.SWbemLocator") > | svc = loc.ConnectServer("srv", "root/cimv2", "[EMAIL PROTECTED]", "**") > | sys = svc.get("Win32_Process") > | sys.create("notepad.exe") > | > | => > | > | Trac

Path completion in 'raw-input'?

2006-03-01 Thread Johannes Graumann
When interactively asking for a path on the cmdl, I'd like to go beyond just 'raw_input' and provide shell like path completion. My research has made me believe that a combination of the cmd and glob modules is what I need, but I find the doc HIGHLY unintuitive and wasn't able to come by any exampl

Re: Use empty string for self

2006-03-01 Thread Douglas Alan
Roy Smith <[EMAIL PROTECTED]> writes: > Terry Hancock <[EMAIL PROTECTED]> wrote: >> However, there is a slightly less onerous method which >> is perfectly legit in present Python -- just use "s" >> for "self": > This is being different for the sake of being different. Everybody *knows* > what

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Raymond Hettinger
[Ben Finney] > It is possible to simply define a sequence of values of some other > basic type, such as ``int`` or ``str``, to represent discrete > arbitrary values. However, an enumeration ensures that such values > are distinct from any others, and that operations without meaning > ("Wednesday t

Re: Searching for uniqness in a list of data

2006-03-01 Thread Alexander Schmolck
Alexander Schmolck <[EMAIL PROTECTED]> writes: > The easiest way to do this is to have a nested dictionary of prefixes: for > each prefix as key add a nested dictionary of the rest of the split as value > or an empty dict if the split is empty. Accessing the dict with an userinput > will give you

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > >>Is there any simple way round this situation in general? > > It might be safer to use composition instead of inheritance in this > case. Assuming that XMLWriter has a write method to write what you > want, you could hold a reference to an XMLWriter within your class and

Re: Trouble with numpy-0.9.4 and numpy-0.9.5

2006-03-01 Thread Travis E. Oliphant
drife wrote: > Hello, > > I use the Python Numeric package extensively, and had been an > avid user of the "old" scipy. In my view, both pieces of software > are truly first rate, and have greatly improved my productivity in > the area of scientific analysis. Thus, I was excited to make the > tran

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
Steve Juranich wrote: > Gerard Flanagan wrote: > > > I would like to do the following: > > > > from elementtree.SimpleXMLWriter import XMLWriter > > > > class HtmlWriter(XMLWriter, object): > > def write_raw(self, text): > > super( HtmlWriter, self ).flush() > > super

Re: Cross compile generation of .pyc from .py files...

2006-03-01 Thread venkatbo
Hi Sebastian, Thanks for that link and your notes. I was under the impression, that the .pyc files will be used (if found) by python to speed up execution of scripts... and so we packaged, deployed and installed the .py/.pyc files on to the ppc-target system. That package includes, site.py(c), ty

Trouble with numpy-0.9.4 and numpy-0.9.5

2006-03-01 Thread drife
Hello, I use the Python Numeric package extensively, and had been an avid user of the "old" scipy. In my view, both pieces of software are truly first rate, and have greatly improved my productivity in the area of scientific analysis. Thus, I was excited to make the transition to the new scipy cor

Re: Cross compile generation of .pyc from .py files...

2006-03-01 Thread Just
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Terry Reedy wrote: > > ... > > I am under the impression that .pyc files are system independent. > > Have you tried simply copying them over? > > > > tjr > > Hi Terry, > > It appears that python on the target ppc system is expecting to

Re: Make staticmethod objects callable?

2006-03-01 Thread Nicolas Fleury
Steven Bethard wrote: > ... > Yes, you have to explain descriptors, but at the point that you start > trying to do funny things with staticmethods and classmethods, I think > you need to start learning about them anyway.) That's all good points, but IMHO, descriptors are a much more advanced Py

Re: Cross compile generation of .pyc from .py files...

2006-03-01 Thread venkatbo
Terry Reedy wrote: > ... > I am under the impression that .pyc files are system independent. > Have you tried simply copying them over? > > tjr Hi Terry, It appears that python on the target ppc system is expecting to see ppc-related info in the .pyc files. These .pyc were generated at cross com

Re: Printing a file

2006-03-01 Thread David Boddie
Fabian Steiner wrote: > This is what I have so far: > > app = QApplication(sys.argv) > printer = QPrinter(QPrinter.PrinterResolution) > if printer.setup(): > printer.setPageSize(printer.A4) > painter = QPainter(printer) > metrics = QPaintDeviceMetrics(painter.device()) > margin

Re: Searching for uniqness in a list of data

2006-03-01 Thread johnzenger
You can come quite close to what you want without splitting the string at all. It sounds like you are asking the user to build up a string, and you want to keep checking through your list to find any items that begin with the string built up by the user. Try something like this: mylist = ['1p2m_

Re: Thread Question

2006-03-01 Thread Just
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Kent Johnson <[EMAIL PROTECTED]> wrote: > >D wrote: > >> > >> My question is, how would I go > >> about creating the thread? I have seen examples that used classes, and > >> other examples that j

Re: telnetlib problems

2006-03-01 Thread vercingetorix52
Thanks for the reply. I've replaced the call to read_very_eager() with read_until() and enabled debugging messages. My script now looks like this... # import telnetlib tn = telnetlib.Telnet('192.168.100.11') tn.set_debuglevel(9) tn.read_until('login: ', 5) tn.write

  1   2   >