Re: Is there a way to use .NET DLL from Python

2008-02-06 Thread Fuzzyman
On Feb 6, 9:59 pm, "Luis M. González" <[EMAIL PROTECTED]> wrote: > On Feb 6, 6:27 pm, Huayang Xia <[EMAIL PROTECTED]> wrote: > > > Hello All, > > > I have several .NET DLL (I have no source code for them), is there > > anyway to use them from python instead of from C#. > > > Thanks, > > Huayang > >

Re: mysqldb: Rows READ or Processed

2008-02-06 Thread Carsten Haese
On Wed, 2008-02-06 at 14:51 -0800, mcl wrote: > I have looked through Python Database API Specification v2.0, but can > not find any reference to the number of records processed in a select > query. > > I know I can get the number of records returned with cursor.rowcount, > but I want to know the

Re: Looking for library to estimate likeness of two strings

2008-02-06 Thread Steven D'Aprano
On Wed, 06 Feb 2008 17:32:53 -0600, Robert Kern wrote: > Jeff Schwab wrote: ... >> If the strings happen to be the same length, the Levenshtein distance >> is equivalent to the Hamming distance. ... > I'm afraid that it isn't. Using Magnus Lie Hetland's implementation: ... > In [4]: hamdist('abcde

Re: Using a class as a structure/container

2008-02-06 Thread david . car7
On Feb 6, 2:18 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 06 Feb 2008 00:59:48 -0200, <[EMAIL PROTECTED]> escribi�: > > > > > Is it appropriate to use a class as a simple container in order to > > access attributes using a series of dot operators?  Is their a more > > Pythonic way

loading dictionary from a file

2008-02-06 Thread Amit Gupta
Need a python trick, if it exists: I have a file that stores key, value in following format -- "v1" : "k1", "v2" : "k2" -- Is there a way to directly load this file as dictionary in python. I could do (foreach line in file, split by ":" and then do dictionary insert). Wondering, if some python bu

Re: mysqldb: Rows READ or Processed

2008-02-06 Thread mcl
On Feb 7, 12:19 am, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Wed, 2008-02-06 at 14:51 -0800, mcl wrote: > > I have looked through Python Database API Specification v2.0, but can > > not find any reference to the number of records processed in a select > > query. > > > I know I can get the numb

Re: loading dictionary from a file

2008-02-06 Thread Miki
Hello Amit, > Need a python trick, if it exists: > > I have a file that stores key, value in following format > -- > "v1" : "k1", > "v2" : "k2" > -- > > Is there a way to directly load this file as dictionary in python. I > could do (foreach line in file, split by ":" and then do dictionary > inse

Need help with first program to connect to mysql database via apache and python.

2008-02-06 Thread pythonbrian
I am just learning python and I am trying to create a simple connection to a mysql table via Python and Apache, using a Python program Unfortunately I keep getting an internal server error (50), when I bring it up in my browser ... information attached. Any help would be appreciated ... Thx, [EMAIL

Re: loading dictionary from a file

2008-02-06 Thread Ben Finney
Amit Gupta <[EMAIL PROTECTED]> writes: > Need a python trick, if it exists: > > I have a file that stores key, value in following format > -- > "v1" : "k1", > "v2" : "k2" > -- > > Is there a way to directly load this file as dictionary in python. That input looks almost like valid JSON http://j

Re: loading dictionary from a file

2008-02-06 Thread Amit Gupta
On Feb 6, 5:33 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > Amit Gupta <[EMAIL PROTECTED]> writes: > > Need a python trick, if it exists: > > > I have a file that stores key, value in following format > > -- > > "v1" : "k1", > > "v2" : "k2" > > -- > > > Is there a way to directly load this file as d

Re: Code block function syntax, anonymous functions decorator

2008-02-06 Thread castironpi
On Feb 6, 5:45 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > 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() > > >> run3(): > >>    normal_suit

Re: Is there a way to use .NET DLL from Python

2008-02-06 Thread Luis M. González
On 6 feb, 21:17, Fuzzyman <[EMAIL PROTECTED]> wrote: > On Feb 6, 9:59 pm, "Luis M. González" <[EMAIL PROTECTED]> wrote: > > > On Feb 6, 6:27 pm, Huayang Xia <[EMAIL PROTECTED]> wrote: > > > > Hello All, > > > > I have several .NET DLL (I have no source code for them), is there > > > anyway to use t

Re: mysqldb: Rows READ or Processed

2008-02-06 Thread Steve Holden
Carsten Haese wrote: > On Wed, 2008-02-06 at 18:53 -0500, Steve Holden wrote: >> If you mean the number of (say) rows updated by a SQL UPDATE statement, >> the DB API does not provide any way to access that information > > It doesn't? Isn't that what cursor.rowcount does? > When it works, yes. P

Re: python beginner problem(?)

2008-02-06 Thread Steve Holden
Steve Holden wrote: > Alan Illeman wrote: >> Win2k Pro - installed python: ok >> [...] >> = > C:\Python25\Lib\site-packages\pythonwin\pywin\mfc\object.py: >> 23: DeprecationWarning: raising a string exception is deprecated >> raise win32ui.error

Re: Need help with first program to connect to mysql database via apache and python.

2008-02-06 Thread Steve Holden
pythonbrian wrote: > I am just learning python and I am trying to create a simple > connection to a mysql table via Python and Apache, using a Python > program > Unfortunately I keep getting an internal server error (50), when I > bring it up in my browser ... information attached. > Any help would

Re: Code block function syntax, anonymous functions decorator

2008-02-06 Thread castironpi
On Feb 6, 8:10 pm, [EMAIL PROTECTED] wrote: > On Feb 6, 5:45 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > > > > > > > On Wed, 06 Feb 2008 23:59:27 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> > > wrote: > > > >[EMAIL PROTECTED] schrieb: > > >> def run3( block ): > > >>    for _ in range(

Re: Looking for library to estimate likeness of two strings

2008-02-06 Thread Jeff Schwab
Steven D'Aprano wrote: > On Wed, 06 Feb 2008 17:32:53 -0600, Robert Kern wrote: > >> Jeff Schwab wrote: > ... >>> If the strings happen to be the same length, the Levenshtein distance >>> is equivalent to the Hamming distance. > ... >> I'm afraid that it isn't. Using Magnus Lie Hetland's implement

Re: loading dictionary from a file

2008-02-06 Thread Adonis Vargas
Amit Gupta wrote: > Need a python trick, if it exists: > > I have a file that stores key, value in following format > -- > "v1" : "k1", > "v2" : "k2" > -- > > Is there a way to directly load this file as dictionary in python. I > could do (foreach line in file, split by ":" and then do dictionary

Re: Code block function syntax, anonymous functions decorator

2008-02-06 Thread castironpi
On Feb 6, 4:59 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > > > def run3( block ): > >    for _ in range( 3 ): > >       block() > > > run3(): > >    normal_suite() > > > Introduces new syntax; arbitrary functions can follow 'colon'. > > > Maintains reada

Re: mysqldb: Rows READ or Processed

2008-02-06 Thread Carsten Haese
On Wed, 2008-02-06 at 21:35 -0500, Steve Holden wrote: > Carsten Haese wrote: > > On Wed, 2008-02-06 at 18:53 -0500, Steve Holden wrote: > >> If you mean the number of (say) rows updated by a SQL UPDATE statement, > >> the DB API does not provide any way to access that information > > > > It does

Why does list have no 'get' method?

2008-02-06 Thread Denis Bilenko
Why does list have no 'get' method with exactly the same semantics as dict's get, that is "return an element if there is one, but do NOT raise an exception if there is not.": def get(self, item, default = None): try: return self[item] except IndexError:

Re: Why does list have no 'get' method?

2008-02-06 Thread Paul Rubin
"Denis Bilenko" <[EMAIL PROTECTED]> writes: > port = sys.argv.get(1) or 8000 I like the suggestion, except it should be port = int(sys.argv.get(1, '8000')) one could imagine your example going wrong in a protocol where 0 is a valid port number. -- http://mail.python.org/mailman/listinf

beginner question, function returning object.

2008-02-06 Thread bambam
I started with ths: -- def open_pipe(): pipe=PIPE() print pipe return pipe pipe=open_pipe() pipe.parent = self.parent print pipe -- It didn't do what I wanted: when I printed the pipe the second time it was not the same object as

Re: getting all user defined attributes of a class

2008-02-06 Thread Marc 'BlackJack' Rintsch
On Wed, 06 Feb 2008 15:16:26 -0800, Amit Gupta wrote: > On Feb 6, 2:55 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Amit Gupta schrieb: >> > I should make class A as: >> > class A (object) : >> > x = 1 >> >> > Now, x is class attribute and I am looking for some-way to filter non- >> > us

Re: Looking for library to estimate likeness of two strings

2008-02-06 Thread Daniel Fetchinson
> Are there any Python libraries implementing measurement of similarity > of two strings of Latin characters? > > I'm writing a script to guess-merge two tables based on people's > names, which are not necessarily spelled the same way in both tables > (especially the given names). I would like som

Re: Must COMMIT after SELECT (was: Very weird behavior in MySQLdb "execute")

2008-02-06 Thread Frank Aune
On Wednesday 06 February 2008 16:16:45 Paul Boddie wrote: > Really, the rule is this: always (where the circumstances described > above apply) make sure that you terminate a transaction before > attempting to read committed, updated data. How exactly do you terminate a transaction then?Do you term

Re: Why does list have no 'get' method?

2008-02-06 Thread Raymond Hettinger
[Denis Bilenko] > Why does list have no 'get' method with exactly the same semantics as > dict's get, > that is "return an element if there is one, but do NOT raise > an exception if there is not.": . . . > It is often desirable, for example, when one uses the easiest > command-line options parsin

<    1   2