Re: Is it explicitly specified?

2008-02-03 Thread Diez B. Roggisch
Bjoern Schliessmann schrieb: > mario ruggier wrote: > >> It may sometimes be useful to make use of the conceptual >> difference between these two cases, that is that in one case the >> user did not specify any key and in the other the user explicitly >> specified the key to be None. > > Do you ha

Re: Custom widgets

2008-02-04 Thread Diez B. Roggisch
Whiplash wrote: > I want to build some basic kid games for Linux (Ubuntu/EdUbuntu) and > so after looking around I've decided that Python would probably be the > path of least resistance. > > I have a need to create custom gui elements (widgets?). I want these > games to be very graphical. Not 3d

Re: PyOpenGL

2008-02-04 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi all, > > I apologize if this question was already answered before but I was > unable to find a proper solution to my problem. Anyways, I am trying > to run shaderobjects.py on Windows (Python 2.5.1) by just double- > clicking, and I got the following error: > > [...

Re: boolean decisions

2008-02-05 Thread Diez B. Roggisch
bilities and specify what should > happen in each case. There are only 64 rows and some of the decisions are > obviously explainable in simple ways ie > > if a and not b do action 1 > > is there a way to derive simplified rules for each binary outcome? I'm > sure

Re: boolean decisions

2008-02-05 Thread Diez B. Roggisch
> I think the problem is actually less simple than that. Although they can > enumerate many or all of the rows of the table I suspect that the business > people don't always know why they choose particular outcomes; often > they're not looking at most of the input choices at all they just > concent

Re: package import

2008-02-06 Thread Diez B. Roggisch
Sean Allen wrote: > ok, what am i doing wrong? > > in current working directory i have: > > t.py > sub/t1.py > > t.py is: > > import sub.t1 > > i get: > > ImportError: No module named sub.t1 > > t.py is > > import sub > > i get: > > ImportError: No module named sub.t1 > > -- > > i am o

Re: Retreiving objects from other processes

2008-02-06 Thread Diez B. Roggisch
Natan Yellin wrote: > Hello, > Sorry if this is a stupid question... I have some experience with C > but very little with Python. > I'd like to have one python program retrieve a reference or copy of an > object from another python process on the same computer. I know I can > use RPyC, but that se

Re: Installing PyQt

2008-02-06 Thread Diez B. Roggisch
Marcus Strube schrieb: > Hi > > I was trying to install PyQt, but things don't work as promised. > > I'm working on OS X 10.5, didn't install another version of Python - so > it's 2.5.1 -, installed the latest "qt-mac-opensource-4.3.3.dmg" and the > latest sip 4.7.3. But when I then try to run

Re: getting all user defined attributes of a class

2008-02-06 Thread Diez B. Roggisch
Amit Gupta schrieb: > On Feb 6, 2:15 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Wed, 06 Feb 2008 14:07:23 -0800, Amit Gupta wrote: >>> Class A(object) : >>> self.x = 1 >> This is not valid Python code. >> >>> I want something like: >>> for userattrib in A.getAllUserAttribute(

Re: Code block function syntax, anonymous functions decorator

2008-02-06 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > def run3( block ): >for _ in range( 3 ): > block() > > run3(): >normal_suite() > > Introduces new syntax; arbitrary functions can follow 'colon'. > > Maintains readability, meaning is consistent. > > Equivalent to: > > def run3( block ): >for _ in

Re: Code block function syntax, anonymous functions decorator

2008-02-07 Thread Diez B. Roggisch
Jean-Paul Calderone schrieb: > On Wed, 06 Feb 2008 23:59:27 +0100, "Diez B. Roggisch" > <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] schrieb: >>> def run3( block ): >>>for _ in range( 3 ): >>> block() >>> >>&g

Re: beginners help

2008-02-07 Thread Diez B. Roggisch
Guido van Brakel wrote: > Hello > > I totally new to python and i'm doing a python course now. Maybe someone > could help me a little bit here: > > I need to create this script. > > If i enter a center digit like 5 for example i need to create two > vertical and horzitonal rows that looks like

Re: index() of sequence type?

2008-02-07 Thread Diez B. Roggisch
Neal Becker wrote: > I see list has index member, but is there an index function that applies > to any sequence type? > > If not, shouldn't there be? Looks like an oversight to me as well, yes. The only "difficult" implementation would be the one for xrange, because you can't search but must com

Re: a trick with lists ?

2008-02-07 Thread Diez B. Roggisch
"S����������������������������������������������" schrieb: > I've found some class on the Net which takes basically this form : > > ## > class Foo: > def __init__(self): > self.tasks = [] >

Re: Distinguishing between functions and methods in a decorator.

2008-02-07 Thread Diez B. Roggisch
Berteun Damman wrote: > Hello, > > I was wondering a bit about the differences between methods and > functions. I have the following: > > def wrap(arg): > print type(arg) > return arg > > class C: > def f(): > pass > > @wrap > def g(): > pass > > def h(): >

Re: Distinguishing between functions and methods in a decorator.

2008-02-07 Thread Diez B. Roggisch
Berteun Damman schrieb: > Hello, > > I was wondering a bit about the differences between methods and > functions. I have the following: > > def wrap(arg): > print type(arg) > return arg > > class C: > def f(): > pass > > @wrap > def g(): > pass > > def h():

Re: matplotlib install error

2008-02-07 Thread Diez B. Roggisch
John schrieb: > I'm trying to install matplotlib and currently getting the below > error. I searched the group and google and couldn't find anything > similar... Any ideas? > > Thanks in advance! > > src/ft2font.cpp: In member function 'Py::Object > Glyph::get_path(FT_FaceRec_* const&)': > src/f

Re: dependency order

2008-02-09 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > i'm having trouble trying to figure this out... it's part of a build > system i'm writing in python. maybe someone has a good simple way to > solve this. i'm trying to create a dependency order out of multiple > lists. > > list1

Re: Better way to do this?

2008-02-11 Thread Diez B. Roggisch
PRC schrieb: > Hi folks, > > I have a tuple of tuples, in the form--> ((code1, 'string1'),(code2, > 'string2'),(code3, 'string3'),) > > Codes are unique. A dict would probably be the best approach but this > is beyond my control. > > Here is an example: pets = ((0,'cat'),(1,'dog'),(2,'mouse

Re: Sending Python statement over socket in chunks

2008-02-11 Thread Diez B. Roggisch
Jeffrey Barish schrieb: > I have a python module that contains an assignment statement binding a long > list of things to a name: > > list_of_things = [thing1, thing2, ...] > > where each thing instantiates class Thing when executed. I send this > statement through a socket to a remote module th

Re: packing greyscale values

2008-02-11 Thread Diez B. Roggisch
jimgardener wrote: > hi > i am getting value of a pixel of a greyscale image using PIL's > image.getdata and need to pack it as an int as below > > ie greyvalues > 127 , 56 , 135 , 99 , 102 , 101 , 146 , 112 , 155 , 154 , 112 , 169 > > should become > -4473925, -8289919, -4144960, -5789785, -559

Re: Floating point bug?

2008-02-14 Thread Diez B. Roggisch
Preston Landers schrieb: > [EMAIL PROTECTED]([EMAIL PROTECTED])@2008.02.13 15:13:20 -0800: >> Not a bug. All languages implementing floating point numbers have the >> same issue. Some just decide to hide it from you. Please read >> http://docs.python.org/tut/node16.html and particularly >> http://d

Re: Parallel port control with USB->Parallel converter

2008-02-14 Thread Diez B. Roggisch
Soren wrote: > Hi, > > I want to control some motors using the parallel port.. however, my > laptop does not have any parallel ports (very few do). What I do have > is a USB->Parallel converter... I thought about using PyParallel, but > the USB->Parallel converterdoesn't actually map to the L

Re: File object wrapper for a String?

2008-02-14 Thread Diez B. Roggisch
David Erickson schrieb: > I am using the Popen class from subprocess and would like to feed a > string in as the stdin parameter, however primarily it only takes a > File object. Does there exist a wrapper for a string to do this? I > know I can just dump the string to a temp file and feed that i

Re: Floating point bug?

2008-02-15 Thread Diez B. Roggisch
Zentrader schrieb: >> That's a misconception. The decimal-module has a different base (10 >> instead of 2), and higher precision. But that doesn't change the fact >> that it will expose the same rounding-errors as floats do - just for >> different numbers. >> >> >>> import decimal as d >> >>> d =

Re: Where can I get the module MyUtils?

2008-02-16 Thread Diez B. Roggisch
Python_Doctor schrieb: > I inherited a piece of python code which imports "MyUtils" i.e. it has > a line: > > import MyUtils > > When I execute the code I get: > > ImportError: No module named MyUtils > > I assume the code is looking for another module called MyUtils.py. Is > this a standard Py

Re: any python wrapper to call .lib static library(ufmod.lib)?

2008-02-16 Thread Diez B. Roggisch
est schrieb: > I want to play .XM music using Python, now I found ufmod > http://ufmod.sourceforge.net > > It only provide a ufmod.lib to be compiled in C/C++/BASIC, and Python > as a scripting language could not handle these static libraries. What > could I do to with these .lib files? I'm not

Re: copying files through Python

2008-02-16 Thread Diez B. Roggisch
Lalit Krishna schrieb: > Hi this is the code which I wrote till now. It is giving permission > denied error for sub folders of source directory. Does anyone have any > idea what is going wrong > > import os > import shutil > def copytreetosinglefolder(src, dst): > names = os.listdir(src) > if (o

Re: Is there a way to "link" a python program from several files?

2008-02-16 Thread Diez B. Roggisch
Edward A. Falk schrieb: > IOW, is there a "linker" for python? I've written a program comprised of > about > five .py files. I'd like to find a way to combine them into a single > executable. Obviously, I could hand-edit them into a single .py file, but > I'm looking for a way to keep them as s

Re: class static variables and __dict__

2008-02-16 Thread Diez B. Roggisch
Zack schrieb: > If I have a class static variable it doesn't show up in the __dict__ of > an instance of that class. > > class C: >n = 4 > > x = C() > print C.__dict__ > {'__module__': '__main__', '__doc__': None, 'n': 4} > print x.__dict__ > {} > > This behavior makes sense to me as n is n

Re: Is there a way to "link" a python program from several files?

2008-02-16 Thread Diez B. Roggisch
Brian Smith schrieb: > Diez B. Roggisch wrote: >> Edward A. Falk schrieb: >>> IOW, is there a "linker" for python? I've written a >>> program comprised of about five .py files. I'd like to >>> find a way to combine them into a single

Re: Linux/Python Issues

2008-02-17 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I went to Python.org, DL'd Python 2.5 source code per the usual > inadequate instructions and ran the make files successfully (sort of). > Python 2.5 works fine. But "from Tkinter import *" gets a "What's > Tkinter?" message. IDLE's no where to be found. > > What's not

Re: Dont know what my class is called...

2008-02-17 Thread Diez B. Roggisch
Adam W. schrieb: > I am using the xml.sax package, and I'm running into a little > problem. When I use the parse(url, ContentHandler()) method, I don't > know what parse() is naming the instance of ContentHandler. > > I have a sub-class of ContentHandler make a dictionary of what it > parses, but

Re: Linux/Python Issues

2008-02-18 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > > [EMAIL PROTECTED] wrote: >> IOW: all this is assumed to be >> common *n*x knowledge. > > Both GNOME and KDE put Windows to shame. An old Windows guy, like me, > can just start using either one without needing 'common *n*x > knowledge.' Too bad the *n*x community isn

Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Kantrowitz (sanitizer)

2008-02-18 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Dear Ilias, > > Post in a single reply. He has to, in hopes to gain the traction he desires - as otherwise he's pretty much ignored these days. Which is a good thing of course... Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: The big shots

2008-02-19 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I'm a little dissatisfied, and just thinking aloud. > > Some of the ideas that have been proposed on Python-ideas as well as > Python, have received partial evaluation from the alphas. > > Lesser individuals than they could not have invented Python, and would > be lia

Re: The big shots

2008-02-19 Thread Diez B. Roggisch
> > May I insist? By the criteria you've mentioned so far, nothing rules > out 'ext'. If it's still a bad idea, there's a reason. What is it? You imply that just because something is somehow working and even useful for a *some* people (some being maybe only you) that it would be worth includ

Re: What's "the standard" for code docs?

2008-02-20 Thread Diez B. Roggisch
> Are people really writing pure HTML snippets in docstrings to document > each module/class/method? For anything other than a toy project? > > One of the main reasons I'm considering moving to epydoc + reST is > precisely because it's very un-HTML. > > Mind you I want to be able to produce HTM

Re: Is there a way to "link" a python program from several files?

2008-02-21 Thread Diez B. Roggisch
Edward A. Falk schrieb: > In article <[EMAIL PROTECTED]>, > BlueBird <[EMAIL PROTECTED]> wrote: >> I wrote a small wiki page to sum-up my findings about such typical >> problem: >> >> http://www.freehackers.org/Packaging_a_python_program >> > > Excellent references, but maybe a bit of overkill.

Re: distutils and data files

2008-02-22 Thread Diez B. Roggisch
> Not if the documentation for 2.5's got anything to say about it. If > it does, it's well hidden. > > I think I'll kill the idea of using distutils for my program. It > seems like distutils was primarily designed for modules and > extensions. Start using setuptools and pkg_resources. Then you

Re: Getting stdout from other processes

2008-02-22 Thread Diez B. Roggisch
Matthias Vogelgesang schrieb: > Hello, > as I found out, it is possible to get the output of other programs > using os.popen() and read from it. However this method is blocking for > server processes and programs that don't stop immediately. Has anyone > an idea how to get the output of such progra

Re: graphing/plotting with python and interface builder

2008-02-23 Thread Diez B. Roggisch
Jacob Davis schrieb: > Hi. > > I am developing for mac and using Xcode and Interface Builder 3.0. I > can make a simple application, but I am having a hard time trying to > figure out a good way to create a graph or plot for a class project. > > Does anybody have any tips on where to get start

Re: graphing/plotting with python and interface builder

2008-02-24 Thread Diez B. Roggisch
Jacob Davis schrieb: > I found SM2DGraphView, but I guess that I am too much of a newbie with > interface builder and pyobjc to figure out how to get SM2DGraphView to > work. Are there any good tutorials (or better yet, examples) of how to > get SM2DGraphView to work? > > I don't know pyobjc w

Re: PHP Developer highly interested in Python (web development) with some open questions...

2008-02-24 Thread Diez B. Roggisch
> > It's also some kind of a Rube Goldberg thingie... > http://en.wikipedia.org/wiki/Rube_Goldberg_machine > > If you're into web applications, better to have a look at Pylons or > Django IMHO. You are entitled to your opinion, but calling Zope a Rube-Goldberg-machine is strong. To put it mildl

Re: Embedding a literal "\u" in a unicode raw string.

2008-02-25 Thread Diez B. Roggisch
Romano Giannetti wrote: > Hi, > > while writing some LaTeX preprocessing code, I stumbled into this problem: > (I have a -*- coding: utf-8 -*- line, obviously) > > s = ur"añado $\uparrow$" > > Which gave an error because the \u escape is interpreted in raw unicode > strings, too. So I found tha

Re: Accessing "sub elements" with xml.sax ?

2008-02-25 Thread Diez B. Roggisch
erikcw schrieb: > Hi, > > I'm trying to use xml.sax (from xml.sax.handler import ContentHandler) > to processes the following data: > > > masterAccountName="CraftShowSuccess.Com-US" > dateStart="2008-02-24-0600" dateEnd="2008-02-24-0600" > booksClosedTimestamp="2008-02-25T01:15:00.000-0600" boo

Re: How, python with Tk extensions enabled to import Tkinter

2008-02-27 Thread Diez B. Roggisch
Murat Gunduz wrote: > > > Dear list member, > > I am using a Linux machine (Fedora Core 7, 64 bit): > Linux 2.6.21-1.3228.fc7 #1 SMP Tue Jun 12 14:56:37 EDT 2007 x86_64 So you are under linux... > 4- type "./configure --enable-framework And now you try to create an OSX-framework-build? Why so

Re: Instance of inherited nested class in outer class not allowed?

2008-02-27 Thread Diez B. Roggisch
mrstephengross schrieb: > I've got an interesting problem with my class hierarchy. I have an > outer class, in which two nested classes are defined: > > class Outer: > class Parent: > def __init__ (self): > print "parent!" > class Child(Parent): > def __init__ (self): > Out

Re: Instance of inherited nested class in outer class not allowed?

2008-02-27 Thread Diez B. Roggisch
mrstephengross schrieb: >> class Foo: >> foo = Foo() >> >> You have to live with that. Just do >> Outer.foo = Outer.Parent() >> after your class-statement to achieve the same result. > > Hmmm. Well, I see why that works. It's too bad, though. If I want to > keep all executed code safely with

Re: Is crawling the stack "bad"? Why?

2008-02-29 Thread Diez B. Roggisch
> > I will (mostly)... I knew it was bad code and a total hack, I just was > looking for a concise reason as to why. > > I appreciate the comments, guys... thanks! There is another one: crawling the stack is O(n), whilst using thread-local storage is O(1) Diez -- http://mail.python.org/mailm

Re: at-exit-thread

2008-02-29 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > The Python main interpreter has an at-exit list of callables, which > are called when the interpreter exits. Can threads have one? What's > involved, or is the best way merely to subclass Thread? Is that some sort of trick-question? class MyThread(Thread): def

Re: at-exit-thread

2008-03-01 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > On Feb 29, 1:55 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] schrieb: >> >>> The Python main interpreter has an at-exit list of callables, which >>> are called when the interpreter exits. Can

Re: tcp functions

2008-03-01 Thread Diez B. Roggisch
Gif schrieb: > is there a module for tcp functions or any other quick way to connect, > listen, send and recieve from tcp? > thanks in advance Reading the docs helps - hint: module "socket". Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: SQLLITE

2008-03-01 Thread Diez B. Roggisch
nexes schrieb: > Hello All, >I am having a minor problem when I try and do this: > c.execute("insert into [tblTranscripts] (MovieID,Transcript) > Values(" + movieID + ",'" + formatText + "');") (don't even bother > commenting of the sql style I know its bad form but this is a simple > s

Re: pySQLite Insert speed

2008-03-01 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I hav read on this forum that SQL coding (A) below is preferred over > (B), but I find (B) is much faster (20-40% faster) > > (A) > > sqla= 'INSERT INTO DTABLE1 VALUES (%d, %d, %d, %f)' % values > curs.e

Re: tcp

2008-03-02 Thread Diez B. Roggisch
Gif schrieb: > you could at least check before posting. as i said i've tried like > 1000 ways of doing that, and im so desparate that i'm thinking of > quiting python. This damn thing just doesnt work. when i do as you > post the server never even replies, as it tends to accept connections > all th

Re: tcp

2008-03-02 Thread Diez B. Roggisch
Gif schrieb: > sorry for acting like a fool but this is just to weirdly easy that i > can't get to work. i've written a small web server in another language > and this is more like copying code. > i already have everything figured out, except this one but noone seems > either willing or capable of

Re: Inheritance issue...

2008-03-03 Thread Diez B. Roggisch
MooMaster schrieb: > I'm trying to use inheritance to create a simple binary tree, but it's > not going so well... here's what I pull from the documentation for > super() > "super( type[, object-or-type]) > > Return the superclass of type. If the second argument is omitted the > super object retur

Re: Polymorphism using constructors

2008-03-03 Thread Diez B. Roggisch
K Viltersten schrieb: > I'm writing a class for rational numbers > and besides the most obvious constructor > > def __init__ (self, nomin, denom): > > i also wish to have two supporting ones > > def __init__ (self, integ): >self.__init__ (integ, 1) > def __init__ (self): >self.__init_

Re: tools to install not in python tree?

2008-03-04 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hello, > > I have some materials for a project that I am working on that I keep > in a source code control system (svn now, but I'm experimenting with > mercurial). I want to install these things from the repository, but > not into site-packages/ as Distutils wants to

Re: Eurosymbol in xml document

2008-03-04 Thread Diez B. Roggisch
Hellmut Weber wrote: > Hi, > i'm new here in this list. > > i'm developing a little program using an xml document. So far it's easy > going, but when parsing an xml document which contains the EURO symbol > ('€') then I get an error: > > UnicodeEncodeError: 'charmap' codec can't encode character

Re: Eurosymbol in xml document

2008-03-04 Thread Diez B. Roggisch
> If the file is declared as latin-1 and contains an euro symbol, then the > file is actually invalid since euro is not defined of in iso-8859-1. If > there is no encoding declaration, as Diez already said, the file should > be encoded as utf-8. > You are right of course - latin1 doesn't contain

Re: Unit testing Web applications

2008-03-05 Thread Diez B. Roggisch
Monica Leko wrote: > Hi! > > Does Python has some testing frameworks for testing Web applications > (like Cactus and HttpUnit for Java), generating requests and checking > if the response is correct? mechanize and webunit come to my mind. Yet the most powerful will be selenium together with sel

Re: Dual look-up on keys?

2008-03-05 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I want to hash values to keys. How do the alternatives compare? http://catb.org/~esr/faqs/smart-questions.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Dual look-up on keys?

2008-03-05 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > On Mar 5, 3:38 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> On Wed, 05 Mar 2008 12:06:11 -0800, castironpi wrote: >>> On Mar 5, 1:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >>>

Re: Ncurses not found - embedded linux

2008-03-06 Thread Diez B. Roggisch
blaine schrieb: > Hello Everyone! > I am hoping that someone out there can help me out with this > problem. We are using a gumstix platform to develop an embedded > system. All that really matters is that it is an ARM processor > running an embedded linux, details to follow. Gumstix has its ow

Re: Exploring Attributes and Methods

2008-03-06 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Hi, > Is there a python command that allows me to extract the names (not > values) of the attributes of a class. > > example > > Class Sample: > fullname = 'Something' > > How can I know that this class has an attribute called 'fullname'? > > I hope my question

Re: hidden built-in module

2008-03-07 Thread Diez B. Roggisch
koara schrieb: > On Mar 5, 1:39 pm, gigs <[EMAIL PROTECTED]> wrote: >> koara wrote: >>> Hello, is there a way to access a module that is hidden because >>> another module (of the same name) is found first? >>> More specifically, i have my own logging.py module, and inside this >>> module, depending

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Diez B. Roggisch
Lie schrieb: > I'm asking about people in c.l.py's opinion about a _probably_ very > Pythonic way of doing something if such features is implemented. It is > to be known that I'm not a Python expert and actually relatively new > to Python programming, so probably I'm just not thinking pythonic > en

Re: Need Help Building PythonQt on Windows

2008-03-09 Thread Diez B. Roggisch
Jeff Schiller schrieb: > Hello, > > I'm creating an application using Qt (4.4 Beta atm). I have pretty > close to zero experience with Python (consisting of installing the > Python interpreter, downloading a python programming and executing it > on the command-line). > > I would like to invoke a

Re: Need Help Building PythonQt on Windows

2008-03-09 Thread Diez B. Roggisch
Jeff Schiller schrieb: > I said "PythonQt" not PyQt. That's an important distinction, I think :) > > See http://pythonqt.sourceforge.net/ It sure is. Sorry, didn't realize the difference. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Logically/Selectively Sub Class?

2008-03-09 Thread Diez B. Roggisch
xkenneth schrieb: > Might be a silly question, but is it possible to selectively subclass, > IE subclass is a supporting module is present and not otherwise. Yes, something like this should work class Foo(some, base, classes) pass if condition: Temp = Foo class Foo(Temp, otherclass):

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread Diez B. Roggisch
> Perhaps similar technique the compiler uses to determine whether a > function is a normal function or a generator function? Positive > forward lookup for any soft exceptions, which would then activate > matching soft exceptions inside the code? The difference between generators and functions is

Re: Logically/Selectively Sub Class?

2008-03-09 Thread Diez B. Roggisch
xkenneth schrieb: > On Mar 9, 4:38 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> xkenneth schrieb: >> >>> Might be a silly question, but is it possible to selectively subclass, >>> IE subclass is a supporting module is present and not o

Re: __iter__ yield

2008-03-09 Thread Diez B. Roggisch
duccio schrieb: > > Hello! > Someone knows if it's possible to make this __iter__ function with just > one 'yield' intead of two? > Is there some simpler way to make this __iter__ iter through all nodes? > Thanks! > > class Node: > def __init__(self, data=None): > self.childs=[] >

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Diez B. Roggisch
Roopan wrote: > Hello! > > I am looking at developing an enterprise-grade distributed data > sharing application - key requirements are productivity and platform > portability. > > Will it be sensible to use C++ for performance-critical sections and > Python for all the glue logic. > > Pls comm

Re: defining a method that could be used as instance or static method

2008-03-10 Thread Diez B. Roggisch
gt; ...self.value = value > ...def comp(self, compValue): > ...return self.value == compValue.value >>> a = MyClass(3) >>> b = MyClass(4) >>> c = MyClass(3) >>> a.comp(b) > False >>> a.comp(c) > True > > This is actually ach

Re: What c.l.py's opinions about Soft Exception?

2008-03-10 Thread Diez B. Roggisch
ents follow. Regarding the number of callbacks: you can as well pass an object that has several methods to call. And the above example can easily be accomplished with "normal" exceptions, like this: def toplelevel(): def callback(a, b): if a == b: raise I

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Diez B. Roggisch
> > Java is more portable than most other languages, especially if your app needs > a gui. Depending on what GUI you want, python is at least as portable - Tkinter is available for lots of platforms. And swing as a GUI plain sucks - there is a reason for SWT. But that needs to be installed se

Re: What c.l.py's opinions about Soft Exception?

2008-03-10 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > On Mar 9, 2:21 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Is this soft-exception implemented anywhere, so that one can see what >> experiences and best practices have evolved around using it? > > Lie's idea is to sep

Re: What c.l.py's opinions about Soft Exception?

2008-03-11 Thread Diez B. Roggisch
Chris schrieb: > If all you wanted was some grouping of exceptions why not something > like... > > soft_exception_list = [IndexError, TypeError] > hard_exception_list = [ZeroDivision] > > try: > do_something() > except Exception, e: > if e.__class__ in soft_exception_list: > handl

Re: What c.l.py's opinions about Soft Exception?

2008-03-11 Thread Diez B. Roggisch
ree: > > def somefunc(a, b, callback = (DO_NOTHING, DO_NOTHING, DO_NOTHING, > DO_NOTHING)): > if a == 0: raise callback(0) > try: > a += b > except ZeroDivisionError: > raise callback(1) > if a <= 0: raise callback(2)

Re: Max File Size

2008-03-12 Thread Diez B. Roggisch
xkenneth wrote: > Is the max file size a relevant issue in python anymore? I know OS X > has a max file size of 8 exabytes and I'm not sure about the latest > version of Ubuntu. Does python have an independent file size limit, or > is it dependent upon the OS it was compiled on? The latter should

Re: Python - CGI - XML - XSD

2008-03-12 Thread Diez B. Roggisch
xkenneth wrote: > Hi All, > >Quick question. I've got an XML schema file (XSD) that I've > written, that works fine when my data is present as an XML file. > (Served out by apache2.) Now when I call python as a cgi script, and > tell it print out all of the same XML, also served up by apache2

Re: How to parse this timestamp?

2008-03-12 Thread Diez B. Roggisch
gnu.gcc.help schrieb: > I've got timestamps in a file that look like: > > [19-Aug-2007 07:38:43+216ms NZST] > > How can I parse them? I don't see any way to build a strftime() > format string that can handle the +216ms part. The best I can see is > tearing it all apart with a regex, but I'm tryi

Re: List mutation method gotcha - How well known?

2008-03-13 Thread Diez B. Roggisch
Hendrik van Rooyen wrote: > Hi, > > I am surprised that it took me so long to bloody my nose on this one. > > It must be well known - and I would like to find out how well known. > > So here is a CLOSED BOOK multiple choice question - no RTFM, > no playing at the interactive prompt: > > Given

Re: What's Going On?

2008-03-13 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > (Accompanied by Marvin Gaye) > def f(list=[0]): > ...list[0]+=1 > ...return list[0] > ... f() > 1 f() > 2 f() # 'list' is a name bound to a list (mutable) so this makes sense > 3 f([5]) > 6 f() # What's Going On? > 4 That the same d

Re: Python - CGI - XML - XSD

2008-03-13 Thread Diez B. Roggisch
> Sorry, it was really late when i wrote this post. The file is an XSL > file. It defines HTML depending on what appears in the XML document. Then the content-type might be the culprit, yes. But testing so would have been faster than waiting for answers here... Diez -- http://mail.python.org/ma

Re: wx and pil conversion

2008-03-13 Thread Diez B. Roggisch
azrael wrote: > A little problem. > > Can I directly show Pil objects "image.open("bla.jpg") in Wx or do I > have to transform them. > > If I have to transofm them How can I do it. Pixel by pixel or is there > somethin built in in pil or wx or python. > pilj->wx and wx->pil. PIL doesn't depend

Re: wx and pil conversion

2008-03-13 Thread Diez B. Roggisch
azrael wrote: > I thought of using Temp files but I am afraid of the JPG destorsion > while saving because of the compresion.I am looking for a way to > directly transform it. Then don't use JPEG, use PNG. It's lossless. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: getattr(foo, 'foobar') not the same as foo.foobar?

2008-03-13 Thread Diez B. Roggisch
se see this example: class Foo(object): def bar(self): pass f = Foo() a = Foo.bar b = f.bar c = f.bar print a, b, c print id(b), id(c) The result is this: > > 315560 788960 So b and c really are different objects - "a is not b == True" Diez -- http://mail

Re: Advantage of the array module over lists?

2008-03-16 Thread Diez B. Roggisch
sturlamolden schrieb: > On 13 Mar, 20:40, Tobiah <[EMAIL PROTECTED]> wrote: >> I checked out the array module today. It claims that >> arrays are 'efficient'. I figured that this must mean >> that they are faster than lists, but this doesn't seem >> to be the case: >> >> one.py #

Re: Immutable and Mutable Types

2008-03-17 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: >> >>> a = 1 >> >>> b = 1 >> >>> a is b >> True >> >>> id(a) >> 10901000 >> >>> id(b) >> 10901000 > > Isn't this because integers up to a certain range are held in a s

Re: Missing PyObject definition

2008-03-17 Thread Diez B. Roggisch
James Whetstone wrote: > I'm trying to access a PyObject directly from C++ for the purpose of > calling method on a Python object that is an intance of a derived C++ > class. My problem is that the compiler is complaining about not PyObject > not being > defined. Has anyone run into the problem?

Re: Convert binary file

2008-03-17 Thread Diez B. Roggisch
Vamp4L schrieb: > Hello, > Specifically, I'm trying to convert the Internet Explorer history > file (index.dat) into a readable format. Anyone done something > similar or know of any functions that may help with such a task? I'm > not sure exactly what kind of file the index.dat is, it is some

Re: method to create class property

2008-03-18 Thread Diez B. Roggisch
Joe P. Cool schrieb: > Hi, > > I like C#'s style of defining a property in one place. Can the > following way > to create a property be considered reasonable Python style (without > the > print statements, of course)? > > class sample(object): > def __init__(self): > sample.y = self.

Re: method to create class property

2008-03-18 Thread Diez B. Roggisch
Joe P. Cool schrieb: > On 18 Mrz., 21:59, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Joe P. Cool schrieb: >>> def _property_y(self): >>> def _get(self): >>> [...] >> There are a few recipies, like this:

Re: is hash map data structure available in Python?

2008-03-19 Thread Diez B. Roggisch
grbgooglefan schrieb: > Hi, > I have a situation that I need to search a name in a big list of names > in my Python embedded interpreter. I am planning to use hash map for > quicker search. > How do I create hash map in Python? > Can you please guide me to some documentation or tutorial which > pro

Re: method to create class property

2008-03-19 Thread Diez B. Roggisch
> Isn't that:: > > > > @propset(foo) > > def foo(self, value): > > self._value = value Yeah, you are right. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Script Request...

2008-03-19 Thread Diez B. Roggisch
some one wrote: > Hi all, I am not to familiar with python yet and I am wondering if > someone can write a script that will monitor my DSL modems IP address > and notify when it changes, its a 2Wire Advanced DSL Modem. I need to > know when it changes because I am trying to run my own inhouse ser

<    21   22   23   24   25   26   27   28   29   30   >