Re: Missing exceptions in PEP 3107

2008-08-16 Thread Carl Banks
On Aug 15, 3:42 pm, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: >  > IOW, there is currently no recommended way to do *anything* with >  > annotations(**).  That is entirely left up to users and third-party >  > packages, and the PEP goes out of its way to disclaim all author

Re: how to add property "dynamically"?

2008-08-16 Thread Larry Bates
akonsu wrote: hello, i need to add properties to instances dynamically during run time. this is because their names are determined by the database contents. so far i found a way to add methods on demand: class A(object) : def __getattr__(self, name) : if name == 'test' :

Re: Good python equivalent to C goto

2008-08-16 Thread Carl Banks
On Aug 17, 12:35 am, Michael Torrie <[EMAIL PROTECTED]> wrote: > However it's not necessary in python to do any of this, since you can > define nested functions that have access to the parent scope.  Anytime > you need to clean up, just call the nested cleanup function and then return. That is unn

Re: mmap and ctypes

2008-08-16 Thread castironpi
On Aug 16, 5:20 pm, castironpi <[EMAIL PROTECTED]> wrote: > On Aug 16, 4:42 pm, "Michel Claveau - NoSpam SVP ; merci" > > <[EMAIL PROTECTED]> wrote: > > Hi! > > > I use mmap for interchange data between Python & Autoit.  For that, I > > use (Autoit's side) a little DLL. > > This DLL can, perhaps

Re: Good python equivalent to C goto

2008-08-16 Thread Michael Torrie
Michael Torrie wrote: > I think the most direct translation would be this: Nevermind I forgot about the while loop and continuing on after it. Guess the function doesn't quite fit this use case after all. -- http://mail.python.org/mailman/listinfo/python-list

Re: Good python equivalent to C goto

2008-08-16 Thread Michael Torrie
Kurien Mathew wrote: > Hello, > > Any suggestions on a good python equivalent for the following C code: > > while (loopCondition) > { > if (condition1) > goto next; > if (condition2) > goto next; > if (condition3) > goto next; > st

Re: Good python equivalent to C goto

2008-08-16 Thread Michael Torrie
Dennis Lee Bieber wrote: > Nasty code even for C... I've never used goto in C... Options: > convert the statements of next into a function, and put in an else > clause... I think the parent post's pseudocode example was too simple to show the real benefits and use cases of goto in C. Obviou

Re: QT, ctypes dll and SEG Faults

2008-08-16 Thread sapsi
On Aug 16, 11:37 pm, sapsi <[EMAIL PROTECTED]> wrote: > Hello, > Below is a small class using ctypes and libspectre to read a > postscript file. > My program is a PyQT 4.4 application  and when the user clicks on a > entry in a QTableWidget, i run > > PostScriptImage( filename_as_contained_in_click

QT, ctypes dll and SEG Faults

2008-08-16 Thread sapsi
Hello, Below is a small class using ctypes and libspectre to read a postscript file. My program is a PyQT 4.4 application and when the user clicks on a entry in a QTableWidget, i run PostScriptImage( filename_as_contained_in_clicked_tableWidgetItem ) However on i get a segfault while trying docum

Re: sqlite empty inserts

2008-08-16 Thread sapsi
On Aug 16, 11:20 am, Peter Otten <[EMAIL PROTECTED]> wrote: > sapsi wrote: > > [please don't top-post] > > > > > Thank you for the tip, you're absolutely right.I;m getting an > > exception  that the name must not be null. However, this is some debug > > output > > --- logging.debug(" %s %s %s" %  (

Re: The Importance of Terminology's Quality

2008-08-16 Thread John W Kennedy
Martijn Lievaart wrote: On Thu, 14 Aug 2008 18:33:30 -0400, John W Kennedy wrote: Actually, I was thinking of the 1401. But both the 1620 and the 1401 (without the optional Advanced Programming Feature) share the basic omission of any instruction that could do call-and-return without hard-codin

Re: how to add property "dynamically"?

2008-08-16 Thread Christian Heimes
akonsu wrote: i am not an expert in python, would someone please tell me what i am doing wrong? You can't add properties to an instance. They must be specified on the type (aka new style class). Descriptors and magic methods are only looked up on classes for various reasons - mostly performan

how to add property "dynamically"?

2008-08-16 Thread akonsu
hello, i need to add properties to instances dynamically during run time. this is because their names are determined by the database contents. so far i found a way to add methods on demand: class A(object) : def __getattr__(self, name) : if name == 'test' : def f() : retur

Re: mmap and ctypes

2008-08-16 Thread castironpi
On Aug 16, 4:42 pm, "Michel Claveau - NoSpam SVP ; merci" <[EMAIL PROTECTED]> wrote: > Hi! > > I use mmap for interchange data between Python & Autoit.  For that, I > use (Autoit's side) a little DLL. > This DLL can, perhaps, be used with ctypes. > > @-salutations > -- > Michel Claveau Say more-

Re: The Importance of Terminology's Quality

2008-08-16 Thread Martijn Lievaart
On Thu, 14 Aug 2008 18:33:30 -0400, John W Kennedy wrote: > Actually, I was thinking of the 1401. But both the 1620 and the 1401 > (without the optional Advanced Programming Feature) share the basic > omission of any instruction that could do call-and-return without > hard-coding an adcon with the

Re: mmap and ctypes

2008-08-16 Thread Michel Claveau - NoSpam SVP ; merci
Hi! I use mmap for interchange data between Python & Autoit. For that, I use (Autoit's side) a little DLL. This DLL can, perhaps, be used with ctypes. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Good python equivalent to C goto

2008-08-16 Thread Christian Heimes
Kurien Mathew wrote: Hello, Any suggestions on a good python equivalent for the following C code: There are various ways to write your example in Python. For example while loopCondition: condition = 1 while condition: if condition1: break if condition2:

Re: Good python equivalent to C goto

2008-08-16 Thread Thomas Mlynarczyk
Kurien Mathew schrieb: Any suggestions on a good python equivalent for the following C code: while (loopCondition) { if (condition1) goto next; if (condition2) goto next; if (condition3) goto next; stmt1; stmt2; next: stmt3; stmt4; } while

Re: Good python equivalent to C goto

2008-08-16 Thread Fredrik Lundh
Kurien Mathew wrote: Any suggestions on a good python equivalent for the following C code: while (loopCondition) { if (condition1) goto next; if (condition2) goto next; if (condition3) goto next; stmt1; stmt2; next: stmt3; stmt4; } seems as

Re: Good python equivalent to C goto

2008-08-16 Thread Jean-Paul Calderone
On Sat, 16 Aug 2008 23:20:52 +0200, Kurien Mathew <[EMAIL PROTECTED]> wrote: Hello, Any suggestions on a good python equivalent for the following C code: while (loopCondition) { if (condition1) goto next; if (condition2) goto next; if (con

Good python equivalent to C goto

2008-08-16 Thread Kurien Mathew
Hello, Any suggestions on a good python equivalent for the following C code: while (loopCondition) { if (condition1) goto next; if (condition2) goto next; if (condition3) goto next; stmt1; stmt2; next:

Re: wxPython beginners problem

2008-08-16 Thread Ivan Reborin
On Fri, 15 Aug 2008 17:48:39 + (UTC), Brian Victor <[EMAIL PROTECTED]> wrote: >Ivan Reborin wrote: >> win.Show > >This line isn't doing anything. It needs to be: >win.Show() # note the parentheses Yes, that was the problem. I must've been tired while writing it, for I haven't noticed it aft

has anyone completed python for the absolute beginner ?

2008-08-16 Thread garywood
has anyone completed python for the absolute beginner ? chapter 7 in the book the trivia_challenge.py file does not work correctly and does not display all the correct questions - and even though the answer is correct it will still state the answer is wrong. this file is from the CD i have not

mmap and ctypes

2008-08-16 Thread castironpi
Hi all, I have a mmap and a data structure in it. I know the structure's location in the mmap and what structure it is. It has a ctypes definition. I want to initialize a ctypes object to point to a part of the mmap. Here is my attempt: >>> b >>> c= ctypes.pointer( b ) Traceback (most recent

Re: How to access an Array and a struct within a struct wrapped by Swig ?

2008-08-16 Thread Anish Chapagain
Hi, If you have struct defined in .h file then it's ok or can dea easyily with struct written with .i file, in .h file, struct def { int a; char name[10]; }; can be referenced as >>strvar=new_def() //now strvar is y

Re: wxPython beginners problem

2008-08-16 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Ivan Reborin <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm new to python, new as newbies get, so please, don't take wrongly > if this seems like a stupid or overly simple question. > > I'm going through examples in a book I have ("Beginning python", by > Hetlan

Re: sqlite empty inserts

2008-08-16 Thread Peter Otten
sapsi wrote: [please don't top-post] > Thank you for the tip, you're absolutely right.I;m getting an > exception that the name must not be null. However, this is some debug > output > --- logging.debug(" %s %s %s" % (vdbname, foldername,where_query)) > OUTPUT: TestVDB test_b title regexp 'tit'

Re: Dynamically defined functions via exec in imported module

2008-08-16 Thread Michele Simionato
On Aug 16, 4:02 pm, Maric Michaud <[EMAIL PROTECTED]> wrote: > I'd say that everywhere exec/eval are used in a application/function/lib that > doesn't mean to interpret arbitrary and user provided python code, it is a > bad usage Problem is, there are things you cannot do without exec/eval: for in

Re: Dynamically defined functions via exec in imported module

2008-08-16 Thread Michele Simionato
On Aug 16, 3:25 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Aug 16, 12:50 am, Michele Simionato <[EMAIL PROTECTED]> > wrote: > > The namedtuple recipe by Raymond Hetting does > > exactly that and, guess what, it uses exec! > > I might be wrong, but the reason namedtuple uses exec is performa

Re: Dynamically defined functions via exec in imported module

2008-08-16 Thread Maric Michaud
Le Saturday 16 August 2008 06:50:02 Michele Simionato, vous avez écrit : > On Aug 16, 4:48 am, Nadeem <[EMAIL PROTECTED]> wrote: > > I understand the 99% rule... the example I gave was to simplify the > > issue. The full thing I'm working on is a library for an introductory > > CS class I'm teachin

Re: Dynamically defined functions via exec in imported module

2008-08-16 Thread Fredrik Lundh
Nadeem wrote: I understand that all this can be done with classes and OO programming, but the whole point of the HtDP curriculum is to introduce students to programming in a pedagogically-effective way using a functional approach instead of OO-first. And yet, one of the HtDP authors just poste

Re: sqlite empty inserts

2008-08-16 Thread sapsi
I forgot to mention that i was creating a view just before this i.e sql="create view %s as %s" % (foldername, query) # self.cursor.execute(sql) self.cursor.execute(sql) Now if i remove this, the insert code works fine. Regards Saptarshi -- http://mail.python.org/mailman/listinfo/pytho

Re: Dynamically defined functions via exec in imported module

2008-08-16 Thread George Sakkis
On Aug 16, 12:50 am, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Aug 16, 4:48 am, Nadeem <[EMAIL PROTECTED]> wrote: > > > I understand the 99% rule... the example I gave was to simplify the > > issue. The full thing I'm working on is a library for an introductory > > CS class I'm teaching. I'

Re: PIL Question: Inverse of .load()?

2008-08-16 Thread Casey
On Aug 16, 3:53 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Casey wrote: > > I'm doing some image processing that requires accessing the individual > > pixels of the image. I'm using PIL 1.1.6 and creating a 2D array of > > pixel RGB tuples using the Image class instance load() method. > > load

Re: Confused: looking for a simple XML parser

2008-08-16 Thread Kay Schluehr
On 16 Aug., 02:21, Rex <[EMAIL PROTECTED]> wrote: > Hello, > > I am a Python programmer facing my first small XML project. I am > looking to find a simple tool to take an XSD file and convert the XSD > tree structure to another text format (e.g. an adjacency matrix for > the tree's graph), or conve

Re: sqlite empty inserts

2008-08-16 Thread sapsi
Hi, Thank you for the tip, you're absolutely right.I;m getting an exception that the name must not be null. However, this is some debug output --- logging.debug(" %s %s %s" % (vdbname, foldername,where_query)) OUTPUT: TestVDB test_b title regexp 'tit' --- print vdbname.__class__, foldername.__cl

Re: Parsing and Editing Source

2008-08-16 Thread Wilson
On Aug 16, 3:51 am, Benjamin <[EMAIL PROTECTED]> wrote: > On Aug 15, 9:21 am, "Paul Wilson" <[EMAIL PROTECTED]> wrote: > > > > > Hi all, > > > I'd like to be able to do the following to a python source file > > programmatically: > >  * Read in a source file > >  * Add/Remove/Edit Classes, methods,

Re: How to access an Array and a struct within a struct wrapped by Swig ?

2008-08-16 Thread emmanuel . rivoire
Ok, Swig needs the structure to be declared like this : typedef struct SIn { int in1, in2; } SIn; Else, it doesn't understand it's a structure... :-S Now, I can write to it. I also found out that Swig didn't allow to write to the array : http://www.swig.org/Doc1.3/SWIG.html#SWIG_nn34 ...

Re: urllib getting SSL certificate info

2008-08-16 Thread Ghirai
On Saturday 16 August 2008 12:16:14 Fredrik Lundh wrote: > Ghirai wrote: > > Using urllib, is there any way i could access some info about the SSL > > certificate (when opening a https url)? > > > > I'm really interested in the fingerprint. > > > > I haven't been able to find anything so far. > > y

How to access an Array and a struct within a struct wrapped by Swig ?

2008-08-16 Thread emmanuel . rivoire
Hello, I spent almost a week to be able to embed Python within my C++ game engine. I wrote a mini-tutorial of what I was able to do so far here : http://forums.indiegamer.com/showpost.php?p=169352&postcount=9 At the end of my tutorial, I wrote : "You can do the same with C++ classes, and with str

Re: urllib getting SSL certificate info

2008-08-16 Thread Fredrik Lundh
Ghirai wrote: Using urllib, is there any way i could access some info about the SSL certificate (when opening a https url)? I'm really interested in the fingerprint. I haven't been able to find anything so far. you can get some info via (undocumented?) attributes on the file handle: >>> im

any success in compiling mod_python3.3 on cygwin for apache2.2

2008-08-16 Thread Edwin . Madari
has any one out there succeeded in compiling/installing mod_python for apache2 and python 2.5. I am using python 2.5 on cygwin. thanks in advance Edwin The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work produc

urllib getting SSL certificate info

2008-08-16 Thread Ghirai
Hello list, Using urllib, is there any way i could access some info about the SSL certificate (when opening a https url)? I'm really interested in the fingerprint. I haven't been able to find anything so far. Any help is appreciated. -- Regards, Ghirai. -- http://mail.python.org/mailman/list

Registry and Spyware Cleaner - Free

2008-08-16 Thread GE HOME ALARMS
Netcom3™ is a recognized global leader in internet security software. With Netcom3 Internet Security Suite, it's key focus is on securing sensitive consumer online interactions, as well as prevent and remove Spyware, Adware, optimize, fix PC errors, and make your system run faster and error free. N

Re: PIL Question: Inverse of .load()?

2008-08-16 Thread Fredrik Lundh
Casey wrote: I'm doing some image processing that requires accessing the individual pixels of the image. I'm using PIL 1.1.6 and creating a 2D array of pixel RGB tuples using the Image class instance load() method. load returns an access object that's attached to the image; to modify the ima

Re: You advice please

2008-08-16 Thread Sonolin
On Aug 13, 4:14 am, Hussein B <[EMAIL PROTECTED]> wrote: > Hey, > I'm a Java/Java EE developer and I'm playing with Python these days. > I like the Python language so much and I like its communities and the > Django framework. > My friends are about to open a Ruby/Rails shop and they are asking me