Xinetd & python server script. problem to get data from from client

2007-07-30 Thread ilia . meerovich
Hello I wrote simple script to test communication: When i connect via telnet like: "telnet localhost 51423" the server is working send and receive information. but when i connected to him via client scrip so client script receive messages from server but server doesn't receive message from client.

Re: Installing mod_python on mac os 10.4.7

2007-07-30 Thread 7stud
> Yeah! So is my install good? Why didn't the Directory tags in > httpd.conf work? Ok. I got the mod_python manual's Testing directions to work as well. The Testing section actually says: --- Add the following Apache directives, which can appear in ... the main server configuration file..

Re: Pythonic way for missing dict keys

2007-07-30 Thread Duncan Booth
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > Instead of doing: > > > if callable(function): function() > > you should do: > > try: > function() > except TypeError: > pass > > > That should work for most uses of callable(), but isn't quite the > same. (What if function() has side-e

Re: How to write GUI and event separately in wxPython??

2007-07-30 Thread Marc 'BlackJack' Rintsch
On Sun, 29 Jul 2007 23:34:14 -0700, Jia Lu wrote: > I am making an application with wxpython. > But I got a problem when I want to change the display string > according to process status. > > I passed the frame to the processing function and use the > frame.txtobj to change displaying strings.

Re: Installing mod_python on mac os 10.4.7

2007-07-30 Thread 7stud
The Testing section of the mod_python manual says to add the following to httpd.conf(with my directory structure): AddHandler mod_python .py PythonHandler mptest PythonDebug On and your tutorial says to add this to httpd.conf: --- AllowOverride FileInfo Replace "

Re: Any reason why cStringIO in 2.5 behaves different from 2.4?

2007-07-30 Thread Stefan Behnel
Stefan Scholl wrote: > Michael L Torrie <[EMAIL PROTECTED]> wrote: >> xml.sax's use of parseString() is exactly correct. xml.sax should >> *never* parse python unicode strings as by definition XML must be >> encoded as a *byte stream*, which is what a python string is. > > I don't care about the

Cross platform Python app deployment

2007-07-30 Thread Will McGugan
Hi, Is there some reference regarding how to package a Python application for the various platforms? I'm familiar with Windows deployment - I use Py2Exe & InnoSetup - but I would like more information on deploying on Mac and Linux. TIA, Will McGugan -- http://www.willmcgugan.com -- http://ma

Re: How to write GUI and event separately in wxPython??

2007-07-30 Thread Steve Holden
Marc 'BlackJack' Rintsch wrote: > On Sun, 29 Jul 2007 23:34:14 -0700, Jia Lu wrote: > >> I am making an application with wxpython. >> But I got a problem when I want to change the display string >> according to process status. >> >> I passed the frame to the processing function and use the >> f

Re: wxGlade: Who knows how to drive this application?

2007-07-30 Thread Steve Holden
Alberto Griggio wrote: >> Here are some things I can think of, in no particular order: > > Thanks! I can't promise I'll take care of all of them (some are nontrivial > to implement, and would probably take a lot of time), but this list is > definitely valuable (e.g. I can circulate it through the

TypeError: unsupported operand type(s) for -: 'Decimal' and 'Decimal'. Why?

2007-07-30 Thread Gilbert Fine
This is a very strange exception raised from somewhere in our program. I have no idea how this happen. And don't know how to reproduce. It just occurs from time to time. Can anyone give me some suggestion to fix this? Thanks. -- Gilbert -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: unsupported operand type(s) for -: 'Decimal' and 'Decimal'. Why?

2007-07-30 Thread Steve Holden
Gilbert Fine wrote: > This is a very strange exception raised from somewhere in our program. > I have no idea how this happen. And don't know how to reproduce. It > just occurs from time to time. > > Can anyone give me some suggestion to fix this? > If it's raised from "somewhere in your program"

import struct in Python z/OS

2007-07-30 Thread miridian
Hi, I'm porting a Python program from Linux to z/OS using this Python port http://www.teaser.fr/~jymengant/mvspython/mvsPythonPort.html I get the following Python 2.4.1 (#43, Apr 23 2005, 23:35:50) [C] on mvs Type "help", "copyright", "credits" or "license" for more information. >>> import str

Re: TypeError: unsupported operand type(s) for -: 'Decimal' and 'Decimal'. Why?

2007-07-30 Thread Marc 'BlackJack' Rintsch
On Mon, 30 Jul 2007 03:36:33 -0700, Gilbert Fine wrote: > This is a very strange exception raised from somewhere in our program. > I have no idea how this happen. And don't know how to reproduce. It > just occurs from time to time. Maybe different `Decimal`\s? Here's how to reproduce such a trac

Re: How to write GUI and event separately in wxPython??

2007-07-30 Thread Marc 'BlackJack' Rintsch
On Mon, 30 Jul 2007 06:32:55 -0400, Steve Holden wrote: > >>> [x for x in xrange(0, 101)] == [y for y in xrange(101)] > True First I thought: Why the unnecessary list comprehension but to my surprise: In [33]: xrange(42) == xrange(42) Out[33]: False That's strange. Ciao, Marc 'BlackJa

Re: TypeError: unsupported operand type(s) for -: 'Decimal' and 'Decimal'. Why?

2007-07-30 Thread Duncan Booth
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Mon, 30 Jul 2007 03:36:33 -0700, Gilbert Fine wrote: > >> This is a very strange exception raised from somewhere in our >> program. I have no idea how this happen. And don't know how to >> reproduce. It just occurs from time to time. > > M

Re: Hex editor display - can this be more pythonic?

2007-07-30 Thread Neil Cerutti
On 2007-07-30, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 29 Jul 2007 18:30:22 -0700, CC <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> >> Yeah, with this I'm not that concerned about Windows. Though, can WinXP >> still load the ansi.sys driver? >> > I'

Professional Grant Proposal Writing Workshop (September 2007: Simon Fraser University)

2007-07-30 Thread Anthony Jones
The Grant Institute's Grants 101: Professional Grant Proposal Writing Workshop will be held at Simon Fraser University at Harbour Centre, September 12 - 14 , 2007. Interested development professionals, researchers, faculty, and graduate students should register as soon as possible, as demand mean

Re: Cross platform Python app deployment

2007-07-30 Thread Benjamin Niemann
Hi, Will McGugan wrote: > Is there some reference regarding how to package a Python application > for the various platforms? I'm familiar with Windows deployment - I use > Py2Exe & InnoSetup - but I would like more information on deploying on > Mac and Linux. The standard way to package portable

Re: Cross platform Python app deployment

2007-07-30 Thread Diez B. Roggisch
Will McGugan wrote: > Hi, > > Is there some reference regarding how to package a Python application > for the various platforms? I'm familiar with Windows deployment - I use > Py2Exe & InnoSetup - but I would like more information on deploying on > Mac and Linux. On mac, there is py2app that all

Re: Pythonic way for missing dict keys

2007-07-30 Thread Steven D'Aprano
On Mon, 30 Jul 2007 07:37:05 +, Duncan Booth wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> >> Instead of doing: >> >> >> if callable(function): function() >> >> you should do: >> >> try: >> function() >> except TypeError: >> pass >> >> >> That should work for most us

Detecting __future__ features

2007-07-30 Thread Steven D'Aprano
How would one tell at runtime if a particular feature has been enabled by the "from __future__ import thing" statement? For example, I can do this: if 1/2 == 0: print "classic division in use" else: print "true division in use" I could even do this: from keyword import keyword if keyw

Re: Detecting __future__ features

2007-07-30 Thread Lawrence Oluyede
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Is there any general mechanism? I'd just use the expected future feature and if the result is not what I expect (or Python raises any kind of exception, like using a keyword not present) I'd think I'm in the past :-) -- Lawrence, oluyede.org - nerope

Re: Detecting __future__ features

2007-07-30 Thread Neil Cerutti
On 2007-07-30, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > How would one tell at runtime if a particular feature has been > enabled by the "from __future__ import thing" statement? I don't understand the qualification, "at runtime," you're making. What's wrong with just importing what you want an

Re: Detecting __future__ features

2007-07-30 Thread André
On Jul 30, 9:39 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-07-30, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > > How would one tell at runtime if a particular feature has been > > enabled by the "from __future__ import thing" statement? > > I don't understand the qualification, "at r

Re: Detecting __future__ features

2007-07-30 Thread Antti Rasinen
On 2007-07-30, at 15:29, Steven D'Aprano wrote: > How would one tell at runtime if a particular feature has been > enabled by > the "from __future__ import thing" statement? > > (I don't especially care whether the feature in question has been > enabled > via an explicit call to import, or be

Re: Detecting __future__ features

2007-07-30 Thread Neil Cerutti
On 2007-07-30, André <[EMAIL PROTECTED]> wrote: > On Jul 30, 9:39 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> I don't understand the qualification, "at runtime," you're >> making. What's wrong with just importing what you want and >> using it? If it's already been enabled, no harm will come from

Re: Detecting __future__ features

2007-07-30 Thread Carsten Haese
On Mon, 2007-07-30 at 12:53 +, André wrote: > On Jul 30, 9:39 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > > On 2007-07-30, Steven D'Aprano > > > > <[EMAIL PROTECTED]> wrote: > > > How would one tell at runtime if a particular feature has been > > > enabled by the "from __future__ import thing

Re: Detecting __future__ features

2007-07-30 Thread Diez B. Roggisch
Neil Cerutti wrote: > On 2007-07-30, André <[EMAIL PROTECTED]> wrote: >> On Jul 30, 9:39 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: >>> I don't understand the qualification, "at runtime," you're >>> making. What's wrong with just importing what you want and >>> using it? If it's already been enab

Re: How to write GUI and event separately in wxPython??

2007-07-30 Thread kyosohma
On Jul 30, 1:34 am, Jia Lu <[EMAIL PROTECTED]> wrote: > HI all > > I am making an application with wxpython. > But I got a problem when I want to change the display string > according to process status. > > I passed the frame to the processing function and use the > frame.txtobj to change displa

Re: Detecting __future__ features

2007-07-30 Thread Jean-Paul Calderone
On Mon, 30 Jul 2007 15:48:00 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >Neil Cerutti wrote: > >> On 2007-07-30, André <[EMAIL PROTECTED]> wrote: >>> On Jul 30, 9:39 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: I don't understand the qualification, "at runtime," you're making. W

Re: Detecting __future__ features

2007-07-30 Thread Neil Cerutti
On 2007-07-30, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > Making the switch between different parser-implementations on > the fly isn't technically impossible - but really, really, > really complicated. But then, if it's lameness sucks so much, > you might wanna take a stab at it? I was conside

Making Gridded Widgets Expandable

2007-07-30 Thread Jim
Hi, I'm looking at page 548 of Programming Python (3rd Edition) by Mark Lutz. The following GUI script works with no problem, i.e., the rows and columns expand: = # Gridded Widgets Expandable page 548 from Tkinter import * colors = ["

Re: encode/decode misunderstanding

2007-07-30 Thread Tim Arnold
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Tim Arnold schrieb: >> Hi, I'm beginning to understand the encode/decode string methods, but I'd >> like confirmation that I'm still thinking in the right direction: >> >> I have a file of latin1 encoded text. Let's

File handle not being released by close

2007-07-30 Thread bg_ie
Hi, I'm in the process of writing some code and noticed a strange problem while doing so. I'm working with PythonWin 210 built for Python 2.5. I noticed the problem for the last py file processed by this script, where the concerned tmp file is only actually written to when PythonWin is closed. In

Re: Detecting __future__ features

2007-07-30 Thread Carsten Haese
On Mon, 2007-07-30 at 14:10 +, Neil Cerutti wrote: > On 2007-07-30, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > > Making the switch between different parser-implementations on > > the fly isn't technically impossible - but really, really, > > really complicated. But then, if it's lameness suc

Re: making a variable available in a function from decorator

2007-07-30 Thread [EMAIL PROTECTED]
is it possible to do this without passing it as a function argument? On 30 Jul 2007 06:17:25 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sun, 29 Jul 2007 15:22:47 -0700, [EMAIL PROTECTED] wrote: > > > I create a variable in a decorator. i want to be able to access that > > variab

Subprocess and pipe-fork-exec primitive

2007-07-30 Thread Rafael Giannetti Viotti
Hi, I am working with the subprocess.py module in Python 2.4.4 and I am confused about it's functionality. It uses the standard pipe-fork-exec method to start a subprocess: # create pipes pid = fork() if pid == 0: # child exec(...) # parent status = waitpid(pid, 0

Re: File handle not being released by close

2007-07-30 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm guessing the garbage collector is causing the file to be written, > but shouldn't close do this? Only if you call it ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Making Gridded Widgets Expandable

2007-07-30 Thread Eric Brunel
On Mon, 30 Jul 2007 15:59:21 +0200, Jim <[EMAIL PROTECTED]> wrote: > Hi, > I'm looking at page 548 of Programming Python (3rd Edition) by Mark > Lutz. > The following GUI script works with no problem, i.e., the rows and > columns expand: > ==

Re: File handle not being released by close

2007-07-30 Thread Eric Brunel
On Mon, 30 Jul 2007 16:36:00 +0200, <[EMAIL PROTECTED]> wrote: > Hi, > > I'm in the process of writing some code and noticed a strange problem > while doing so. I'm working with PythonWin 210 built for Python 2.5. I > noticed the problem for the last py file processed by this script, > where the c

Re: File handle not being released by close

2007-07-30 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I'm in the process of writing some code and noticed a strange problem > while doing so. I'm working with PythonWin 210 built for Python 2.5. I > noticed the problem for the last py file processed by this script, > where the concerned tmp file is only actually written to

Re: Detecting __future__ features

2007-07-30 Thread André
On Jul 30, 11:10 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-07-30, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > > > Making the switch between different parser-implementations on > > the fly isn't technically impossible - but really, really, > > really complicated. But then, if it's lame

Re: File handle not being released by close

2007-07-30 Thread Jean-Paul Calderone
On Mon, 30 Jul 2007 07:36:00 -0700, [EMAIL PROTECTED] wrote: >Hi, > > [snip] >f=open(fileBeginning+".tmp", 'w') >f.write("Hello") >f.close > You forgot to call close. Try this final line, instead: f.close() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Replacing overloaded functions with closures.

2007-07-30 Thread king kikapu
Hi, i am trying, to no avail yet, to take a C#'s overloaded functions skeleton and rewrite it in Python by using closures. I read somewhere on the net (http://dirtsimple.org/2004/12/python-is- not-java.html) that in Python we can reduce code duplication for overloaded functions by using closures.

RE: Making Gridded Widgets Expandable

2007-07-30 Thread Hamilton, William
> From: Jim > Hi, > I'm looking at page 548 of Programming Python (3rd Edition) by Mark > Lutz. > The following GUI script works with no problem, i.e., the rows and > columns expand: > = > # Gridded Widgets Expandable page 548 > > fro

Re: Cross platform Python app deployment

2007-07-30 Thread vasudevram
On Jul 30, 4:42 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Will McGugan wrote: > > Hi, > > > Is there some reference regarding how to package a Python application > > for the various platforms? I'm familiar with Windows deployment - I use > > Py2Exe & InnoSetup - but I would like more info

Re: Process Control Help

2007-07-30 Thread Azazello
On Jul 28, 1:40 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote: > > > I'm attempting to start some process control using Python. I've have > > quite a bit of literature on networking, and have made some tinkering > > servers and clients for different protocols HTT

Re: How to write GUI and event separately in wxPython??

2007-07-30 Thread Steve Holden
Marc 'BlackJack' Rintsch wrote: > On Mon, 30 Jul 2007 06:32:55 -0400, Steve Holden wrote: > >> >>> [x for x in xrange(0, 101)] == [y for y in xrange(101)] >> True > > First I thought: Why the unnecessary list comprehension but to my surprise: > > In [33]: xrange(42) == xrange(42) > Out[33]: Fal

Re: Replacing overloaded functions with closures.

2007-07-30 Thread Neil Cerutti
On 2007-07-30, king kikapu <[EMAIL PROTECTED]> wrote: > i am trying, to no avail yet, to take a C#'s overloaded > functions skeleton and rewrite it in Python by using closures. > I read somewhere on the net > (http://dirtsimple.org/2004/12/python-is- not-java.html) that > in Python we can reduce co

Re: Events: The Python Way

2007-07-30 Thread kyosohma
On Jul 29, 3:14 pm, "Gianmaria" <[EMAIL PROTECTED]> wrote: > "David Wilson" <[EMAIL PROTECTED]> ha scritto nel messaggionews:[EMAIL > PROTECTED] > > > > > Hi there, > > > Python has no built-in way of doing this. You may consider writing > > your own class if you like this pattern (I personally do

Re: Detecting __future__ features

2007-07-30 Thread Steve Holden
Lawrence Oluyede wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> Is there any general mechanism? > > I'd just use the expected future feature and if the result is not what I > expect (or Python raises any kind of exception, like using a keyword not > present) I'd think I'm in the past :-)

Bug? exec converts '\n' to newline in docstrings!?

2007-07-30 Thread Edward K Ream
It looks like both exec and execfile are converting "\n" to an actual newline in docstrings! Start idle: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 [rest of signon deleted] >>> s = '''\ strings = 'abc'.split("\n") ''' >>> print s strings = 'abc'.split(" "

Re: How to write GUI and event separately in wxPython??

2007-07-30 Thread Chris Mellon
On 7/30/07, Steve Holden <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch wrote: > > On Mon, 30 Jul 2007 06:32:55 -0400, Steve Holden wrote: > > > >> >>> [x for x in xrange(0, 101)] == [y for y in xrange(101)] > >> True > > > > First I thought: Why the unnecessary list comprehension but to my

Re: Replacing overloaded functions with closures.

2007-07-30 Thread king kikapu
> The closures discussed in the article are not a solution for > function overloading. They are a solution for function > composition. Hmmm > > Python generally has no need for function name overloading--if > you really want it you must do it manually using runtime type > checking. > > def fu

Re: Bug? exec converts '\n' to newline in docstrings!?

2007-07-30 Thread Diez B. Roggisch
Edward K Ream wrote: > It looks like both exec and execfile are converting "\n" to an actual > newline > in docstrings! > > Start idle: > > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] > on win32 > [rest of signon deleted] > s = '''\ > strings = 'abc'.split("\n

Re: Bug? exec converts '\n' to newline in docstrings!?

2007-07-30 Thread Steve Holden
Edward K Ream wrote: > It looks like both exec and execfile are converting "\n" to an actual > newline > in docstrings! > > Start idle: > > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on > win32 > [rest of signon deleted] > s = '''\ > strings = 'abc'.split("\n

Re: How to write GUI and event separately in wxPython??

2007-07-30 Thread Steve Holden
Chris Mellon wrote: > On 7/30/07, Steve Holden <[EMAIL PROTECTED]> wrote: >> Marc 'BlackJack' Rintsch wrote: >>> On Mon, 30 Jul 2007 06:32:55 -0400, Steve Holden wrote: >>> >>> [x for x in xrange(0, 101)] == [y for y in xrange(101)] True >>> First I thought: Why the unnecessary list comp

Re: Replacing overloaded functions with closures.

2007-07-30 Thread Bruno Desthuilliers
king kikapu a écrit : > Hi, > > i am trying, to no avail yet, to take a C#'s overloaded functions > skeleton and rewrite it in Python by using closures. > I read somewhere on the net (http://dirtsimple.org/2004/12/python-is- > not-java.html) that in Python we can reduce code duplication for > over

Re: Bug? exec converts '\n' to newline in docstrings!?

2007-07-30 Thread Edward K Ream
> The problem is because you are trying to represent a Python program as a Python string literal, and doing it incorrectly. Yes, that is exactly the problem. Thanks to all who replied. Changing changing '\n' to '\\n' fixed the problem. Edward ---

Re: making a variable available in a function from decorator

2007-07-30 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (top-post corrected) > > On 30 Jul 2007 06:17:25 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> > wrote: >> On Sun, 29 Jul 2007 15:22:47 -0700, [EMAIL PROTECTED] wrote: >> >>> I create a variable in a decorator. i want to be able to access that >>> variable in the f

Database objects? Persistence? Sql Server woes

2007-07-30 Thread Mike Howarth
I've been having a few problems with connecting to SQL Server, initially I was using dblib however found some problems with returning text fields whereby all text fields were ignored and it bawked at multiline sql statements. Having found these major stumbling blocks I've started using pymssql wh

Re: pythonic parsing of URL

2007-07-30 Thread GreenH
On Jul 27, 10:04 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 28 Jul 2007 03:10:32 +, GreenH wrote: > > I get some string as below from a library method (qt3 > > QDropEvent.data()) I use. > > file:///C:/Documents%20and%20Settings/Username/My%20Documents/45-61-Abc%20fold-%20den.vru >

Re: TypeError: unsupported operand type(s) for -: 'Decimal' and 'Decimal'. Why?

2007-07-30 Thread Gilbert Fine
Thanks. I think I have some direction to do logging, to get more information about this problem. It seems that I don't get used to dynamic language yet. -- Gilbert On Jul 30, 7:20 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > On Mon, 30 J

Re: making a variable available in a function from decorator

2007-07-30 Thread Evan Klitzke
On 7/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > is it possible to do this without passing it as a function argument? > Sort of. Functions are objects in python, so you can set attribute on them. E.g. def foo(): return foo.c foo.c = 1 print foo() Which will print 1. Of course, it

Re: Making Gridded Widgets Expandable

2007-07-30 Thread Jim
On Jul 30, 8:24 am, "Hamilton, William " <[EMAIL PROTECTED]> wrote: > > From: Jim > > Hi, > > I'm looking at page 548 of Programming Python (3rd Edition) by Mark > > Lutz. > > The following GUI script works with no problem, i.e., the rows and > > columns expand: > >

Re: Replacing overloaded functions with closures.

2007-07-30 Thread Terry Reedy
"king kikapu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | > def func(obj): | > if isinstance(obj, bool): | > return not obj | > elif isinstance(obj, int): | > return obj * 2 | > elif isinstance(obj, basestring): | > return obj + obj | > else: | > raise No

Python-URL! - weekly Python news and links (Jul 30)

2007-07-30 Thread Gabriel Genellina
QOTW: "If you really want to learn hard-core Python, probably your best bet is: * read everything Tim Peters has ever written in comp.lang.python (this will take a few months), start with "import this" * read everything the PyPy guys have ever written (particularly Christian and

Re: Database objects? Persistence? Sql Server woes

2007-07-30 Thread Steve Holden
Mike Howarth wrote: > I've been having a few problems with connecting to SQL Server, initially I > was using dblib however found some problems with returning text fields > whereby all text fields were ignored and it bawked at multiline sql > statements. > > Having found these major stumbling block

RE: Free support for Python developers

2007-07-30 Thread Carroll, Barry
Viktor: This is a great idea. Thank you I don't currently have a voice setup on my machine, but will try to get one as soon as possible. I would be pleased to trade English practice for Python support. Regards, Barry [EMAIL PROTECTED] 541-302-1107 We who cut mere s

Re: Bug? exec converts '\n' to newline in docstrings!?

2007-07-30 Thread Stargaming
On Mon, 30 Jul 2007 11:00:14 -0500, Edward K Ream wrote: >> The problem is because you are trying to represent a Python > program as a Python string literal, and doing it incorrectly. > > Yes, that is exactly the problem. Thanks to all who replied. Changing > changing '\n' to '\\n' fixed the pr

Re: Database objects? Persistence? Sql Server woes

2007-07-30 Thread Diez B. Roggisch
Mike Howarth schrieb: > I've been having a few problems with connecting to SQL Server, initially I > was using dblib however found some problems with returning text fields > whereby all text fields were ignored and it bawked at multiline sql > statements. > > Having found these major stumbling blo

Re: problems with logging module

2007-07-30 Thread Gabriel Genellina
En Mon, 30 Jul 2007 03:50:52 -0300, Alia Khouri <[EMAIL PROTECTED]> escribió: > But I'm not letting the logging module off, it's still not the easiest > or most intuitive module to work with. > > For example: a basic Log class that can be programatically configured > would be quicker to work wit

Re: How to write GUI and event separately in wxPython??

2007-07-30 Thread Marc 'BlackJack' Rintsch
On Mon, 30 Jul 2007 11:16:01 -0400, Steve Holden wrote: > Marc 'BlackJack' Rintsch wrote: >> First I thought: Why the unnecessary list comprehension but to my surprise: >> >> In [33]: xrange(42) == xrange(42) >> Out[33]: False >> >> That's strange. >> > Not so strange really. The two xrange obj

Fwd: Re: Comparing Dictionaries

2007-07-30 Thread Kenneth Love
>From: "Steven D'Aprano" <[EMAIL PROTECTED]> >Newsgroups: comp.lang.python >Subject: Re: Comparing Dictionaries >Date: Sat, 28 Jul 2007 10:21:14 +1000 >To: python-list@python.org > >On Fri, 27 Jul 2007 14:11:02 -0500, Kenneth Love wrote: > > > The published recipe (based on ConfigParser) did not h

Re: Comparing Dictionaries

2007-07-30 Thread Kenneth Love
At 03:23 AM 7/28/2007, you wrote: >Hi Kenneth, being new to Python i wondered if you at least considered >Doctests as part of your testing solution. >Other languages don't have Doctest. > >- Paddy. Until I read your post, I had never even heard of Doctest. I will look into it. Here is the list

►Watch Satellite Channels on your PC - FREE!◄

2007-07-30 Thread Camron S
Finally Available! Who Else Wants to Watch Satellite TV On Your Computer Without Paying Monthly Fees... FOR FREE? For the very first time, Satellite TV is available on your computer with our "Cutting-Edge" Software! It's as Easy as 1...2...3... 1. Download our TVonPCPro software 2. Click on t

►Watch Satellite Channels on your PC - FREE!◄

2007-07-30 Thread Camron S
Finally Available! Who Else Wants to Watch Satellite TV On Your Computer Without Paying Monthly Fees... FOR FREE? For the very first time, Satellite TV is available on your computer with our "Cutting-Edge" Software! It's as Easy as 1...2...3... 1. Download our TVonPCPro software 2. Click on t

Re: How to write GUI and event separately in wxPython??

2007-07-30 Thread star . public
On Jul 30, 11:42 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > > On Mon, 30 Jul 2007 06:32:55 -0400, Steve Holden wrote: > > > >> >>> [x for x in xrange(0, 101)] == [y for y in xrange(101)] > > >> True > nitpick: list(xrange(42)) == list(xrange(42)) is slightly more concise > than the list c

Re: How to write GUI and event separately in wxPython??

2007-07-30 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Jul 30, 11:42 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Mon, 30 Jul 2007 06:32:55 -0400, Steve Holden wrote: > >>> [x for x in xrange(0, 101)] == [y for y in xrange(101)] > True > >> nitpick: list(xrange(42)) == list(xrange(42)) is slightly mor

Re: OOP in Python book?

2007-07-30 Thread James Stroud
Dick Moores wrote: > At 01:27 PM 7/28/2007, Dennis Lee Bieber wrote: > >> On Fri, 27 Jul 2007 16:27:57 -0700, Dick Moores <[EMAIL PROTECTED]> >> declaimed the following in comp.lang.python: >> >> >> > Well, the publisher is Prentice Hall, "The world's leading >> > educational publisher". Textbooks

win32 question in Python

2007-07-30 Thread Huang, Shun-Hsien
Hi, I am new in Python. I have one question in the database application in python. I have one excel file that I want to save in the database table. In the Microsoft access, I can easy do this one by using Docmd .. How do I use this one in Python? I already know how to connect to a databa

yield keyword usage

2007-07-30 Thread Ehsan
hi coulde any one show me the usage of "yield" keyword specially in this example: """Fibonacci sequences using generators This program is part of "Dive Into Python", a free Python book for experienced programmers. Visit http://diveintopython.org/ for the latest version. """ __author__ = "Mark

Re: Comparing Dictionaries

2007-07-30 Thread Paddy
On Jul 30, 8:30 pm, Kenneth Love <[EMAIL PROTECTED]> wrote: > At 03:23 AM 7/28/2007, you wrote: > > >Hi Kenneth, being new to Python i wondered if you at least considered > >Doctests as part of your testing solution. > >Other languages don't have Doctest. > > >- Paddy. > > Until I read your post,

Re: yield keyword usage

2007-07-30 Thread Erik Jones
On Jul 30, 2007, at 4:13 PM, Ehsan wrote: > hi > coulde any one show me the usage of "yield" keyword specially in this > example: > > > """Fibonacci sequences using generators > > This program is part of "Dive Into Python", a free Python book for > experienced programmers. Visit http://diveintop

Directory

2007-07-30 Thread Rohan
I would like to get a list of sub directories in a directory. If I use os.listdir i get a list of directories and files in that . i only want the list of directories in a directory and not the files in it. anyone has an idea regarding this. -- http://mail.python.org/mailman/listinfo/python-list

Re: Directory

2007-07-30 Thread Irmen de Jong
Rohan wrote: > I would like to get a list of sub directories in a directory. > If I use os.listdir i get a list of directories and files in that . > i only want the list of directories in a directory and not the files > in it. > anyone has an idea regarding this. > Look up os.walk (allows you to

Re: yield keyword usage

2007-07-30 Thread [EMAIL PROTECTED]
On Jul 30, 4:40 pm, Erik Jones <[EMAIL PROTECTED]> wrote: > On Jul 30, 2007, at 4:13 PM, Ehsan wrote: > > > > > > > hi > > coulde any one show me the usage of "yield" keyword specially in this > > example: > > > """Fibonacci sequences using generators > > > This program is part of "Dive Into Pytho

Utilizing a raw IDispatch Pointer from Python

2007-07-30 Thread Brad Johnson
I have a C++ application that creates a collection of COM objects. I would like to give the Python interpreter access to these interfaces that were created in C++ land. Stated another way, how can I have Python consume a IDispatch pointer from C++ and wrap it with one of those nice Python classes

What is the "functional" way of doing this?

2007-07-30 Thread beginner
Hi, If I have a number n and want to generate a list based on like the following: def f(n): l=[] while n>0: l.append(n%26) n /=26 return l I am wondering what is the 'functional' way to do the same. Thanks, beginner -- http://mail.python.org/mailman/listinfo/py

Re: win32 question in Python

2007-07-30 Thread Brad Johnson
Huang, Shun-Hsien ercot.com> writes: > but how do I copy a excel file into > database table by using Python? > I'm not sure if this helps, but you can access the Excel Automation model very easily with: import win32com.client x1 = client.Dispatch("Excel.Application") Now you can use the x1

Re: win32 question in Python

2007-07-30 Thread Cappy2112
Hello Brad, If you don't get a reply here, there is a win32 specific Python list on ActiveState.com wher ethey do talk about excel & other Win32 python issues. On Jul 30, 3:49 pm, Brad Johnson <[EMAIL PROTECTED]> wrote: > Huang, Shun-Hsien ercot.com> writes: > > > > but how do I copy a excel fi

Re: 128 or 96 bit integer types?

2007-07-30 Thread [EMAIL PROTECTED]
On Jul 29, 11:35 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > John DeRosa <[EMAIL PROTECTED]> wrote: > >On Sat, 28 Jul 2007 00:19:02 -0700, "[EMAIL PROTECTED]" > ><[EMAIL PROTECTED]> wrote: > > >>For example, how many ways can you put 492 marbles into > >>264 ordered bins such that each bin has at

Re: win32 question in Python

2007-07-30 Thread Brad Johnson
Cappy2112 gmail.com> writes: > > > Hello Brad, > > If you don't get a reply here, there is a win32 specific Python list > on ActiveState.com wher ethey do talk about excel & other Win32 python > issues. > Thanks, but I believe this you meant to address the OP Shun-Hsien, not me. Just wanted

Re: Comparing Dictionaries

2007-07-30 Thread Paul Rubin
Kenneth Love <[EMAIL PROTECTED]> writes: > I will search on Google for more info on Doctest. Doctest is recent. Try: http://python.org/doc/lib/module-doctest.html Diveintopython should probably be updated to use doctest instead of unittest. unittest is Java-descended and doesn't fit into Pytho

Help text embedding in C code?

2007-07-30 Thread James Stroud
Hello All, I have a python module I wrote in C some time ago and I have since forgotten how to use my functions and so I wanted to add some doc-strings such that "help(function_name)" would give some help in the interactive interpreter. In the cPython source, it seems like python wrapper funct

Re: What is the "functional" way of doing this?

2007-07-30 Thread Paul Rubin
beginner <[EMAIL PROTECTED]> writes: > def f(n): > l=[] > while n>0: > l.append(n%26) > n /=26 > return l > > I am wondering what is the 'functional' way to do the same. If you're trying to learn functional programming, maybe you should use a functional language li

Re: TypeError: unsupported operand type(s) for -: 'Decimal' and 'Decimal'. Why?

2007-07-30 Thread Zentrader
> from decimal import Decimal > > In [21]: a = Decimal() > > In [22]: class Decimal(object): >: pass >: > > In [23]: b = Decimal() > > In [24]: a - b Perhaps I don't understand what you are doing here, but on line 22 you overload Decimal. If you just have a = Decimal() b = Dec

Re: What is the "functional" way of doing this?

2007-07-30 Thread [EMAIL PROTECTED]
On Jul 30, 3:48 pm, beginner <[EMAIL PROTECTED]> wrote: > Hi, > > If I have a number n and want to generate a list based on like the > following: > > def f(n): > l=[] > while n>0: > l.append(n%26) > n /=26 > return l > > I am wondering what is the 'functional' way to

Re: What is the "functional" way of doing this?

2007-07-30 Thread Steven D'Aprano
On Mon, 30 Jul 2007 22:48:10 +, beginner wrote: > Hi, > > If I have a number n and want to generate a list based on like the > following: > > def f(n): > l=[] > while n>0: > l.append(n%26) > n /=26 > return l > > I am wondering what is the 'functional' way to

Re: What is the "functional" way of doing this?

2007-07-30 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Recursion is common in functional programming: > > def f(n, l=None): > if l == None: > l = [] > if n > 0: > return f(n/26, l + [n%26]) > else: > return l > > print f(1000) Right, this is functional style, but q

  1   2   >