ANN: PyCon UK Talks and Tutorials List Up

2008-07-29 Thread Fuzzyman
PyCon UK 2008 is the second PyCon event in the UK, and is being held on 12th to 14th September at the Birmingham Conservatoire. The conference starts with a day of tutorials on the Friday. The timetable for the tutorials day has now been published: http://www.pyconuk.org/timetable.html

Re: seemingly simple list indexing problem

2008-07-29 Thread iu2
On Jul 29, 3:59 am, John Machin [EMAIL PROTECTED] wrote: On Jul 29, 8:10 am, John Krukoff [EMAIL PROTECTED] wrote: On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: My programming skills are pretty rusty and I'm just learning Python so this problem is giving me trouble. I

Re: interpreter vs. compiled

2008-07-29 Thread Tim Roberts
castironpi [EMAIL PROTECTED] wrote: In CPython yes. In IronPython yes: the parts that are compiled into machine code are the interpreter, *not user's code*. WRONG! You are WRONG. At compile time, the Python code is compiled to an intermediate language. At run time, the intermediate

Re: seemingly simple list indexing problem

2008-07-29 Thread iu2
On Jul 29, 2:26 am, John Krukoff [EMAIL PROTECTED] wrote: On Mon, 2008-07-28 at 16:00 -0700, iu2 wrote: On Jul 29, 12:10 am, John Krukoff [EMAIL PROTECTED] wrote: On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: My programming skills are pretty rusty and I'm just learning Python so

Re: Is it allowed to use function results as default arguments ?

2008-07-29 Thread Terry Reedy
To answer the subject line: param=any expression that can be evaluated when the function is defined will assign the result of the expression as the default argument object for the parameter. tjr -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing different versions of a module

2008-07-29 Thread henning . vonbargen
Why not set up PYTHONPATH together with other environment variables in a shell script (bash, or CMD on Windows) and call that shell script instead of your Python script directly? This is probably the easiest and still a very powerful and generic solution for this kind of problem. We do it that

Python COM

2008-07-29 Thread birdprince
I have implemented a COM in C++,buy i don't know how to use this COM in python. For example: the COM's ProgID is MyCOM1.AdvMethod.this COM have two interfaces,the default interface's name is IAdvMethod,the second interface's name is IBasicMethod. How do i use those interfaces in python.Thank you

Re: Python COM

2008-07-29 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: I have implemented a COM in C++,buy i don't know how to use this COM in python. For example: the COM's ProgID is MyCOM1.AdvMethod.this COM have two interfaces,the default interface's name is IAdvMethod,the second interface's name is IBasicMethod. How do i use those

Re: block/lambda

2008-07-29 Thread Duncan Booth
iu2 [EMAIL PROTECTED] wrote: Is it possible to grant Python another syntactic mark, similar to triple quotes, that will actually make the enclosed code a compiled code, or an anonymous function? Yes, the syntactic mark you are looking for is 'def'. Your example becomes: def dotimes(n,

Re: Is it allowed to use function results as default arguments ?

2008-07-29 Thread Stef Mientki
Terry Reedy wrote: To answer the subject line: param=any expression that can be evaluated when the function is defined will assign the result of the expression as the default argument object for the parameter. thanks Terry and others, brings me to one other question: I guess this function

Re: multiple inheritance and __getattr__

2008-07-29 Thread Enrico
Bruno Desthuilliers [EMAIL PROTECTED] ha scritto nel messaggio news:[EMAIL PROTECTED] Indeed. You explicitely raise, so the lookup stops here. You'd need to explicitely call on superclass instead to have B.__getattr__ called, ie: class A(object): def __getattr__(self, name): if

Re: xlrd: error open_workbook

2008-07-29 Thread M.-A. Lemburg
On 2008-07-28 22:22, Fabio Oikawa wrote: Hello. I am trying to open an .xls (excel) file using xlrd, but an error message occurs when I open the workbook. I can open any other .xls file made by myself (either by MS Excel 2003 SP3 in Windows Vista or by OpenOffice 2.0 in Debian) using the

Re: Attack a sacred Python Cow

2008-07-29 Thread Nikolaus Rath
Bruno Desthuilliers [EMAIL PROTECTED] writes: Nikolaus Rath a écrit : Michael Torrie [EMAIL PROTECTED] writes: (snip) In short, unlike what most of the implicit self advocates are saying, it's not just a simple change to the python parser to do this. It would require a change in the

Re: Questions on 64 bit versions of Python (Thank-you!)

2008-07-29 Thread Tim Golden
[EMAIL PROTECTED] wrote: Thanks for everyone's feedback - excellent detail - all my questions have been answered. BTW: Roel was correct that I got confused over the AMD and Intel naming conventions regarding the 64 bit versions of Python for Windows. (I missed that nuance that the Intel build

Re: Is it allowed to use function results as default arguments ?

2008-07-29 Thread Steven D'Aprano
On Tue, 29 Jul 2008 09:43:26 +0200, Stef Mientki wrote: about '.' being the current directory, well I think windows was thrown at the market about 25 years ago, and since then we don't use '.' anymore ;-) No, even Windows uses '.' as the current directory -- at least XP does, I haven't tried

ironpython, exception in mscorlib when reading .py file from network share

2008-07-29 Thread mindmind
Hello, I have a ironpython 1.1.1.0 host in my c# app, and When doing a engine.ExecuteFile(file); i often get the error below, when file is on a network share : (winXp client , windows ??? server) 21-07-2008 12:47:28 : Traceback (most recent call last): 21-07-2008 12:47:28 : File

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Carl Banks
On Jul 28, 8:15 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Mon, 28 Jul 2008 13:22:37 -0700, Carl Banks wrote: On Jul 28, 10:00 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: Cutting to the crux of the discussion... On Sun, 27 Jul 2008 23:45:26

Re: exec(code) not allowing import on top level?

2008-07-29 Thread Steven D'Aprano
On Tue, 29 Jul 2008 03:26:45 +, Peter Teuben wrote: if I define a simple string code, with the following contents: import math def foo(x): return math.sqrt(x) and i run it using exec(code) in python, math is not known. Works for me. code = import math ... def foo(x): ...

Re: multiple inheritance and __getattr__

2008-07-29 Thread Maric Michaud
Le Monday 28 July 2008 16:48:09 Enrico, vous avez écrit : Hi there, I have the following situation (I tryed to minimize the code to concentrate on the issue): class A(object): def __getattr__(self, name): print 'A.__getattr__' if name == 'a': return 1 raise AttributeError('%s not

Re: ironpython, exception in mscorlib when reading .py file from network share

2008-07-29 Thread Fuzzyman
On Jul 29, 9:34 am, mindmind [EMAIL PROTECTED] wrote: Hello, I have a ironpython 1.1.1.0 host in my c# app, and When doing a   engine.ExecuteFile(file); i often get the error below, when file is on a network share : (winXp client , windows ??? server) 21-07-2008 12:47:28 : Traceback (most

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Heiko Wundram
Am Dienstag, 29. Juli 2008 10:37:45 schrieb Carl Banks: You keep bringing up this notion of more complex with no benefit, which I'm simply not interested in talking about that at this time, and I won't respond to any of your points. I am seeking the answer to one question: whether if x can

Re: Attack a sacred Python Cow

2008-07-29 Thread Iain King
On Jul 29, 5:33 am, Russ P. [EMAIL PROTECTED] wrote: On Jul 28, 8:44 pm, alex23 [EMAIL PROTECTED] wrote: On Jul 29, 4:46 am, Russ P. [EMAIL PROTECTED] wrote: As I said, I could write a pre-processor myself to implement it in less than a day. So WHY DON'T YOU WRITE IT ALREADY? I'm

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Steven D'Aprano
On Tue, 29 Jul 2008 01:37:45 -0700, Carl Banks wrote: On Jul 28, 8:15 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Mon, 28 Jul 2008 13:22:37 -0700, Carl Banks wrote: On Jul 28, 10:00 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: Cutting to the crux

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Anders J. Munch
Steven D'Aprano wrote: On Tue, 29 Jul 2008 00:23:02 +, Steven D'Aprano wrote: Dude. Dude. Just... learn some Python before you embarrass yourself further. I'm sorry Anders, that was a needlessly harsh thing for me to say. I apologize for the unpleasant tone. Still, __nonzero__ is a

Re: block/lambda

2008-07-29 Thread iu2
On Jul 29, 9:36 am, Duncan Booth [EMAIL PROTECTED] wrote: iu2 [EMAIL PROTECTED] wrote: Is it possible to grant Python another syntactic mark, similar to triple quotes, that will actually make the enclosed code a compiled code, or an anonymous function? Yes, the syntactic mark you are

Re: ctypes and how to copy data passed to callback

2008-07-29 Thread waldek
On Jul 28, 4:03 pm, Thomas Heller [EMAIL PROTECTED] wrote: waldek schrieb: Hi, I'm trying to handle data passed to Py Callback which is called from C dll. Callback passes data to another thread using Queue module and there the data are printed out. If data is printed out in a

Re: Download excel file from web?

2008-07-29 Thread Guilherme Polo
On Tue, Jul 29, 2008 at 1:47 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jul 28, 6:05 pm, Guilherme Polo [EMAIL PROTECTED] wrote: On Mon, Jul 28, 2008 at 9:39 PM, MRAB [EMAIL PROTECTED] wrote: On Jul 29, 12:41 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jul 28, 4:20 pm, Guilherme

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Heiko Wundram
Am Dienstag, 29. Juli 2008 11:15:05 schrieb Heiko Wundram: I can't dig up a simple example from code I wrote quickly... Just to get back to that: an example I found where if x (the generic __nonzero__() test) will work to test for emptiness/non-emptiness of a container, whereas if len(x) 0

Swap memory in Python ? - three questions

2008-07-29 Thread Robert LaMarca
Hi, I am using numpy and wish to create very large arrays. My system is AMD 64 x 2 Ubuntu 8.04. Ubuntu should be 64 bit. I have 3gb RAM and a 15 GB swap drive. The command I have been trying to use is; g=numpy.ones([1000,1000,1000],numpy.int32) This returns a memory error. A smaller

SWIG and char* newb questions :)

2008-07-29 Thread code_berzerker
Hi i'm relatively new to Python and my C/C++ knowledge is near to None. Having said that I feel justified to ask stupid questions :) Ok now more seriously. I have question refering to char* used as function parameters to return values. I have read SWIG manual to find best way to overcome that,

Re: SWIG and char* newb questions :)

2008-07-29 Thread Heiko Wundram
Am Dienstag, 29. Juli 2008 12:51:36 schrieb code_berzerker: Ok now more seriously. I have question refering to char* used as function parameters to return values. I have read SWIG manual to find best way to overcome that, but there are many warnings about memory leaks and stuff, so I feel

Re: ironpython, exception in mscorlib when reading .py file from network share

2008-07-29 Thread mindmind
I don't know the answer - I do know that .NET permissions issues and accessing network resources are a bit 'weird'. You're likely to get an answer if you ask on the IronPython mailing list. I had it running through the night, ~100 times, 25 of these gave the above exception. Hard to see any

Questions about asyncore

2008-07-29 Thread Frank Millman
Hi all I have been using my own home-brewed client/server technique for a while, using socket and select. It seems to work ok. The server can handle multiple clients. It does this by creating a new thread for each connection. Each thread runs its own select loop. I am making some fairly big

Re: Python COM

2008-07-29 Thread M�ta-MCI (MVP)
Hi! Example, with Pywin32: import win32com.client moncom = win32com.client.Dispatch('MyCOM1.AdvMethod') moncom.IAdvMethod(... See Pywin32 here: http://sourceforge.net/projects/pywin32/ @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Python COM

2008-07-29 Thread Diez B. Roggisch
M�ta-MCI (MVP) wrote: Hi! Example, with Pywin32: import win32com.client moncom = win32com.client.Dispatch('MyCOM1.AdvMethod') moncom.IAdvMethod(... See Pywin32 here: http://sourceforge.net/projects/pywin32/ That's not working, because the OP has a custom interface, not

Re: method decorators and more on decorators

2008-07-29 Thread Themis Bourdenas
On Mon, Jul 28, 2008 at 11:12 AM, Gabriel Genellina [EMAIL PROTECTED]wrote: En Sun, 27 Jul 2008 15:26:39 -0300, Themistoklis Bourdenas [EMAIL PROTECTED] escribió: On a related note, as the actual instance method of myclass is not foo but decorate(foo), why are they called method

Re: exec(code) not allowing import on top level?

2008-07-29 Thread Peter Otten
Peter Teuben wrote: if I define a simple string code, with the following contents: import math def foo(x): return math.sqrt(x) The import math statement puts 'math' in the local namespace, and foo looks it up in the global namespace. This can only work when these namespaces are

Re: interpreter vs. compiled

2008-07-29 Thread alex23
On Jul 29, 2:21 pm, castironpi [EMAIL PROTECTED] wrote: On Jul 28, 5:58 pm, Fuzzyman [EMAIL PROTECTED] wrote: Well - in IronPython user code gets compiled to in memory assemblies which can be JIT'ed. I don't believe so. Uh, you're questioning someone who is not only co-author of a book on

Re: SWIG and char* newb questions :)

2008-07-29 Thread code_berzerker
Ok I think I got it: PyObject* myFuncXXX(char* p_1, int p_2, char* p_3, int p_4) { int res; char _host[255] = ; int _port; res = funcXXX(p_1, p_2, p_3, p_4, _host, _port); PyObject* res1 = PyInt_FromLong(res); PyObject* res2 = PyString_FromStringAndSize(_host, strlen(_host));

Re: Swap memory in Python ? - three questions

2008-07-29 Thread Scott David Daniels
Robert LaMarca wrote: Hi, I am using numpy and wish to create very large arrays. My system is AMD 64 x 2 Ubuntu 8.04. Ubuntu should be 64 bit. I have 3gb RAM and a 15 GB swap drive. The command I have been trying to use is; g=numpy.ones([1000,1000,1000],numpy.int32) This returns a

Re: Simplify Code

2008-07-29 Thread Victor Subervi
Thanks. That worked. Victor On 7/16/08, Alexandr N Zamaraev [EMAIL PROTECTED] wrote: header_sizes = (36, 26, 22, 18, 14, 12) if x not in header_sizes: raise Exception() else: h36, h26, h22, h18, h14, h12 = tuple( line if x == size else '' for x in header_sizes) --

Windows Interpreter

2008-07-29 Thread Victor Subervi
Hi: I would like to make my windows python interpreter work like my linux one. I want to be able to cut and paste multiple lines of code. Now I can only paste one line at a time. I do not want it to indent automatically. How can I change this? TIA, Victor --

RTF Parsing

2008-07-29 Thread Victor Subervi
Hi; I have this code: def a(): chars = ['\\i0', '\\u0', '\\qc', '\\b0', '\\ql', '\\i', '\\u', '\\b', '\\yz'] rtf_markup = 'viewkind4\uc1\pard\nowidctlpar\qc\i\f0\fs36 Who is like the Beast? Who can wage war against him?\par' for char in chars: c = '(?=' + char + ')' test = re.search(c,

Re: Windows Interpreter

2008-07-29 Thread Tim Golden
Victor Subervi wrote: Hi: I would like to make my windows python interpreter work like my linux one. I want to be able to cut and paste multiple lines of code. You can already do this: what are you trying which isn't working? Now I can only paste one line at a time. I do not want it to

Re: Boolean tests

2008-07-29 Thread Ben Finney
Anders J. Munch [EMAIL PROTECTED] writes: Steven D'Aprano wrote: I'm sorry Anders, that was a needlessly harsh thing for me to say. I apologize for the unpleasant tone. Still, __nonzero__ is a fundamental part of Python's behaviour. You should learn about it. Hm, first you

Re: Windows Interpreter

2008-07-29 Thread Victor Subervi
def a(): chars = ['\\i0', '\\u0', '\\qc', '\\b0', '\\ql', '\\i', '\\u', '\\b', '\\yz'] rtf_markup = 'viewkind4\uc1\pard\nowidctlpar\qc\i\f0\fs36 Who is like the Beast? Who can wage war against him?\par' for char in chars: c = '(?=' + char + ')' test = re.search(c, rtf_markup)

backspace problems

2008-07-29 Thread kj
If I'm in the python interactive interpreter, I get a beep when I hit the backspace key. I must confess, though, that my terminal is complicated, to put it mildly: I work on a Mac running Leopard; I open a Terminal session, and through it I ssh to an Ubuntu server; on this server I connect to a

Defunct when using subprocess.Popen

2008-07-29 Thread Gordon Maria
Title: Defunct when using subprocess.Popen Hi! I hope someone can help me out here! I'm running a GUI in python which is able to launch a separate python process that will run forever. In rare cases I will want to kill the launched process. Every time I do so, I end up with the process as

Defunct when using subprocess.Popen

2008-07-29 Thread Gordon Maria
Title: Defunct when using subprocess.Popen Hi! I hope someone can help me out here! I'm running a GUI in python which is able to launch a separate python process that will run forever. In rare cases I will want to kill the launched process. Every time I do so, I end up with the process

Re: Windows Interpreter

2008-07-29 Thread Tim Golden
Victor Subervi wrote: def a(): chars = ['\\i0', '\\u0', '\\qc', '\\b0', '\\ql', '\\i', '\\u', '\\b', '\\yz'] rtf_markup = 'viewkind4\uc1\pard\nowidctlpar\qc\i\f0\fs36 Who is like the Beast? Who can wage war against him?\par' for char in chars: c = '(?=' + char + ')' test =

Re: Swap memory in Python ? - three questions

2008-07-29 Thread Marc Christiansen
Robert LaMarca [EMAIL PROTECTED] wrote: Hi, I am using numpy and wish to create very large arrays. My system is AMD 64 x 2 Ubuntu 8.04. Ubuntu should be 64 bit. I have 3gb RAM and a 15 GB swap drive. The command I have been trying to use is;

Re: Questions about asyncore

2008-07-29 Thread Giampaolo Rodola'
On 29 Lug, 13:09, Frank Millman [EMAIL PROTECTED] wrote: Firstly, having got asyncore working, I had a look at asynchat. As far as I can see I get very little benefit from using it. I have already set up a 'messaging' protocol between server and client, where all messages consist of 5 digits

Re: backspace problems

2008-07-29 Thread kj
In [EMAIL PROTECTED] kj [EMAIL PROTECTED] writes: snip Please ignore my question. I found a general solution that works not only for the python interactive interpreter but also for all programs that have a readline-type interaction. This solution has nothing to do with Python, but if anyone's

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Colin J. Williams
Heiko Wundram wrote: Am Dienstag, 29. Juli 2008 11:15:05 schrieb Heiko Wundram: I can't dig up a simple example from code I wrote quickly... Just to get back to that: an example I found where if x (the generic __nonzero__() test) will work to test for emptiness/non-emptiness of a container,

pygtk treview, ListStore not displaying properly

2008-07-29 Thread binaryjesus
hi group i am running into a problem with gtk. i have a treeview that just displays tabular data (no down arrows or trees etc). it has 5 columns. The tiny problem i am having is that it is just display the data of the column named `title` in all the colums! here the pic of the app in action

Re: Automatically loading and initialising objects from a plugins directory

2008-07-29 Thread kpd
On Jul 25, 7:50 am, Fredrik Lundh [EMAIL PROTECTED] wrote: It's a potentially brain-exploding topic, -that you made very understandable. Thanks for posting that explanation and example. -- http://mail.python.org/mailman/listinfo/python-list

Re: block/lambda

2008-07-29 Thread [EMAIL PROTECTED]
2. Will it be possible in Python 3.0 to do the following: def dotimes(n, callable):         for i in range(n): callable() def block():         nonlocal i         for j in range(i):                 print j,         print dotimes seems ok and what is wrong with that function block?

[unittest] Run setUp only once

2008-07-29 Thread Nikolaus Rath
Hello, I have a number of conceptually separate tests that nevertheless need a common, complicated and expensive setup. Unfortunately, unittest runs the setUp method once for each defined test, even if they're part of the same class as in class TwoTests(unittest.TestCase): def setUp(self):

Re: block/lambda

2008-07-29 Thread Jean-Paul Calderone
On Tue, 29 Jul 2008 07:26:38 -0700 (PDT), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: 2. Will it be possible in Python 3.0 to do the following: def dotimes(n, callable): for i in range(n): callable() def block(): nonlocal i for j in range(i): print

Re: [unittest] Run setUp only once

2008-07-29 Thread Jean-Paul Calderone
On Tue, 29 Jul 2008 16:35:55 +0200, Nikolaus Rath [EMAIL PROTECTED] wrote: Hello, I have a number of conceptually separate tests that nevertheless need a common, complicated and expensive setup. Unfortunately, unittest runs the setUp method once for each defined test, even if they're part of

Continuous integration for Python projects

2008-07-29 Thread Hussein B
Hi. Please correct my if I'm wrong but it seems to me that the major continuous integration servers (Hudson, CruiseControl, TeamCity ..) don't support Python based application. It seems they mainly support Java, .NET and Ruby. Can I use one of the previous listed servers for Python project?

How do I include a shell variable in my script?

2008-07-29 Thread laredotornado
Hi, I'm running a Python script on a Solaris 9 machine, invoking the Python script from ksh, if that matters. There is an enviornment variable, $JAVA_HOME, that I would like to include in my script, replacing /path/to/java/home' with the value of $JAVA_HOME. java_home='/path/to/java/home' How

Re: Continuous integration for Python projects

2008-07-29 Thread Diez B. Roggisch
Hussein B wrote: Hi. Please correct my if I'm wrong but it seems to me that the major continuous integration servers (Hudson, CruiseControl, TeamCity ..) don't support Python based application. It seems they mainly support Java, .NET and Ruby. Can I use one of the previous listed servers

Re: Continuous integration for Python projects

2008-07-29 Thread Jean-Paul Calderone
On Tue, 29 Jul 2008 07:47:35 -0700 (PDT), Hussein B [EMAIL PROTECTED] wrote: Hi. Please correct my if I'm wrong but it seems to me that the major continuous integration servers (Hudson, CruiseControl, TeamCity ..) don't support Python based application. It seems they mainly support Java, .NET

Re: How do I include a shell variable in my script?

2008-07-29 Thread Jerry Hill
On Tue, Jul 29, 2008 at 10:53 AM, laredotornado [EMAIL PROTECTED] wrote: Hi, I'm running a Python script on a Solaris 9 machine, invoking the Python script from ksh, if that matters. There is an enviornment variable, $JAVA_HOME, that I would like to include in my script, replacing

Build tool for Python

2008-07-29 Thread Hussein B
Hi. Apache Ant is the de facto building tool for Java (whether JSE, JEE and JME) application. With Ant you can do what ever you want: compile, generate docs, generate code, packing, deploy, connecting to remote servers and every thing. Do we have such a tool for Python projects? Thank you. --

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Matthew Fitzgibbons
Carl Banks wrote: On Jul 28, 8:15 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Mon, 28 Jul 2008 13:22:37 -0700, Carl Banks wrote: On Jul 28, 10:00 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: Cutting to the crux of the discussion... On Sun, 27 Jul 2008

Re: Build tool for Python

2008-07-29 Thread Diez B. Roggisch
Hussein B wrote: Hi. Apache Ant is the de facto building tool for Java (whether JSE, JEE and JME) application. With Ant you can do what ever you want: compile, generate docs, generate code, packing, deploy, connecting to remote servers and every thing. Do we have such a tool for Python

Overloaded Functions

2008-07-29 Thread Tim Henderson
Hi, So this may have been asked before but i haven't found the answer by googling so far. My situation is this: I want this structure for my code: @overloaded def sign_auth(secret, salt, auth_normalized): return __sign_auth(saltedhash_bin(secret, salt), auth_normalized)

DB access without object-relation mapping?

2008-07-29 Thread kj
Python noob here. I want to write a script that creates and populates a simple Postgres database. The word on the street is to use something like SQLAlchemy for database access in Python, but my experience in the past with packages that perform automated SQL generation has been awful, so I

Re: Build tool for Python

2008-07-29 Thread Tim Henderson
On Jul 29, 11:08 am, Hussein B [EMAIL PROTECTED] wrote: Hi. Apache Ant is the de facto building tool for Java (whether JSE, JEE and JME) application. With Ant you can do what ever you want: compile, generate docs, generate code, packing, deploy, connecting to remote servers and every thing.

Re: DB access without object-relation mapping?

2008-07-29 Thread Tim Henderson
On Jul 29, 11:20 am, kj [EMAIL PROTECTED] wrote: Python noob here. I want to write a script that creates and populates a simple Postgres database. The word on the street is to use something like SQLAlchemy for database access in Python, but my experience in the past with packages that

Re: Execution speed question

2008-07-29 Thread Suresh Pillai
On Mon, 28 Jul 2008 16:48:28 +0200, Suresh Pillai wrote: Okay, please consider this my one absolutely stupid post for the year. I'd like to pretend it never happened but unfortunately the web doesn't allow that. Having never used sets, I unfort read something that lead to it, but ... Okay,

Re: Parsing VHDL with python, where to start.

2008-07-29 Thread Wolfgang Grafen
Svenn Are Bjerkem schrieb: Hi again, when I get far enough to parse the VHDL (which is not currently the fact, but I have to look at the work coming up downstream) I will have to put it into an internal data structure and then write some classes to handle the MVC between whatever data I have

Re: pygtk treview, ListStore not displaying properly

2008-07-29 Thread binaryjesus
finally i solved it. This for any googler who comes this way def show_sync_wind(self,obj, data = None): t = Template.select(Template.q.synced == '0') self.synclstore = gtk.ListStore(str,str,str,str,str) x = 0 cr =

Public Pythn Classs, September 9, 2008

2008-07-29 Thread Steve Holden
Holden Web is please to announce its third public Introduction to Python class, near Washington DC, from September 9-11. Further details are available from http://holdenweb.com/py/training/ We are also interested in adding to our course repertoire. If you have ideas for suitable one-day

Re: multiple inheritance and __getattr__

2008-07-29 Thread David C. Ullrich
In article [EMAIL PROTECTED], Bruno Desthuilliers [EMAIL PROTECTED] wrote: Enrico a écrit : Hi there, I have the following situation (I tryed to minimize the code to concentrate on the issue): class A(object): def __getattr__(self, name): print 'A.__getattr__' if name ==

Re: Is it allowed to use function results as default arguments ?

2008-07-29 Thread Grant Edwards
On 2008-07-29, Stef Mientki [EMAIL PROTECTED] wrote: brings me to one other question: I guess this function is only evaluated once, is that correct ? Yes. about '.' being the current directory, well I think windows was thrown at the market about 25 years ago, and since then we don't use

Re: Overloaded Functions

2008-07-29 Thread Gary Herron
Tim Henderson wrote: Hi, So this may have been asked before but i haven't found the answer by googling so far. My situation is this: I want this structure for my code: @overloaded def sign_auth(secret, salt, auth_normalized): return __sign_auth(saltedhash_bin(secret, salt),

Re: DB access without object-relation mapping?

2008-07-29 Thread Paul Boddie
On 29 Jul, 17:20, kj [EMAIL PROTECTED] wrote:  So what's the standard Python way to send SQL directly to a Postgres database and get back results? Take a look at this page: http://wiki.python.org/moin/DatabaseInterfaces I've used psycopg2

Re: Overloaded Functions

2008-07-29 Thread Tim Henderson
Yes i am aware of that but I want the code to be self documenting, so the intent is clear. I actually have an implementation using that style which you suggest. I would like cleaner style, like the one i suggested in my first post. Cheers Tim Henderson --

proxy class and __add__ method

2008-07-29 Thread Magnus Schuster
Hello, I have written the following small proxy class which I expect to pass all function calls to the 'original' object: --- BEGIN --- class proxy(object): def __init__( self, subject ): self.__subject = subject def __getattr__( self, name ): return getattr(

Re: Build tool for Python

2008-07-29 Thread Paul Boddie
On 29 Jul, 17:08, Hussein B [EMAIL PROTECTED] wrote: Apache Ant is the de facto building tool for Java (whether JSE, JEE and JME) application. With Ant you can do what ever you want: compile, generate docs, generate code, packing, deploy, connecting to remote servers and every thing. Do we

Re: Execution speed question

2008-07-29 Thread Diez B. Roggisch
Suresh Pillai wrote: On Mon, 28 Jul 2008 16:48:28 +0200, Suresh Pillai wrote: Okay, please consider this my one absolutely stupid post for the year. I'd like to pretend it never happened but unfortunately the web doesn't allow that. Having never used sets, I unfort read something that lead

Re: Continuous integration for Python projects

2008-07-29 Thread Sion Arrowsmith
Diez B. Roggisch [EMAIL PROTECTED] wrote: Hussein B wrote: Please correct my if I'm wrong but it seems to me that the major continuous integration servers (Hudson, CruiseControl, TeamCity ..) don't support Python based application. It seems they mainly support Java, .NET and Ruby. Can I use

Re: Windows Interpreter

2008-07-29 Thread Victor Subervi
I´ll try that. Back online in a week. Victor On 7/29/08, Tim Golden [EMAIL PROTECTED] wrote: Victor Subervi wrote: def a(): chars = ['\\i0', '\\u0', '\\qc', '\\b0', '\\ql', '\\i', '\\u', '\\b', '\\yz'] rtf_markup = 'viewkind4\uc1\pard\nowidctlpar\qc\i\f0\fs36 Who is like the Beast? Who

Re: DB access without object-relation mapping?

2008-07-29 Thread kj
In [EMAIL PROTECTED] Tim Henderson [EMAIL PROTECTED] writes: I believe there are a couple of options but pyscopg, and PyGreSQL seem to be popular. Great. Thanks! kynn -- NOTE: In my address everything before the first period is backwards; and the last period, and everything after it, should

Re: [unittest] Run setUp only once

2008-07-29 Thread Nikolaus Rath
Jean-Paul Calderone [EMAIL PROTECTED] writes: On Tue, 29 Jul 2008 16:35:55 +0200, Nikolaus Rath [EMAIL PROTECTED] wrote: Hello, I have a number of conceptually separate tests that nevertheless need a common, complicated and expensive setup. Unfortunately, unittest runs the setUp method once for

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Carl Banks
On Jul 29, 5:27 am, Steven D'Aprano [EMAIL PROTECTED] wrote: On Tue, 29 Jul 2008 01:37:45 -0700, Carl Banks wrote: I am looking for one that can't. If you are writing code that needs to do the right thing with arbitrary types, then your so-called simple explicit tests simply can't work. I

Newbie Python questions

2008-07-29 Thread LessPaul
I recently discovered Python and see it as a great language to use for personal projects (and more). I made my living for over a decade as a coder in C, C++, ADA, Fortran, and Assembly before moving to systems engineering. I'm now retired, and would love to code again. I see Python as the perfect

Re: [unittest] Run setUp only once

2008-07-29 Thread Jean-Paul Calderone
On Tue, 29 Jul 2008 19:26:09 +0200, Nikolaus Rath [EMAIL PROTECTED] wrote: Jean-Paul Calderone [EMAIL PROTECTED] writes: On Tue, 29 Jul 2008 16:35:55 +0200, Nikolaus Rath [EMAIL PROTECTED] wrote: Hello, I have a number of conceptually separate tests that nevertheless need a common,

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Carl Banks
On Jul 29, 5:15 am, Heiko Wundram [EMAIL PROTECTED] wrote: I can't dig up a simple example from code I wrote quickly, but because of the fact that explicit comparisons always hamper polymorphism I'm not going to take your word for it. Do you have code that demonstrates how if x improves

iterating by twos

2008-07-29 Thread kj
Is there a special pythonic idiom for iterating over a list (or tuple) two elements at a time? I mean, other than for i in range(0, len(a), 2): frobnicate(a[i], a[i+1]) ? I think I once saw something like for (x, y) in forgotten_expression_using(a): frobnicate(x, y) Or maybe I

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Carl Banks
On Jul 29, 11:12 am, Matthew Fitzgibbons [EMAIL PROTECTED] wrote: Carl Banks wrote: On Jul 28, 8:15 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Mon, 28 Jul 2008 13:22:37 -0700, Carl Banks wrote: On Jul 28, 10:00 am, Steven D'Aprano [EMAIL PROTECTED]

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Carl Banks
On Jul 29, 1:30 pm, Carl Banks [EMAIL PROTECTED] wrote: On Jul 29, 5:15 am, Heiko Wundram [EMAIL PROTECTED] wrote: I can't dig up a simple example from code I wrote quickly, but because of the fact that explicit comparisons always hamper polymorphism I'm not going to take your word for

Re: Parsing VHDL with python, where to start.

2008-07-29 Thread Svenn Are Bjerkem
On Jul 29, 5:14 pm, Wolfgang Grafen [EMAIL PROTECTED] wrote: For me it is not very clear what you intend to do. After years of parsing parts of VHDL from time to time the rapid parsing way for me is using regular expressions instead of one of the parser frame works because of following

I CAN connect socket to any localhost port but I shouldn't be able to

2008-07-29 Thread qvx
Hi, I don't have server listening on port 8084 but I can open socket to it (and to many other ports, tested for all8000) import socket def test(port): af, socktype, proto, canonname, sa = socket.getaddrinfo('localhost', port, socket.AF_INET, socket.SOCK_STREAM)[0] s =

Re: iterating by twos

2008-07-29 Thread George Trojan
kj wrote: Is there a special pythonic idiom for iterating over a list (or tuple) two elements at a time? I mean, other than for i in range(0, len(a), 2): frobnicate(a[i], a[i+1]) ? I think I once saw something like for (x, y) in forgotten_expression_using(a): frobnicate(x, y) Or

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-07-29 Thread Carl Banks
On Jul 29, 5:27 am, Steven D'Aprano [EMAIL PROTECTED] wrote: On Tue, 29 Jul 2008 01:37:45 -0700, Carl Banks wrote: I would accept as evidence something that satisfies my criteria, which your example did not: it could have easily (and more robustly) been written with a simple explicit test.

Re: iterating by twos

2008-07-29 Thread bearophileHUGS
Something like this may be fast enough: from itertools import izip xpartition = lambda seq, n=2: izip(*(iter(seq),) * n) xprimes = (x for x in xrange(2, 100) if all(x % i for i in xrange(2, x))) list(xpartition(xprimes)) [(2, 3), (5, 7), (11, 13), (17, 19), (23, 29), (31, 37), (41, 43), (47,

  1   2   3   >