Re: beginner question, function returning object.

2008-02-07 Thread bambam
Second try (correction) 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 i

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

2008-02-07 Thread bearophileHUGS
Paul Rubin: > 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. I think a high-level language like Python must have boolean operators (or and not) that behave in a much

Re: beginner question, function returning object.

2008-02-07 Thread Marc 'BlackJack' Rintsch
On Thu, 07 Feb 2008 19:14:54 +1100, bambam wrote: > 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

Re: getting all user defined attributes of a class

2008-02-07 Thread grflanagan
On Feb 6, 11:07 pm, Amit Gupta <[EMAIL PROTECTED]> wrote: > Hi > > How do I get user defined attributes of a class? e.g > > Class A(object) : > self.x = 1 > -- > > I want something like: > for userattrib in A.getAllUserAttribute() : > print userattrib > class Meta(type):

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

2008-02-07 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > Paul Rubin: >> 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. > > I think a high-level language like Python must have boolean operators

Re: Code block function syntax, anonymous functions decorator

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

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

2008-02-07 Thread Fuzzyman
Luis M. González wrote: > 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

Re: beginner question, function returning object.

2008-02-07 Thread Steven D'Aprano
On Thu, 07 Feb 2008 19:14:54 +1100, bambam wrote: > Second try (correction) > > I started with ths: > -- > def open_pipe(): > pipe=PIPE() > print pipe > return pipe What's PIPE() do? > pipe=open_pipe() (Extraneous space removed.) > pipe.parent = self.

Re: loading dictionary from a file

2008-02-07 Thread Fuzzyman
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: Why does list have no 'get' method?

2008-02-07 Thread Tim Golden
Denis Bilenko wrote: > 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] >

Re: Adding properties to an instance

2008-02-07 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Feb 6, 11:09 pm, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: >> While this is technically possible (I tried a couple years ago), it >> requires hacking the __getattribute__ method, which is something I >> would not recommand, not only because it can be tricky,

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

2008-02-07 Thread Steven D'Aprano
On Thu, 07 Feb 2008 00:20:52 -0800, bearophileHUGS wrote: > I think a high-level language like Python must have boolean operators > (or and not) that behave in a much more clean way, with a simpler > semantics. That is they have to return only true or false. Otherwise > they are just a source of b

Re: Why not a Python compiler?

2008-02-07 Thread Gary Duzan
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> wrote: >On 2008-02-06, Reedick, Andrew <[EMAIL PROTECTED]> wrote: > >> One demerit has been marked against your geek card for missing >> an obvious science pun. Additionally, your membership to the >> Star Trek Lifestyle Adventure

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

2008-02-07 Thread Denis Bilenko
Tim Golden wrote: > Dodging your question slightly (and at the risk of teaching > my grandmother to suck eggs) I sometimes use this idiom for > checking params. Obviously it only goes so far, but it's > fairly compact: > > import os, sys > if __name__ == '__main__': > ARGS = None, "DEV" > f

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

2008-02-07 Thread bearophileHUGS
Steven D'Aprano: > With the greatest respect, I think that if you think the second example > "is more clear", you're completely bonkers. *grins* No one is completely normal, I presume :-) I'd like to know what others think about it, about this anti-feature. What I can say is that other computer la

Re: Why not a Python compiler?

2008-02-07 Thread Stefan Behnel
Santiago Romero wrote: > I'm impressed with python. I'm very happy with the language and I > find Python+Pygame a very powerful and productive way of writing 2D > games. I'm not, at this moment, worried about execution speed of the > small game I'm working on (it runs at full 60 fps even in an old

Re: Suggestions for structure of HTML-generating app

2008-02-07 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > On Feb 5, 9:14 pm, Bernard <[EMAIL PROTECTED]> wrote: >> On 5 fév, 10:09, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> >> wrote: > >>> Are there any good approaches of doing this kind of thing that I've >>> missed, or am I resigned to having HTML and Python code mixed and so

Re: Suggestions for structure of HTML-generating app

2008-02-07 Thread [EMAIL PROTECTED]
On Feb 5, 9:14 pm, Bernard <[EMAIL PROTECTED]> wrote: > On 5 fév, 10:09, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Are there any good approaches of doing this kind of thing that I've > > missed, or am I resigned to having HTML and Python code mixed and so > > will just have to keep al

Re: smtpd module

2008-02-07 Thread Stefan Witzel
Stefan Witzel wrote: > Hello, > > the documentation of the smtpd module in the Python Library Reference > is very short, I think. Are there any examples available? Especially > I'm interested in the DebuggingServer. > > Thanks in advance. > > Stefan Sorry, I found the example - it's in the so

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

2008-02-07 Thread Arnaud Delobelle
On Feb 7, 8:20 am, [EMAIL PROTECTED] wrote: > Paul Rubin: > > > 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. > > I think a high-level language like Python must

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

2008-02-07 Thread Stefan Behnel
Denis Bilenko wrote: > Raymond Hettinger wrote: >> If positions 0 and 1 are optional, how do you expect to know whether >> "path" is going to be at position 2? This problem doesn't exist with >> dictionaries because the presence or absence of optional entries does >> not affect the key reference t

Re: Traversing python datatypes via http

2008-02-07 Thread Matthew_WARREN
"Mark" <[EMAIL PROTECTED]> wrote > > Is it possible to traverse say python lists via http:// > > http is a network protocol. > What does that have to do with traversing python lists? > Can you clarify what you mean by that? > > > say there is a list in the memory > > can we traverse the lis

PyGILState_Ensure() produces a deadlock

2008-02-07 Thread Alexander Eisenhuth
Hello, In my mixed C++ / Python Application there are situations where a PyGILState_STATE gil_state = PyGILState_Ensure() produces a deadlock. The background is that a call fro python to cpp is directed to another subsystem that tries to access the GIL (through my C++ wrapper) from another thr

Re: Adding properties to an instance

2008-02-07 Thread dg . google . groups
> As a side note: the naming symetry between __getattr__ and __setattr__ > is a gotcha, since __setattr__ is mostly symetric to __getattribute__ - > IOW, customizing __setattr__ is a bit tricky. The naive approach, ie: Ah I see - so __setattr__ is called immediately whereas __getattr__ is only cal

Re: Why not a Python compiler?

2008-02-07 Thread Jean-Paul Calderone
On Thu, 07 Feb 2008 11:03:12 +0100, Stefan Behnel <[EMAIL PROTECTED]> wrote: >Santiago Romero wrote: > [snip] >> >> Why not a Python COMPILER? >> >> It would be very nice to be able to output Linux, MAC or Windows >> binaries of compiled (not bytecompiled) code. It would run faster, it >> will be

Re: Looking for library to estimate likeness of two strings

2008-02-07 Thread Matthew_WARREN
> 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. Is this really what the OP was asking for. If I understand it correctly, Levenshtein

Re: Adding properties to an instance

2008-02-07 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : >> As a side note: the naming symetry between __getattr__ and __setattr__ >> is a gotcha, since __setattr__ is mostly symetric to __getattribute__ - >> IOW, customizing __setattr__ is a bit tricky. The naive approach, ie: > > Ah I see - so __setattr__ is called immediat

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

2008-02-07 Thread Paul Boddie
On 7 Feb, 08:52, Frank Aune <[EMAIL PROTECTED]> wrote: > 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 d

Re: Adding properties to an instance

2008-02-07 Thread dg . google . groups
> > Does this mean that __setattr__ > > incurs the same performance penalty that overriding __getattribute__ > > would? > > Not quite AFAICT - there's less going on here. Also, getting an > attribute is (usually at least) more common than setting it. > > > Possibly I can live with this because I th

Re: Server side cookie problems

2008-02-07 Thread rodmc
On Feb 6, 8:00 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 06 Feb 2008 15:27:53 -0200, rodmc <[EMAIL PROTECTED]> > escribi�: > > > Hi, I am trying to set a cookie on a client computer using the Cookie > > module however all I get is the text being printed in the browser > > window.

Re: Using a class as a structure/container

2008-02-07 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (snip) > Thanks for the information. The reason why I was taking this approach > was more from a user interface perspective. What I have is a file > that contains certain geometric objects, lets call them geo. Each geo > object has 4 possible surfaces: You mean it ha

index() of sequence type?

2008-02-07 Thread Neal Becker
I see list has index member, but is there an index function that applies to any sequence type? If not, shouldn't there be? -- http://mail.python.org/mailman/listinfo/python-list

Re: Server side cookie problems

2008-02-07 Thread rodmc
On Feb 7, 1:06 pm, rodmc <[EMAIL PROTECTED]> wrote: > On Feb 6, 8:00 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > > En Wed, 06 Feb 2008 15:27:53 -0200, rodmc <[EMAIL PROTECTED]> > > escribi�: > > > > Hi, I am trying to set a cookie on a client computer using the Cookie > > > module ho

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

2008-02-07 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Steven D'Aprano: >> With the greatest respect, I think that if you think the second example >> "is more clear", you're completely bonkers. *grins* > > No one is completely normal, I presume :-) > I'd like to know what others think about it, about this anti-feature. s

Need Smart Phone with new features? please click here

2008-02-07 Thread Farooq
www.enmac.com.hk GSM Mobile Phones, Digital iPods, Digital Clocks, Digital Pens, Digital Quran. Enjoy these products with Islamic Features (Complete Holy Quran with Text and Audio, Tafaseer books, Ahadees Books, Daily Supplications, Universal Qibla Direction, Prayer Timing and much more) visit our

Re: beginners help

2008-02-07 Thread Guilherme Polo
2008/2/7, Guido van Brakel <[EMAIL PROTECTED]>: > Hello > > I totally new to python and i'm doing a python course now. Maybe someone > could help me a little bit here: > > I need to create this script. > > If i enter a center digit like 5 for example i need to create two > vertical and horzito

Re: index() of sequence type?

2008-02-07 Thread Stefan Behnel
Neal Becker wrote: > I see list has index member, but is there an index function that applies to > any sequence type? Like this? def find_index(seq, value): try: find_index = seq.index except AttributeError: def find_index(value): for i,v in enumera

Re: Looking for library to estimate likeness of two strings

2008-02-07 Thread Lee Capps
At 14:01 Wed 06 Feb 2008, [EMAIL PROTECTED] wrote: >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 >(

beginners help

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

Re: Why not a Python compiler?

2008-02-07 Thread Ryszard Szopa
On Feb 5, 9:30 am, [EMAIL PROTECTED] wrote: > I don't know the exact details but I think the issue is the dynamic > nature of Python makes it impossible to correctly store the various > types and changes into compiled code. Someone else will probably be > able to provide a good reason as to why it

Re: beginners help

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

Re: Must COMMIT after SELECT

2008-02-07 Thread Steve Holden
Paul Boddie wrote: > On 7 Feb, 08:52, Frank Aune <[EMAIL PROTECTED]> wrote: >> 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 re

Re: index() of sequence type?

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

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

2008-02-07 Thread Thomas Bellman
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Not quite. In C and a couple other langages, int 0 is false, anything > else is true. Not just int, but all kinds of integers, as well as all kinds of floating point types and all kinds of pointers, with the value 0 are considered false. And stru

Re: Looking for library to estimate likeness of two strings

2008-02-07 Thread Steve Holden
[EMAIL PROTECTED] 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. > > Is this really what the OP was asking for

Re: python beginner problem(?)

2008-02-07 Thread Alan Illeman
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Steve Holden wrote: > > Alan Illeman wrote: > >> Win2k Pro - installed python: ok > >> > [...] > >> = > > C:\Python25\Lib\site-packages\pythonwin\pywin\mfc\object.py: > >

print 'hello' -> SyntaxError: invalid syntax

2008-02-07 Thread ValdezDE
I try to install Python in a Dell D620 with XP PRO version 5.1.2600 and I am getting this error. I assume that some dlls are missing but I installed form a fresh python-2.5.1.msi without errors msg. Thanks Roberto Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on w

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

2008-02-07 Thread Bruno Desthuilliers
Thomas Bellman a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > (snip) >> In Lisp (and IIRC), an empty list is false, anything else >> is true. > > There seems to be a language name missing from the parenthesis. Yes, sorry - I was thinking of OCaml and/or Haskell, but

Re: Must COMMIT after SELECT

2008-02-07 Thread Paul Boddie
On 7 Feb, 14:29, Steve Holden <[EMAIL PROTECTED]> wrote: > > That's true, and your remarks clarify cursor usage in the DB API very > well. Most people most of the time tend to ignore the existence of > cursor.fetchmany() in the DB API, despite the fact that it can provide > huge efficiency gains ov

Re: Why not a Python compiler?

2008-02-07 Thread Bjoern Schliessmann
Ryszard Szopa wrote: > Of course, when writing Python extensions in C is fairly easy and > when rewriting just the critical part of the code is enough to get > acceptable performance, I really doubt I will see anybody willing > to invest serious amounts of money and time into writing a native > co

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

2008-02-07 Thread Steve Holden
Wildemar Wildenburger wrote: > Arnaud Delobelle wrote: >> Personally, between >> >> * foo if foo else bar >> * foo or bar >> >> I prefer the second. Maybe it could be spelt >> >> * foo else bar ? >> > How about > > val = foo rather than bar > > If that is not clear and obvios, I don't know what i

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

2008-02-07 Thread Wildemar Wildenburger
Arnaud Delobelle wrote: > Personally, between > > * foo if foo else bar > * foo or bar > > I prefer the second. Maybe it could be spelt > > * foo else bar ? > How about val = foo rather than bar If that is not clear and obvios, I don't know what is. ;) /W -- http://mail.python.org/mailman/

Re: socket script from perl -> python

2008-02-07 Thread Bjoern Schliessmann
kettle wrote: > Hi I have a socket script, written in perl, which I use to send > audio data from one server to another. I would like to rewrite > this in python so as to replicate exactly the functionality of the > perl script, so as to incorporate this into a larger python > program. Unfortunat

Re: Must COMMIT after SELECT

2008-02-07 Thread M.-A. Lemburg
On 2008-02-07 16:46, Carsten Haese wrote: > On Thu, 2008-02-07 at 16:33 +0100, M.-A. Lemburg wrote: >> mxODBC has support for named cursors that you can later >> use for positioned updates. > > Since we're on the topic of shameless plugs, InformixDB has this > feature, too :) > >> However, it's

Re: Multiple interpreters retaining huge amounts of memory

2008-02-07 Thread Rhamphoryncus
On Feb 2, 10:32 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > The multi interpreter feature has some limitations, but if you know > what you are doing and your application can be run within those > limitations then it works fine. I've been wondering about this for a while. Given the severe li

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

2008-02-07 Thread Michael Spencer
Wildemar Wildenburger wrote: > Arnaud Delobelle wrote: >> Personally, between >> >> * foo if foo else bar >> * foo or bar >> >> I prefer the second. Maybe it could be spelt >> >> * foo else bar ? >> > How about > > val = foo rather than bar > > If that is not clear and obvios, I don't know what i

Re: embedded python in c++ packaging

2008-02-07 Thread Joshua Kugler
Furkan Kuru wrote: > Hello, > > I have been developing an application in C++ that embeds Python > interpreter. It takes advantage of too many modules from Python. > When I want to package this application, I need to add too many files > (.pyc) from Python/lib folder together with Python25.dll. > I

Re: IronPython vs CPython: faster in 1.6 times?

2008-02-07 Thread Isaac Gouy
On Feb 6, 1:54 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Isaac Gouy wrote: > > On Feb 5, 11:47 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >>> Mike C. Fletcher: > Not sure if Mono also provides a speedup. > >>> There is a set of good benchmarks here, t

Re: embedded python in c++ packaging

2008-02-07 Thread Warren Myers
The Python byte-code files are already pretty dense, so compressing them further is unlikely to work if you try to put them in a zip. WMM On Feb 7, 2008 11:39 AM, Furkan Kuru <[EMAIL PROTECTED]> wrote: > Hello, > > I have been developing an application in C++ that embeds Python > interpreter. >

Re: re question

2008-02-07 Thread Amit Gupta
On Feb 7, 10:38 am, Amit Gupta <[EMAIL PROTECTED]> wrote: > Python'ites > > I searched around "google" to find the answer to this question, but I > can't: > > I have a named regexp : x = re.compile("(?P[a-z]+)") > > What I want is an iterator, that can return me both the "groupname" > and the match

MyHDL project!!

2008-02-07 Thread Blubaugh, David A.
sir, Is there still a possibility to collaborate??? David Blubaugh -Original Message- From: Blubaugh, David A. Sent: Friday, February 01, 2008 10:44 AM To: 'chewie54' Cc: 'python-list@python.org' Subject: MyHDL project ! Dan, I would be honored to start a project such as th

re question

2008-02-07 Thread Amit Gupta
Python'ites I searched around "google" to find the answer to this question, but I can't: I have a named regexp : x = re.compile("(?P[a-z]+)") What I want is an iterator, that can return me both the "groupname" and the matched string, e.g: m = x.search("aa") Somehow, I want to get {"me" : "aa"

Setting up a new user and environment from within a python script

2008-02-07 Thread Henry Hollenberg
Hello, I have written a script that uses environment variables set during a particular users login in ".bash_profile" and ".profile". I have changed to that users uid and gid in my python script using: import os os.setegid os.setgid os.seteuid os.setuid but I still am not picking up the needed

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

2008-02-07 Thread pruebauno
On Feb 7, 12:15 pm, [EMAIL PROTECTED] wrote: > On Feb 7, 11:01 am, "Denis Bilenko" <[EMAIL PROTECTED]> wrote: > > > > > Steve Holden wrote: > > > These versions differ with respect to treatment of blank lines, which > > > indicates how easy it is to go astray in this kind of semantic > > > optimiz

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

2008-02-07 Thread Christian Heimes
Huayang Xia wrote: > What's the difference between .NET DLL and normal C DLL? Do you mean > after clr.AddReference('ClassLibrary1'), there is no need to import > ClassLibrary1? A normal DLL and an assembly DLL share only the header. The rest is totally different. You can see the DLL as a container

Re: socket script from perl -> python

2008-02-07 Thread Hrvoje Niksic
kettle <[EMAIL PROTECTED]> writes: > # pack $length as a 32-bit network-independent long > my $len = pack('N', $length); [...] > the sticking point seems to be the $len variable. Use len = struct.pack('!L', length) in Python. See http://docs.python.org/lib/module-struct.html for details. -- htt

Re: getting all user defined attributes of a class

2008-02-07 Thread Amit Gupta
On Feb 7, 12:28 am, grflanagan <[EMAIL PROTECTED]> wrote: > On Feb 6, 11:07 pm, Amit Gupta <[EMAIL PROTECTED]> wrote: > > > Hi > > > How do I get user defined attributes of a class? e.g > > > Class A(object) : > > self.x = 1 > > -- > > > I want something like: > > for userattrib

Re: brain stuck. whats occurring here?

2008-02-07 Thread [EMAIL PROTECTED]
On Feb 7, 11:38 am, [EMAIL PROTECTED] wrote: > Hallo, > > I'm after > > [[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[]­,[],[],[]]] > > (NxN 'grid', 5x5 in that example, and while typing this up i figured out > how to get it, but I'm still not sure what _was_ happening)

Re: Why not a Python compiler?

2008-02-07 Thread Grant Edwards
On 2008-02-06, Gary Duzan <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Grant Edwards <[EMAIL PROTECTED]> wrote: >>On 2008-02-06, Reedick, Andrew <[EMAIL PROTECTED]> wrote: >> >>> One demerit has been marked against your geek card for missing >>> an obvious science pun. Additiona

Re: Why not a Python compiler?

2008-02-07 Thread Torsten Bronger
Hallöchen! Grant Edwards writes: > On 2008-02-06, Gary Duzan <[EMAIL PROTECTED]> wrote: > >> In article <[EMAIL PROTECTED]>, >> >> Grant Edwards <[EMAIL PROTECTED]> wrote: >> >>> [...] >>> >>> Ouch. Two demerits for using the distance unit "parsec" in a >>> context where a quantity of time was r

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

2008-02-07 Thread Fuzzyman
On Feb 7, 2:35 pm, "Luis M. González" <[EMAIL PROTECTED]> wrote: > On 7 feb, 05:52, Fuzzyman <[EMAIL PROTECTED]> wrote: > > > > > Luis M. González wrote: > > > On 6 feb, 21:17, Fuzzyman <[EMAIL PROTECTED]> wrote: > > > > On Feb 6, 9:59 pm, "Luis M. Gonz�lez" <[EMAIL PROTECTED]> wrote: > > > > > > O

Re: Looking for library to estimate likeness of two strings

2008-02-07 Thread Gabriel Genellina
En Thu, 07 Feb 2008 13:25:14 -0200, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > Many thanks for the excellent leads. I've also found several > functions to find phonetic similarity between English names: the > mentioned above soundex, then, also, one called metaphone. I'm now > thinking

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

2008-02-07 Thread Huayang Xia
What's the difference between .NET DLL and normal C DLL? Do you mean after clr.AddReference('ClassLibrary1'), there is no need to import ClassLibrary1? -- http://mail.python.org/mailman/listinfo/python-list

brain stuck. whats occurring here?

2008-02-07 Thread Matthew_WARREN
Hallo, I'm after [[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]]] (NxN 'grid', 5x5 in that example, and while typing this up i figured out how to get it, but I'm still not sure what _was_ happening) I'm trying a=[] >>> row=[ [] for n in range(0,10) ]

Re: a trick with lists ?

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

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

2008-02-07 Thread pruebauno
On Feb 7, 11:01 am, "Denis Bilenko" <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > These versions differ with respect to treatment of blank lines, which > > indicates how easy it is to go astray in this kind of semantic > > optimization. Your example simply wouldn't work (though you could pa

Re: python beginner problem(?)

2008-02-07 Thread Alan Illeman
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Alan Illeman wrote: > > > > Thanks Steve for both your replies. > > Was (or is) python a piggyback for MFC? > > > > > You are supposed to be able to access the MFC classes through PythonWin, > but I have never personally b

Re: Distinguishing between functions and methods in a decorator.

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

Distinguishing between functions and methods in a decorator.

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

Re: Why not a Python compiler?

2008-02-07 Thread Stefan Behnel
Jean-Paul Calderone wrote: > On Thu, 07 Feb 2008 11:03:12 +0100, Stefan Behnel <[EMAIL PROTECTED]> > wrote: >> Take a look at Cython. It's an optimising Python-to-C compiler for >> writing >> Python extensions. So you can basically take a Python module and >> compile it to >> C code that runs again

Re: Looking for library to estimate likeness of two strings

2008-02-07 Thread Guilherme Polo
2008/2/7, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > On Feb 7, 2:37 am, "Daniel Fetchinson" <[EMAIL PROTECTED]> > wrote: > > > Hi folks, just went through this thread and a related one from 2006 > > and I was wondering what the best solution is for using these string > > metrics in a database sear

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

2008-02-07 Thread Christian Heimes
Luis M. González wrote: > Oh, I know what you mean. > But that was exactly the reason for having a .DLLs folder, isn't it? > When you place an assembly into this folder, you avoid having to write > this boilerplate code, and simply import the assembly as you would > with a normal python module. At

Re: Why not a Python compiler?

2008-02-07 Thread [EMAIL PROTECTED]
On Feb 7, 9:06 am, Steve Holden <[EMAIL PROTECTED]> wrote: > Ryszard Szopa wrote: > > On Feb 5, 9:30 am, [EMAIL PROTECTED] wrote: > > >> I don't know the exact details but I think the issue is the dynamic > >> nature of Python makes it impossible to correctly store the various > >> types and change

Re: socket script from perl -> python

2008-02-07 Thread Jerry Hill
On Feb 7, 2008 9:39 AM, kettle <[EMAIL PROTECTED]> wrote: > f = open('/home/myuname/socket.wav','rb') > audio = "" > for line in f: > audio += line I don't know anything about socket programming in python, but this bit doesn't seem right for working on a binary file. You should just read all

Re: Must COMMIT after SELECT

2008-02-07 Thread M.-A. Lemburg
On 2008-02-07 14:29, Steve Holden wrote: > Paul Boddie wrote: >> With PostgreSQL, my impression is that the intended way of using >> cursors is not entirely compatible with the DB-API: you declare >> cursors only when you know what the query will be, not in advance, and >> they can only be used wit

Re: Looking for library to estimate likeness of two strings

2008-02-07 Thread [EMAIL PROTECTED]
On Feb 7, 2:37 am, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi folks, just went through this thread and a related one from 2006 > and I was wondering what the best solution is for using these string > metrics in a database search. If I want to query the database for a > string or something

CVS access with Python

2008-02-07 Thread Ravi Kumar
I have to design a Web-based CVS client. I could not find any module, cvs-binding in python. I have investigated all sort of Web Interface, including Sandweb, and ViewCVS etc. But these provide Read-only access and features. I need to provide almost all sort of basic features a developer frequentl

ANN: ConfigObj 4.5.1 and validate 0.3.1

2008-02-07 Thread Fuzzyman
After one year and two days since the last release, there is a new release of ConfigObj. * ConfigObj 4.5.1 http://www.voidspace.org.uk/python/configobj.html> * Validate 0.3.1 http://www.voidspace.org.uk/python/validate.html This release adds a few new features, plus has several bugfixes and minor

Re: Looking for library to estimate likeness of two strings

2008-02-07 Thread JKPeck
On Feb 7, 6:11 am, Lee Capps <[EMAIL PROTECTED]> wrote: > At 14:01 Wed 06 Feb 2008, [EMAIL PROTECTED] wrote: > > >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 > >nam

Re: index() of sequence type?

2008-02-07 Thread Steve Holden
Neal Becker wrote: > I see list has index member, but is there an index function that applies to > any sequence type? > > If not, shouldn't there be? > Hitler would doubtless have wanted one. regards Steve [who knows this is a futile and incorrect attempt to have this thread suffer from prema

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

2008-02-07 Thread Steve Holden
Denis Bilenko wrote: > Tim Golden wrote: > >> Dodging your question slightly (and at the risk of teaching >> my grandmother to suck eggs) I sometimes use this idiom for >> checking params. Obviously it only goes so far, but it's >> fairly compact: > >> >> import os, sys > >> if __name__ == '__m

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

2008-02-07 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Steven D'Aprano: >> With the greatest respect, I think that if you think the second example >> "is more clear", you're completely bonkers. *grins* > It's amusing how often "with the greatest respect" is used to preface a statement that clearly implies very little respec

Re: Why not a Python compiler?

2008-02-07 Thread Steve Holden
Ryszard Szopa wrote: > On Feb 5, 9:30 am, [EMAIL PROTECTED] wrote: > >> I don't know the exact details but I think the issue is the dynamic >> nature of Python makes it impossible to correctly store the various >> types and changes into compiled code. Someone else will probably be >> able to provi

Re: getting all user defined attributes of a class

2008-02-07 Thread George Sakkis
On Feb 7, 1:42 pm, Amit Gupta <[EMAIL PROTECTED]> wrote: > Thanks. What I found is: If I call iterate over the __dict__ of the > instance of the class, I only get user-atttributes and not built-in > attributes. I have an instance of that class, anyway, so this will do. > However, I wonder if I am

Re: Dear David (was: MyHDL project)

2008-02-07 Thread ajaksu
On Feb 7, 4:48 pm, "Blubaugh, David A." <[EMAIL PROTECTED]> wrote: > sir, > > Is there still a possibility to collaborate??? > > David Blubaugh Dear David A. Blubaugh, Could you please make it a little less painful to read your messages? You're giving a bad name to Belcan, too. Daniel -- http:/

Re: a trick with lists ?

2008-02-07 Thread Steve Holden
Tim Chase wrote: self.tasks[:] = tasks What I do not fully understand is the line "self.tasks[:] = tasks". Why does the guy who coded this did not write it as "self.tasks = tasks"? What is the use of the "[:]" trick ? >>> It changes the list in-place. If i

Re: Distinguishing between functions and methods in a decorator.

2008-02-07 Thread Arnaud Delobelle
On Feb 7, 4:10 pm, Berteun Damman <[EMAIL PROTECTED]> wrote: > Hello, > > I was wondering a bit about the differences between methods and > functions. I have the following: > > def wrap(arg): > print type(arg) > return arg > > class C: > def f(): > pass > > @wrap > def g

embedding python

2008-02-07 Thread Robert Dailey
Hi, I'm attempting to embed python into my game. What I want to do is the following: 1) Embed the interpreter into my game (Py_Initialize(), etc) using the Python C API 2) Execute modules from my game using the python interpreter (Using boost.python's objects and handles) 3) Expose C++ interfaces

Re: brain stuck. whats occurring here?

2008-02-07 Thread Robin Becker
[EMAIL PROTECTED] wrote: > Hallo, > > I'm after > > [[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]]] > > (NxN 'grid', 5x5 in that example, and while typing this up i figured out > how to get it, but I'm still not sure what _was_ happening) > > > I'm trying

Re: beginners help

2008-02-07 Thread Steve Holden
Tim Chase wrote: >> If i enter a center digit like 5 for example i need to create two >> vertical and horzitonal rows that looks like this. If i enter 6 it shows >> 6 six starts. How can i do this, because i don't have any clue. >> >> * >> * * >> * * >> * * >> * > > Well we start by

  1   2   >