Re: dynamic inheritance

2006-06-09 Thread Kay Schluehr
alf wrote: > is there any way to tell the class the base class during runtime? > > a. Example: >>> class A(object):pass >>> class B(A):pass >>> B.mro() [, , ] See also Micheles nice article about the semantics of the "mro" ( method resolution order). http://www.python.org/download/releases/2.3

Re: Importing again and again

2006-06-09 Thread Steve Holden
abcd wrote: > If I have code which imports a module over and over again...say each > time a function is called, does that cause Python to actually re-import > it...or will it skip it once the module has been imported?? > > for example: > > def foo(): > import bar > bar.printStuff() > > f

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hello, > > Terry Reedy wrote: > >>So I do not see any point or usefulness in saying that a tuple subcript is >>not what it is. > > > I know that a tuple is *constructed*. The question is, is this, > conceptually, the feature that allows you to ommit the parentheses of

Error in Chain of Function calls

2006-06-09 Thread Girish Sahani
Hi, There is a code in my main function which is something like: while prunedFinal != []: prunedNew = genColocations(prunedK) *** tableInstancesNew = genTableInstances(prunedNew,tableInstancesK) tiCountDict = tiCount(tableInstancesNew) tiDic

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread Fredrik Lundh
A.M wrote: > It works very fine with DIR command, but for commands like "MD :" it doesn't > return the error message into the string: > > print os.popen('MD :').read() > > # No error message in python, "MD" is spelled os.mkdir. > Am I missing anything? the difference between STDOUT and STDER

Re: Select hangs after some reads

2006-06-09 Thread Steve Holden
Donn Cave wrote: > In article <[EMAIL PROTECTED]>, > Steve Holden <[EMAIL PROTECTED]> wrote: > > >>The PSH flag indicates that the data stream must be flushed right >>through to the other end. This is essential for interactive protocols >>such as FTP: without it the server has no way to know t

Re: better Python IDE? Mimics Maya's script editor?

2006-06-09 Thread Steve Holden
warpcat wrote: > I've been scripting in Maya, via mel for years now. Recently learning > to Python, love it. Thing that's driving me nuts it the IDE. I'm > using PythonWin right now and trying to find something better, mainly > with this functionality: > > In Maya's mel script editor window, it

Re: Exeucte a system command in python script

2006-06-09 Thread Steve Holden
[EMAIL PROTECTED] wrote: > I am using python 2.4, so I don' t need to insteall that module > separately. > > [EMAIL PROTECTED] wrote: > >>Thanks I get this error 'NameError: global name 'call' is not defined" >> >>I already import 'subprocess'. >> >>Can you pleaes tell me what am I missing? Amon

Re: Python Class for Apache log analysis

2006-06-09 Thread Steve Holden
And80 wrote: > Hi all, > I am looking for a python package that I could employ to analyze > Apache's log files in real time. Of course I already have found some > scripts, but most of them are outdated (python1.5), while others are > simply impossible to use for a custom application. I was looking

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Well, what do you think about this? -0 from me, but it's definitely a PEP-able proposal. suggestion: turn your post into a pre-PEP and post it somewhere, post the patch to the patch tracker, and post a brief heads-up to python-dev, and see what happens. (you probabl

RE: better Python IDE? Mimics Maya's script editor?

2006-06-09 Thread Tim Golden
[Steve Holden] | warpcat wrote: | > In Maya's mel script editor window, it's split into two sections. | > Bottom window you can enter commands (where your script lives), top | > window gives results. The thing I'm really used to is | highlighting X# | > of lines in the bottom window (little sni

Re: Error in Chain of Function calls

2006-06-09 Thread Fredrik Lundh
Girish Sahani wrote: > However i am getting an error at the line marked with ***. what error ? > Also,i am getting a ValueError in the code below: > > for s in prunedNew: > substrings = [s[:i]+s[i+1:] for i in range(len(s))] > for string in substrin

Re: Select hangs after some reads

2006-06-09 Thread Fredrik Lundh
Steve Holden wrote: > Nope, I wouldn't look any harder. You and I both know you won't find > them. "The client" in this case was the client's transport layer, not > the client application - I should have said "sender", since I referred > to the system at the other end as the "receiver". you kn

Re: dynamic inheritance

2006-06-09 Thread bruno at modulix
alf wrote: > is there any way to tell the class the base class during runtime? > Technically, yes - the solution depending on your definition of "during runtime" FWIW, the class statement is evaled at import/load time, which is "during runtime" So if you want to use one or other (compatible)

Re: How to generate k+1 length strings from a list of k length strings?

2006-06-09 Thread Boris Borcic
[EMAIL PROTECTED] wrote: > Boris Borcic: > >> I challenge you to write simpler code to do the equivalent. context ? > > I don't do challenges. Pfff... and you don't do real debates either. > I too have written the code to solve that > problem, Why ? When ? -- http://mail.python.org/mailman/

Re: tracking dependencies

2006-06-09 Thread Michele Simionato
Dennis Benzinger wrote: > > I've never tried it, but http://www.tarind.com/depgraph.html looks like > what you are looking for. This is EXACTLY what I had in mind :-) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Error in Chain of Function calls

2006-06-09 Thread bruno at modulix
Girish Sahani wrote: > Hi, > > There is a code in my main function which is something like: > > while prunedFinal != []: > prunedNew = genColocations(prunedK) *** > tableInstancesNew = genTableInstances(prunedNew,tableInstancesK) > tiCountDict = tiCount

Re: Importing again and again

2006-06-09 Thread Maric Michaud
Le Jeudi 08 Juin 2006 22:02, abcd a écrit : > > def foo(): > import bar > bar.printStuff() > > foo() > foo() > foo() > foo() > > ...will that re-import bar 4 times...or just import it once? is this a > big performance hit? Import a module more than once doesn't execute the code of this mo

Re: what are you using python language for?

2006-06-09 Thread bruno at modulix
baalbek wrote: > To score with the chicks! > > A Python script roams the nightclubs for beautiful women, finds an > appropriate woman based on my preferances, charms her with its sleek > Pythonic manners, calls for a cab and brings the lady to my recidency. > > Works like a charm! Is that OSS ?-

Re: How to generate k+1 length strings from a list of k length strings?

2006-06-09 Thread bearophileHUGS
Boris Borcic: > > I don't do challenges. > > Pfff... and you don't do real debates either. Different nations have different values and different cultures, in mine challenges are often seen as things for children, and a waste of time for adults (probably in USA challenges are appreciated more). By

Python to be used to build OLPC apps

2006-06-09 Thread Michael Dillon
The $100 laptop from MIT will be providing Python for application developers to use. This laptop is a low-power consumption innovative laptop that includes features like: - low-power wi-fi with longer than normal range and the ability to keep communicating after the CPU has been put to sleep. -

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The question is, is this, > conceptually, the feature that allows you to ommit the parentheses of a > tuple in some cases. To repeat: tuples are defined by commas. There are no 'parentheses of a tuple', except for empty tuples, to b

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread Carl Banks
Steve Holden wrote: > Hey, I have an idea, why don't we look at the language reference manual > instead of imagining how we think it might work! I don't know. Sounds risky. > In section 3.2 we find: > > > """ > Tuples > The items of a tuple are arbitrary Python objects. Tuples of two or more >

Re: How to generate k+1 length strings from a list of k length strings?

2006-06-09 Thread Boris Borcic
[EMAIL PROTECTED] wrote: > Boris Borcic: >>> I don't do challenges. >> Pfff... and you don't do real debates either. > > Different nations have different values and different cultures, in mine > challenges are often seen as things for children, and a waste of time > for adults (probably in USA cha

Re: better Python IDE? Mimics Maya's script editor?

2006-06-09 Thread Kay Schluehr
warpcat wrote: > I've been scripting in Maya, via mel for years now. Recently learning > to Python, love it. Thing that's driving me nuts it the IDE. http://wiki.python.org/moin/IntegratedDevelopmentEnvironments -- http://mail.python.org/mailman/listinfo/python-list

Re: How to generate k+1 length strings from a list of k length strings?

2006-06-09 Thread Boris Borcic
[EMAIL PROTECTED] wrote: > It's not that difficult to improve the readability of a quite long > line, you can start splitting it. The point is that it is observer and context dependent whether res = set(''.join(sorted(X|Y)) for X in sets for Y in sets

Amazon and Webservices

2006-06-09 Thread vpr
Hi All I've been trying to consume the webservices at Amazon using python. I have not been able to find a *good* webservices module and I've had a look at SOAPpy, etc. Yes I have googled etc, but there seems to be a lack of development in this space apart for one or two projects. Does anyone have

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread Steve Holden
Carl Banks wrote: > Steve Holden wrote: > >>Hey, I have an idea, why don't we look at the language reference manual >>instead of imagining how we think it might work! > > > I don't know. Sounds risky. > > > >>In section 3.2 we find: >> >> >>""" >>Tuples >>The items of a tuple are arbitrary P

Re: Large Dictionaries

2006-06-09 Thread Marcin Ciura
Tim Peters wrote: > shellsort is much more a refinement of insertion-sort than of > bubblesort, but is not an O(N log N) algorithm regardlesss. With a judiciously chosen increment sequence, the number of comparisons made by shellsort *is* of the order N log N for practical values of N. See Figure

Re: How to generate k+1 length strings from a list of k lengthstrings?

2006-06-09 Thread Sibylle Koczian
Girish Sahani schrieb: > Yes it is the former of course.Common elements could be in any order in > both strings. > Thanks Marc :)...though we need to add an if for checking the length of > the string (k+1). > No, why? Every character from string1 is removed from string2 at most once. And string2

Re: Amazon and Webservices

2006-06-09 Thread skip
vpr> I've been trying to consume the webservices at Amazon using python. vpr> I have not been able to find a *good* webservices module... pyamazon. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Instead of saving text files i need as html

2006-06-09 Thread Sion Arrowsmith
Tim Chase <[EMAIL PROTECTED]> wrote: >> [ ... ] >> urllib.urlretrieve(lines.strip('/n'), 'c:\\temp\\' \ >> + outfilename.strip('\n')[7:] + '.html') > [ ... ] I'm not sure what the odd >slicing is for, but I'll presume the OP knows what they're doing. It's taking the "http://"; o

Re: How to extract 2 integers from a string in python?

2006-06-09 Thread Sion Arrowsmith
Stephen Prinster <[EMAIL PROTECTED]> wrote: a, b, c, d = 'Total size: 173233 (371857)'.split() first_int, second_int = int(c), int(d[1:-1]) int(d[1:-1]) can be replaced by d.strip("()"), which may or may not be clearer in intent. -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread Fredrik Lundh
Sybren Stuvel wrote: > Just curious: how would you initialize 'x' in such a case? If I simply > say 'x = []' and then try to index it with x[1, 2], I get "TypeError: > list indices must be integers". that's up to the x implementation to decide, of course: >>> class MyContainer: ... def __ge

Re: How to generate k+1 length strings from a list of k length strings?

2006-06-09 Thread Boris Borcic
> Hum, since your code is not syntactically correct, anything will run > faster :) in fact it parses, I was fooled by this line >> if k in range(1,len(prunedK),1) & i+k <= len(prunedK) -1: I was fooled because the form "k in range(" tends to imply a for statement ; in the case of an

Re: Error in Chain of Function calls

2006-06-09 Thread Girish Sahani
> Girish Sahani wrote: > >> However i am getting an error at the line marked with ***. > > what error ? ...line 266, in colocationMiner prunedNew = genColocations(prunedK) genColocations is a function defined before which returns prunedNew. > >> Also,i am getting a ValueError in the code below: >>

Re: Large Dictionaries

2006-06-09 Thread Duncan Booth
Marcin Ciura wrote: > Tim Peters wrote: >> shellsort is much more a refinement of insertion-sort than of >> bubblesort, but is not an O(N log N) algorithm regardlesss. > > With a judiciously chosen increment sequence, > the number of comparisons made by shellsort > *is* of the order N log N for p

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread A.M
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > A.M wrote: > > > in python, "MD" is spelled os.mkdir. > >> Am I missing anything? > > the difference between STDOUT and STDERR, and the difference between > buffered output and non-buffered output, and perhaps a few ot

Writing PNG with pure Python

2006-06-09 Thread Johann C. Rocholl
Just in case anybody has the same problem, here's my first attempt at implementing a subset of the PNG spec in pure Python. I license it to you under the terms of the GNU GPL. http://trac.browsershots.org/browser/trunk/shotfactory/lib/image/png.py It encodes RGB images with 24 bits per pixel into

Re: Error in Chain of Function calls

2006-06-09 Thread Fredrik Lundh
Girish Sahani wrote: >> what error ? > ...line 266, in colocationMiner > prunedNew = genColocations(prunedK) > genColocations is a function defined before which returns prunedNew. that's a line of code, not an error. please include the entire traceback, or at least the actual error message. al

Re: Error in Chain of Function calls

2006-06-09 Thread Boris Borcic
Girish Sahani wrote: > > Also,i am getting a ValueError in the code below: > > for s in prunedNew: > substrings = [s[:i]+s[i+1:] for i in range(len(s))] > for string in substrings: > if string not in prunedK: >

Short questions wrt Python & Unicode

2006-06-09 Thread KvS
Hi all, I've been reading about unicode in general and using it in Python in particular lately as this turns out to be not so straightforward actually. I wanted to aks two questions: 1) I'm writing a program that interacts with the user through wxPython (unicode build) and stores & retrieves data

Re: Large Dictionaries

2006-06-09 Thread Marcin Ciura
Duncan Booth wrote: > Marcin Ciura wrote: >>See Figure 8 in >>http://sun.iinf.polsl.gliwice.pl/~mciura/shellsort.pdf > That isn't what the reference says. It only covers N up to a few thousand. > Practical values of N need to at least go up into the millions. Please look at the performance graph

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread Steve Holden
A.M wrote: > "Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>A.M wrote: >> >> >>in python, "MD" is spelled os.mkdir. >> >> >>>Am I missing anything? >> >>the difference between STDOUT and STDERR, and the difference between >>buffered output and non-buffered outp

How to link foreign keys & primary keys using python?

2006-06-09 Thread sonal
Hi all, I hv started with python just recently... and have been assigned to make an utility which would be used for data validations... In short we take up various comma separated data files for eg: area.txt, school.txt, students.txt and so on (ok?!?) now, 1. area code used in the school.txt m

Re: Error in Chain of Function calls

2006-06-09 Thread bruno at modulix
Girish Sahani wrote: >>Girish Sahani wrote: >> >> >>>However i am getting an error at the line marked with ***. >> >>what error ? > > ...line 266, in colocationMiner Great. We now know at which line of an unknown file an unknown error happens. Will use my PythonPsychicPowers(tm) now to see waht's

Re: Large Dictionaries

2006-06-09 Thread Duncan Booth
Marcin Ciura wrote: > Duncan Booth wrote: >> Marcin Ciura wrote: >>>See Figure 8 in >>>http://sun.iinf.polsl.gliwice.pl/~mciura/shellsort.pdf >> That isn't what the reference says. It only covers N up to a few >> thousand. Practical values of N need to at least go up into the >> millions. > > Pl

Re: Short questions wrt Python & Unicode

2006-06-09 Thread John Machin
On 9/06/2006 10:04 PM, KvS wrote: > 2) How do I get a representation of a unic. object in terms of Unicode > code points? repr() doesn't do that, it sometimes parses or encodes the > code points right: > >|>>> s=u"\u0040\u0166\u00e6" >|>>> s > u'@\u0166\xe6' |>>> ' '.join('U+%04X % ord(c) for c

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread spam . noam
Hello, Sybren Stuvel wrote: > I think it's ugly to begin with. In math, one would write simply 'x' > to denote an unsubscribed (ubsubscripted?) 'x'. And another point, why > would one call __getitem__ without an item to call? I think that in this case, mathematical notation is different from pyth

Re: wddx problem with entities

2006-06-09 Thread Tim Arnold
"Tim Arnold" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm confused about why I get this error: > UnicodeError: ASCII encoding error: ordinal not in range(128) > > when I try to load a wddx file containing this string: > The image file, gif/aperçu.png, does > n

Re: Short questions wrt Python & Unicode

2006-06-09 Thread Fredrik Lundh
KvS wrote: s=u"\u0040\u0166\u00e6" s > u'@\u0166\xe6' > > (does this latter \xe6 have to do with the internal representation of > unic. objects, maybe with this UCS-2 encoding?) no, it's simply the shortest way to represent U+00E6 as Python Unicode string literal, when limited to ASC

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread spam . noam
Hello, Fredrik Lundh wrote: > (but should it really result in an empty tuple? wouldn't None be a bit > more Pythonic?) I don't think it would. First of all, x[()] already has the desired meaning in numpy. But I think it's the right thing - if you think of what's inside the brackets as a list of

Re: Where is the ucs-32 codec?

2006-06-09 Thread [EMAIL PROTECTED]
Méta-MCI wrote: > Hi! > > Look at: http://cjkpython.berlios.de (iconvcodec) > > (Serge Orlov has built a version for Python 2.4 "special for me"; thanks to > him). > Thanks for the pointer. iconvcodec should do the job, but I still want a native implementation to be included with any python. --

Re: Short questions wrt Python & Unicode

2006-06-09 Thread KvS
John Machin wrote: > On 9/06/2006 10:04 PM, KvS wrote: > > > 2) How do I get a representation of a unic. object in terms of Unicode > > code points? repr() doesn't do that, it sometimes parses or encodes the > > code points right: > > > >|>>> s=u"\u0040\u0166\u00e6" > >|>>> s > > u'@\u0166\xe6' >

Re: Where is the ucs-32 codec?

2006-06-09 Thread [EMAIL PROTECTED]
Martin v. Löwis wrote: > Erik Max Francis wrote: > >> The only reason is that nobody has needed one so far, and because > >> it is quite some work to do if done correctly. Why do you need it? > > Somebody asked me about generating UTF-32 (he didn't have choice of the output format). I was about to

Re: better Python IDE? Mimics Maya's script editor?

2006-06-09 Thread Slawomir Nowaczyk
On Thu, 08 Jun 2006 16:40:48 -0700 warpcat <[EMAIL PROTECTED]> wrote: #> I'm using PythonWin right now and trying to find something better, #> mainly with this functionality: *Assuming* I understood your description correctly, python-mode in Emacs does what you want. Emacs is hardly a substitute

Re: secure xmlrpc server?

2006-06-09 Thread Kent Johnson
Laszlo Nagy wrote: > But I do not know how to create an XML RPC server in Python that uses > HTTPS for XML transports. This recent recipe seems to do exactly what you want: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496786 Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Select hangs after some reads

2006-06-09 Thread [EMAIL PROTECTED]
Grant Edwards escreveu: > On 2006-06-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >>> Well, actually I´m using a very simple protocol wich sends > >>> only strings ended by newline. I need to send 3 chunks of > >>> information and a newline after them. On the reader side I > >>> make 3 re

Re: Where is the ucs-32 codec?

2006-06-09 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Somebody asked me about generating UTF-32 (he didn't have choice of the > output format). I was about to propose the obvious ``u.encode('utf-32')`` > but discovered it's missing. hint 1: >>> u = u"Hello" >>> a = array.array("I", map(ord, u)) >>> a.tostring() 'H\x0

Re: secure xmlrpc server?

2006-06-09 Thread Kent Johnson
Kent Johnson wrote: > Laszlo Nagy wrote: >> But I do not know how to create an XML RPC server in Python that uses >> HTTPS for XML transports. > > This recent recipe seems to do exactly what you want: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496786 It was gently pointed out to m

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread Antoon Pardon
Op 2006-06-08, [EMAIL PROTECTED] schreef <[EMAIL PROTECTED]>: > Hello, > > Terry Reedy wrote: >> > In a few more words: Currently, an object can be subscripted by a few >> > elements, separated by commas. It is evaluated as if the object was >> > subscripted by a tuple containing those elements. >>

Getting start/end dates given week-number

2006-06-09 Thread Tim Chase
I've been trying to come up with a good algorithm for determining the starting and ending dates given the week number (as defined by the strftime("%W") function). My preference would be for a Sunday->Saturday range rather than a Monday->Sunday range. Thus, >>> startDate, stopDate = weekBound

Re: UltraEdit and Python

2006-06-09 Thread kilnhead
Check out the following link: http://gurno.com/adam/python_wordfile.txt gregory diaczok wrote: > How do I sent up Ultra Edit to work w/ Python? > > How do I get Ultra Edit to run a Python script currently in the edit window > and supply results? > > I can't figure out how to get Ultra Edit to in

Re: How to link foreign keys & primary keys using python?

2006-06-09 Thread MTD
Your post is confusing. Here is my advice: investigate the use of dictionaries. Dictionaries can allow you to define data in the form { key:data }, e.g. { area_code : area_data } { (area_code,school_code) : school_data } { (school_code,student_code) : student_data } -- http://mail.python.org/m

removing dictionary key-pair

2006-06-09 Thread JD
Hello, I try to remove a dictionary key-pair (remove an entry), but I'm unsuccessful. Does anyone know how to achieve this? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: removing dictionary key-pair

2006-06-09 Thread bearophileHUGS
JD>I try to remove a dictionary key-pair (remove an entry), >>> d = {1:2, 3:4} >>> d {1: 2, 3: 4} >>> del d[1] >>> d {3: 4} Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting start/end dates given week-number

2006-06-09 Thread [EMAIL PROTECTED]
see the calendar faq http://www.faqs.org/faqs/calendars/faq/part3/, look especially in section 6.7. Tim Chase wrote: > I've been trying to come up with a good algorithm for determining > the starting and ending dates given the week number (as defined > by the strftime("%W") function). > > My prefe

Re: removing dictionary key-pair

2006-06-09 Thread bruno at modulix
JD wrote: > Hello, > > I try to remove a dictionary key-pair (remove an entry), > but I'm unsuccessful. Does anyone know how to achieve this? > > Thanks mydict = {"key" : "value"} del mydict(key) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p

Re: removing dictionary key-pair

2006-06-09 Thread Steve Holden
JD wrote: > Hello, > > I try to remove a dictionary key-pair (remove an entry), > but I'm unsuccessful. Does anyone know how to achieve this? > > Thanks >>> d = {1: "one", 2: "two", 3: "three"} >>> del d[2] >>> d {1: 'one', 3: 'three'} >>> regards Steve -- Steve Holden +44 150

Re: removing dictionary key-pair

2006-06-09 Thread [EMAIL PROTECTED]
JD wrote: > Hello, > > I try to remove a dictionary key-pair (remove an entry), > but I'm unsuccessful. Does anyone know how to achieve this? > > Thanks Assuming you know the key: d = {"foo":1,"bar":2} print d del(d["foo"]) print d -- http://mail.python.org/mailman/listinfo/python-list

Re: removing dictionary key-pair

2006-06-09 Thread bruno at modulix
bruno at modulix wrote: > JD wrote: > >>Hello, >> >>I try to remove a dictionary key-pair (remove an entry), >>but I'm unsuccessful. Does anyone know how to achieve this? >> >>Thanks > > > mydict = {"key" : "value"} > del mydict(key) grmf... Typo. This is: del mydict['key'] of course... --

Re: removing dictionary key-pair

2006-06-09 Thread [EMAIL PROTECTED]
JD wrote: > Hello, > > I try to remove a dictionary key-pair (remove an entry), > but I'm unsuccessful. Does anyone know how to achieve this? > > Thanks d = dict(a=1, b=2, c=3) print d del d['a'] print d -- http://mail.python.org/mailman/listinfo/python-list

Re: UltraEdit and Python

2006-06-09 Thread John Salerno
gregory diaczok wrote: > How do I sent up Ultra Edit to work w/ Python? What do you mean? > How do I get Ultra Edit to run a Python script currently in the edit window > and supply results? With much help from Kent Johnson, I have the following line set up in a custom Tool Configuration: C:\Py

Re: Writing PNG with pure Python

2006-06-09 Thread Johann C. Rocholl
> You should really also include the alpha channel. Without that, PNG is > crippled IMHO. I have now added simple transparency (marking one color as transparent with a tRNS chunk). If anybody wants full alpha channel support, ask kindly or send me a patch. I would like to avoid duplicating all the

Re: What is Expressiveness in a Computer Language

2006-06-09 Thread Joe Marshall
Xah Lee wrote: > in March, i posted a essay "What is Expressiveness in a Computer > Language", archived at: > http://xahlee.org/perl-python/what_is_expresiveness.html > > I was informed then that there is a academic paper written on this > subject. > > On the Expressive Power of Programming Langua

Interacting with a process that I ran with subprocess module

2006-06-09 Thread [EMAIL PROTECTED]
Hi folks, I'm trying to use the nmap runtime interaction feature while using it with the subprocess module. For those not familiar with nmap, the runtime interaction feature allow users to get informations about the scan stats during the nmap execution. More at: http://www.insecure.org/nmap/man/ma

Re: Interacting with a process that I ran with subprocess module

2006-06-09 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Hi folks, > > I'm trying to use the nmap runtime interaction feature while using it > with the subprocess module. For those not familiar with nmap, the > runtime interaction feature allow users to get informations about the > scan stats during the nmap execution. More

[noob question] References and copying

2006-06-09 Thread zefciu
Hello! Where can I find a good explanation when does an interpreter copy the value, and when does it create the reference. I thought I understand it, but I have just typed in following commands: >>> a=[[1,2],[3,4]] >>> b=a[1] >>> b=[5,6] >>> a [[1, 2], [3, 4]] >>> b [5, 6] And I don't understan

Re: What is Expressiveness in a Computer Language

2006-06-09 Thread Paul McGuire
"Joe Marshall" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Expressiveness isn't necessarily a good thing. For instance, in C, you > can express the > addresses of variables by using pointers. You cannot express the same > thing in Java, and > most people consider this to be

Re: How to extract 2 integers from a string in python?

2006-06-09 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Klaus Alexander Seistrup <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] skrev: > >> how can I extract 2 integers from a string in python? >> >> for example, my source string is this: >> Total size: 173233 (371587) >> >> I want to extract the integer 173233 and 371587

Re: [noob question] References and copying

2006-06-09 Thread Boris Borcic
zefciu wrote: > Hello! > > Where can I find a good explanation when does an interpreter copy the > value, and when does it create the reference. I thought I understand > it, but I have just typed in following commands: > a=[[1,2],[3,4]] b=a[1] b=[5,6] a > [[1, 2], [3, 4]] >>>

Re: CONSTRUCT - Python's way of Ruby's "alias_method"

2006-06-09 Thread Ilias Lazaridis
Maric Michaud wrote: > Le Jeudi 08 Juin 2006 14:28, Ilias Lazaridis a écrit : >> Another possibility is to enlink (hook?) the functionality into an >> existent function >> >> Is there any way (beside a patch) to alter the behaviour to an existing >> function. Is ther a python construct similar to t

Re: Error in Chain of Function calls (Code Attached)

2006-06-09 Thread Girish Sahani
> Girish Sahani wrote: >> Hi, >> >> There is a code in my main function which is something like: >> >> while prunedFinal != []: >> prunedNew = genColocations(prunedK) *** >> tableInstancesNew = >> genTableInstances(prunedNew,tableInstancesK) >> tiCountDic

Re: [noob question] References and copying

2006-06-09 Thread Steve Holden
zefciu wrote: > Hello! > > Where can I find a good explanation when does an interpreter copy the > value, and when does it create the reference. I thought I understand > it, but I have just typed in following commands: > > a=[[1,2],[3,4]] b=a[1] b=[5,6] a > > [[1, 2], [3, 4]] >

Re: References and copying

2006-06-09 Thread [EMAIL PROTECTED]
> Where can I find a good explanation when does an interpreter copy the > value, and when does it create the reference. Any good Python book. I have Learning Python and Programming Python 2nd edition and they are very good IMO. > I thought I understand > it, but I have just typed in following comm

About sizers..

2006-06-09 Thread Mario Lacunza
Hi, Im build a cross platform application develop with Python and wxPython and I ask for your opinions about if is a good choice use sizers for my frames design? or not? Other techniques? Thanks in advance! Mi configuracion/My config: Ubuntu Dapper 6.06 Linux Kernel 2.6.15.23.386 Python 2.4.3

About sizers..

2006-06-09 Thread Mario Lacunza
Hi, Im build a cross platform application develop with Python and wxPython and I ask for your opinions about if is a good choice use sizers for my frames design? or not? Other techniques? Thanks in advance! Mi configuracion/My config: Ubuntu Dapper 6.06 Linux Kernel 2.6.15.23.386 Python 2.4.3

Re: How to link foreign keys & primary keys using python?

2006-06-09 Thread Harry George
"sonal" <[EMAIL PROTECTED]> writes: > Hi all, > I hv started with python just recently... and have been assigned to > make an utility which would be used for data validations... ,snip] > plz help me... till get my hands on python... :) > 1. This sure looks like a school assignment. 2. "till g

Thread specific singleton

2006-06-09 Thread Gabriele Farina
Hi, I'm tring to implement a Singleton object that should be specific for every thread who create it, not global. I tried a solution that seems to work, but I have a very poor knowledge of concurrent programming, so I'd like someone to help me find some problems in my implementation. Here is t

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread A.M
> I dare hardly suggest this, but might it not be better to use Python's > database functionality to perform the task? The language can access both > databases, and you might find it quicker. Then again, if your database > experience is limited, you may not ... > > regards > Steve > -- > Steve

Re: Error in Chain of Function calls (Code Attached)

2006-06-09 Thread Boris Borcic
Girish Sahani wrote: >>> However i am getting an error at the line marked with ***. >> Which error ? How do you hope us to be of any help here if you don't *at >> least* provide the full traceback ? FWIW, the canonical way to do things >> is to: >> - provide minimal *runnable* code exposing the p

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread Steve Holden
A.M wrote: >>I dare hardly suggest this, but might it not be better to use Python's >>database functionality to perform the task? The language can access both >>databases, and you might find it quicker. Then again, if your database >>experience is limited, you may not ... >> >>regards >> Steve >>

Re: What is Expressiveness in a Computer Language

2006-06-09 Thread Simon Richard Clarkstone
Joe Marshall wrote: > Xah Lee wrote: >>On the Expressive Power of Programming Languages, by Matthias >>Felleisen, 1990. >>http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf > > The gist of the paper is this: Some computer languages seem to be > `more expressiv

Re: capture video from camera

2006-06-09 Thread dan
K.S.Sreeram wrote: > dan wrote: > > I hope you won't be deterred from posting further questions to the > > group by Fredrik's somewhat terse and unfriendly reply. > > > > comp.lang.python is a forum generally noted for its pleasing admixture > > of erudition and encouragement. Fredrik is uncommonly

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread spam . noam
Hello, Following Fredrik's suggestion, I wrote a pre-PEP. It's available on the wiki, at http://wiki.python.org/moin/EmptySubscriptListPEP and I also copied it to this message. Have a good day, Noam PEP: XXX Title: Allow Empty Subscript List Without Parentheses Version: $Revision$ Last-Modified

regexp questoin

2006-06-09 Thread micklee74
hi i created a script to ask user for an input that can be a pattern right now, i use re to compile that pattern pat = re.compile(r"%s" %(userinput) ) #userinput is passed from command line argument if the user key in a pattern , eg [-] , and my script will search some lines that contains [-] p

Re: [noob question] References and copying

2006-06-09 Thread bruno at modulix
zefciu wrote: > Hello! > > Where can I find a good explanation when does an interpreter copy the > value, and when does it create the reference. Unless you explicitely ask for a copy (either using the copy module or a specific function or method), you'll get a reference. > I thought I understan

Re: References and copying

2006-06-09 Thread bruno at modulix
[EMAIL PROTECTED] wrote: >>Where can I find a good explanation when does an interpreter copy the >>value, and when does it create the reference. > > Any good Python book. I have Learning Python and Programming Python 2nd > edition and they are very good IMO. > > >>I thought I understand >>it, bu

Re: regexp questoin

2006-06-09 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > hi > > i created a script to ask user for an input that can be a pattern > right now, i use re to compile that pattern > pat = re.compile(r"%s" %(userinput) ) #userinput is passed from > command line argument > if the user key in a pattern , eg [-] , and my script will

Re: Newbie question about updating multiple objects ...

2006-06-09 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > All, > Hello and welcome to Python. > Apologies in advance: I'm new to Python and OO, and I'm sure this is a > really simple question, but I just can't seem to crack it on my own, or > through looking at examples. I'm playing around with VPython > (http://www.vypthon.org

  1   2   3   >