Re: using target words from arrays in regex, pythons version of perls 'map'

2006-05-15 Thread Paul McGuire
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 15 May 2006 19:41:39 -0500, Lance Hoffmeyer > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > I would have something similar to perl above: > > > > > > targets = ['OVERALL RATING', > >

Using python for a CAD program

2006-05-15 Thread 63q2o4i02
Hi, I'm interested in using python to start writing a CAD program for electrical design. I just got done reading Steven Rubin's book, I've used "real" EDA tools, and I have an MSEE, so I know what I *want* at the end of this; I just have never taken on a programming task of this magnitude. I've s

Re: Multiple inheritance : waht does this error mean ?

2006-05-15 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I am using Python 2.4.3 > class K(object,list): >...: pass >...: > > Traceback (most recent call last): > File "", line 1, in ? > TypeError: Error when calling the metaclass bases > Canno

Re: How to guess the language of a given textstring?

2006-05-15 Thread Roman
Hi This is what I'm looking for. Thank you. Roman gene tani schrieb: > Roman wrote: > > Does anybody know an easy way (or tool) to guess the language of a > > given text string? > > > > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355807 > http://aspn.activestate.com/ASPN/Cookboo

Re: using target words from arrays in regex, pythons version of perls 'map'

2006-05-15 Thread John Machin
Would you believe "steps 3 & 4"? -- http://mail.python.org/mailman/listinfo/python-list

Re: Large Dictionaries

2006-05-15 Thread Maric Michaud
Le Lundi 15 Mai 2006 21:07, Diez B. Roggisch a écrit : > > d={}.fromkeys(xrange(5*10**6)) ? > > That is a totally different beast. You don't want to insert arbitrary > keys, you want the internal hash-array to be of the right size. But you can replace the xrange part by any generator function you

Re: using target words from arrays in regex, pythons version of perls 'map'

2006-05-15 Thread John Machin
Think about how well the above solutions scale as len(targets) increases. 1. Make "targets" a set, not a list. 2. Have *ONE* regex which includes a bracketed match for a generic target e.g. ([A-Z\s]+) 3. Do *ONE* regex search, not 1 per target 4. If successful, check if the bracketed gizmoid is in

Re: Why does stack.inspect take so long?

2006-05-15 Thread 63q2o4i02
Tim Peters wrote: > [EMAIL PROTECTED] > > Hi, I've written a top-down recursive decent parser for SPICE circuit > > descriptions. For debugging purposes, I wanted each production ... > > Any clues? > > It should go much faster to use a function that doesn't crawl the > entire call stack. For e

Re: using target words from arrays in regex, pythons version of perls 'map'

2006-05-15 Thread Paddy
I don't like string interpolation within REs, it pops me out of 'RE mode' as I scan the line. Maybe creating a dict of matchobjects could be used in the larger context?: dict( [(t, re.search(t+regexp_tail, file2) for t in targets] ) (untested). - Pad. -- http://mail.python.org/mailman/listi

Re: Decrypt DES by password

2006-05-15 Thread Thomas Dybdahl Ahle
Den Mon, 15 May 2006 11:32:47 -0700. skrev Paul Rubin: > Thomas Dybdahl Ahle <[EMAIL PROTECTED]> writes: >> byte[] array2 = bytes1.CryptDeriveKey("DES", "MD5", 0, array1); >> > Anybody know how to do this in python? > > I'm not aware of a standard that says how CryptDeriveKey is supposed > to work

Re: Aggregate funuctions broken in MySQLdb?

2006-05-15 Thread Lorenzo
In article <[EMAIL PROTECTED]>, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Mon, 15 May 2006 20:14:29 GMT, John Salerno > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > Lorenzo Thurman wrote: > > > Thanks, that was my problem. Can you point me to some documentation

Re: Aggregate funuctions broken in MySQLdb?

2006-05-15 Thread Lorenzo
In article <[EMAIL PROTECTED]>, John Salerno <[EMAIL PROTECTED]> wrote: > http://sourceforge.net/docman/?group_id=22307 Yes, I did, but I did not find them thorough enough. -- "My Break-Dancing days are over, but there's always the Funky Chicken" --The Full Monty -- http://mail.python.org/mai

Far from complete

2006-05-15 Thread Kay Schluehr
Section 2.3 of the Python 2.5. tutorial "The following sections describe the standard types that are built into the interpreter. Historically, Python's built-in types have differed from user-defined types because it was not possible to use the built-in types as the basis for object-oriented inheri

Re: Multiple inheritance : waht does this error mean ?

2006-05-15 Thread John Machin
Question for you: what do you think that "class K(object,list):" means?? What are you trying to achieve? What do you plan to do with K? If you want it to be a subclass of list, all you have to do is "class K(list):". -- http://mail.python.org/mailman/listinfo/python-list

Argument Decorators Enhancement?

2006-05-15 Thread birchb
Guido has proposed a syntax for type annotations in Python-3000. Example: def foo(x: t1, y: t2) -> t3: ...body... http://www.artima.com/weblogs/viewpost.jsp?thread=87182 The types are dynamic and there is significant execution of code prior to the function body being called. Which tends to

Re: Multiple inheritance : waht does this error mean ?

2006-05-15 Thread Ben Finney
[EMAIL PROTECTED] writes: > >>>class K(object,list): >...: pass >...: > > Traceback (most recent call last): > File "", line 1, in ? > TypeError: Error when calling the metaclass bases > Cannot create a consistent metho

Multiple inheritance : waht does this error mean ?

2006-05-15 Thread jnair
I am using Python 2.4.3 >>>class K(object,list): ...: pass ...: Traceback (most recent call last): File "", line 1, in ? TypeError: Error when calling the metaclass bases Cannot create a consistent method resolution order

Re: C API: getting sys.argv

2006-05-15 Thread [EMAIL PROTECTED]
John Machin wrote: > > PyObject *_argv = PyImport_ImportModule("sys.argv"); > > What does the name of the function tell you? You can't do that in one > hit. Start with > PyObject *_sys = PyImport_ImportModule("sys"); > then you need to get the module's argv attribute. I just figured this out, doh

Re: C API: getting sys.argv

2006-05-15 Thread John Machin
> PyObject *_argv = PyImport_ImportModule("sys.argv"); What does the name of the function tell you? You can't do that in one hit. Start with PyObject *_sys = PyImport_ImportModule("sys"); then you need to get the module's argv attribute. However a better design might be have your extension module

Re: Large Dictionaries

2006-05-15 Thread Chris Foote
Aahz wrote: > In article <[EMAIL PROTECTED]>, > Roy Smith <[EMAIL PROTECTED]> wrote: >> In article <[EMAIL PROTECTED]>, Chris Foote <[EMAIL PROTECTED]> >> wrote: >>> I have the need to store a large (10M) number of keys in a hash table, >>> based on a tuple of (long_integer, integer). The standa

Re: Large Dictionaries

2006-05-15 Thread Chris Foote
Roy Smith wrote: > In article <[EMAIL PROTECTED]>, Chris Foote <[EMAIL PROTECTED]> > wrote: > >> I have the need to store a large (10M) number of keys in a hash table, >> based on a tuple of (long_integer, integer). The standard python >> dictionary works well for small numbers of keys, but star

Re: Why does stack.inspect take so long?

2006-05-15 Thread Tim Peters
[EMAIL PROTECTED] > Hi, I've written a top-down recursive decent parser for SPICE circuit > descriptions. For debugging purposes, I wanted each production > rule/function to know what its own name was, so at the beginning of > each rule/function, I make a call to inspect.stack()[0][3] (I think...)

Re: A critic of Guido's blog on Python's lambda

2006-05-15 Thread Rob Warnock
Ken Tilton <[EMAIL PROTECTED]> wrote: +--- | Having the reference implementation is the only thing that makes this | conceivably doable in a summer. What you are missing is something I have | often also gotten wrong: the core, cool functionality always comes easy | in the proof-of-c

C API: getting sys.argv

2006-05-15 Thread [EMAIL PROTECTED]
Hi, How would one go about getting sys.argv fom within the context of a C API extention module? I want to pass it along to C library that I'm calling from my module code. TIA~ I'm trying to load the sys module using: PyObject *_argv = PyImport_ImportModule("sys.argv"); but it is coming back N

Why does stack.inspect take so long?

2006-05-15 Thread 63q2o4i02
Hi, I've written a top-down recursive decent parser for SPICE circuit descriptions. For debugging purposes, I wanted each production rule/function to know what its own name was, so at the beginning of each rule/function, I make a call to inspect.stack()[0][3] (I think...) and that fetches the name

Re: Python modules

2006-05-15 Thread Robert Kern
Shirley Li wrote: > Dear Python experts, > > I'm a beginner of Python programming.I have a question about Python > modules. > > With the following: > = > import sys, os, string, math > from Numeric import * > from Matrix import * > = > at the beginning of my Py

Python modules

2006-05-15 Thread Shirley Li
Dear Python experts, I'm a beginner of Python programming.    I have a question about Python modules. With the following: = import sys, os, string, math from Numeric import * from Matrix import * = at the beginning of my Python script, it complained that "ImportErr

using target words from arrays in regex, pythons version of perls 'map'

2006-05-15 Thread Lance Hoffmeyer
Hey all, in perl I was able to use the same regular expression multiple times changing one part of it via a previously defined array and put the results into a new array IN PERL: my @targets = ('OVERALL RATING', 'CLOTHING', ' ITEMS', 'ACCESSORIES',

Re: Large Dictionaries

2006-05-15 Thread lcaamano
Sounds like PyTables could be useful. http://www.pytables.org -- lpc -- http://mail.python.org/mailman/listinfo/python-list

Re: Tabs versus Spaces in Source Code

2006-05-15 Thread achates
Harry George wrote: > The reason is simple: People get confused, and accidentally get the > wrong tab indents when they move among editors or among settings on > the same editor. People certainly do get confused. I'm always amazed that so many people, even amongst those who manage to make a livin

Re: Large Dictionaries

2006-05-15 Thread John Machin
1. Why is two minutes to insert 5M keys "bad" for you? What would be "good"? What would be good/bad look-up times? Have you measured the typical look-up time? How often is the dict creation required to be done? How often does the data change? Is multi-user access required for (a) look-up (b) updat

Re: taking qoutes in arguments

2006-05-15 Thread Ben Finney
"Lee Caine" <[EMAIL PROTECTED]> writes: > Im new to python and am in need of a little help Possibly also new to command-line shells? > Im attempting to write a program that finds and replaces text in all > files in a given directory. > example of running the program with arguments > >python

Re: How to guess the language of a given textstring?

2006-05-15 Thread gene tani
Roman wrote: > Does anybody know an easy way (or tool) to guess the language of a > given text string? > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355807 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/326576 -- http://mail.python.org/mailman/listinfo/python-list

Re: How to guess the language of a given textstring?

2006-05-15 Thread Lonnie Princehouse
A search to see how many words from the text belong to english/german/spanish common word dictionaries would be an easy way to get a crude guess at the language. -- http://mail.python.org/mailman/listinfo/python-list

Re: keyword help in Pythonwin interpreter

2006-05-15 Thread BartlebyScrivener
And others (including Fredrik Lundh) have found the same bug, it seems. http://mail.python.org/pipermail/python-list/2005-September/297157.html -- http://mail.python.org/mailman/listinfo/python-list

How to guess the language of a given textstring?

2006-05-15 Thread Roman
Does anybody know an easy way (or tool) to guess the language of a given text string? e.g. Feeding in "This is an example." --> should return "english" or ISO code Feeding in "Das ist ein Beispiel." --> should return "german" or ISO code Feeding in "Esto es un ejemplo." --> should return "spanis

Re: [PATCHES] [HACKERS] Iterating generator from C (PostgreSQL's pl/python RETUN

2006-05-15 Thread Hannu Krosing
Ühel kenal päeval, E, 2006-05-15 kell 17:21, kirjutas Tom Lane: > Hannu Krosing <[EMAIL PROTECTED]> writes: > >> Sven Suursoho wrote: > >>> As for testing in actual pl/python build environment, we had objections > >>> from > >>> leading postgresql Tom Lane that even if we do test it at build time

Re: my cryptogram program

2006-05-15 Thread Bruno Desthuilliers
Paul Rubin a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > >>def convert_quote(quote): >> return make_code(quote).split('|', 1) > > > I thought about suggesting that, but it's semantically different than > the original since it fails to raise an error if no vertical bar is > pres

Re: count items in generator

2006-05-15 Thread Bruno Desthuilliers
George Sakkis a écrit : (snip) > def length(iterable): > try: return len(iterable) > except: except TypeError: > i = 0 > for x in iterable: i += 1 > return i > (snip) -- http://mail.python.org/mailman/listinfo/python-list

Re: Tabs versus Spaces in Source Code

2006-05-15 Thread Peter Decker
On 5/15/06, Edward Elliott <[EMAIL PROTECTED]> wrote: > If such tools are lacking, use substitutes in the meantime. Don't allow any > code to be checked in where a line departs more than one tab indentation > level from its neighbors. It's not perfect, but it eliminates the worst > offenses. Go

Re: [HACKERS] Iterating generator from C (PostgreSQL's pl/python RETUN

2006-05-15 Thread Tom Lane
Hannu Krosing <[EMAIL PROTECTED]> writes: >> Sven Suursoho wrote: >>> As for testing in actual pl/python build environment, we had objections >>> from >>> leading postgresql Tom Lane that even if we do test it at build time, >>> a determined DBA may substitute a buggy python.so later and still c

HTTPServer and ThreadingMixIn

2006-05-15 Thread crowell
Hello, I am having trouble getting the ThreadingMixIn to do what I want. Looking over the docs (and some old code I wrote which successfully does what I want), I arrived at the following: import time import SocketServer import BaseHTTPServer class TheServer(SocketServer.ThreadingMixIn, BaseHTTPS

Re: regular expression error ?

2006-05-15 Thread Bruno Desthuilliers
Lance Hoffmeyer a écrit : > why isn't re.search recognizing "file"? I can print the contents of "file". > > > import win32com.client > import re > > D=MSWord.Documents.Open('C:/test/Test.doc') > file=D.Content > print file > > match = re.search('(Table ?)', file) > if match: >print "Table

Re: my cryptogram program

2006-05-15 Thread Paul Rubin
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > def convert_quote(quote): >return make_code(quote).split('|', 1) I thought about suggesting that, but it's semantically different than the original since it fails to raise an error if no vertical bar is present. I don't know if that's good or

Re: my cryptogram program

2006-05-15 Thread Paul Rubin
John Salerno <[EMAIL PROTECTED]> writes: > def convert_quote(quote): > coded_quote = make_code(quote) > author = coded_quote.split('|')[1] > quote = coded_quote.split('|')[0] > return quote, author I think it's a little bit ugly (plus inefficient) to split the quote twice. You

Re: my cryptogram program

2006-05-15 Thread Bruno Desthuilliers
John Salerno a écrit : > Alrighty, here is what I've come up with. Any suggestions for tweaks or > speed-boosting efficiency? Just kidding. :) Too late ! You asked for it, you get it !-) > Maybe the weakest part is how the code is determined (just shuffling the > letters in the alphabet). Perha

Re: Test professionalism (was: count items in generator)

2006-05-15 Thread Timothy Grant
On 5/15/06, Cameron Laird <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote: > . > . > . > >That's exactly my point. Assuming your test coverage is good, such an > >

Re: Large Dictionaries

2006-05-15 Thread bearophileHUGS
Roy Smith: > I am befuddled as to why > people thought creating a dict by keyword would be a useful thing to > do, but left out (and, indeed, eliminated the chance to add the syntax > later) the obviously useful ability to hint at the size. Adding the keyword syntax doesn't require much memory to

RE: Iterating generator from C (PostgreSQL's pl/python RETUN SETOF/RECORD iterator support broken on RedHat buggy libs)

2006-05-15 Thread Hannu Krosing
Sorry for cross-posting, but this IS a cross-platform issue. Christian Tismer tismer at stackless.com wrote: > Sven Suursoho wrote: > > >>> Is there any way to rewrite following program to handle returned > >>> generator without hitting this bug? > > The only way I can think of getting aroun

Re: common practice for creating utility functions?

2006-05-15 Thread Bruno Desthuilliers
John Salerno a écrit : > John Salerno wrote: > >> John Salerno wrote: >> >>> Just a quickie for today >> >> >> Another quick one I'll combine in this thread: How can I create two >> separate conditions in a for loop? >> >> Such as this, which doesn't seem to work beyond string.punctuation: >> >>

Re: common practice for creating utility functions?

2006-05-15 Thread Bruno Desthuilliers
Paul Rubin a écrit : > John Salerno <[EMAIL PROTECTED]> writes: > >>So my first question is this: should I make a Cryptogram class for >>this, or are functions fine? If the latter, then back to my original >>point: can I do something like this: >> >>def convert_quote(quote): >> return make_cod

regular expression error ?

2006-05-15 Thread Lance Hoffmeyer
why isn't re.search recognizing "file"? I can print the contents of "file". import win32com.client import re D=MSWord.Documents.Open('C:/test/Test.doc') file=D.Content print file match = re.search('(Table ?)', file) if match: print "Table Number is: ", match.group(1) Traceback (most recen

Re: common practice for creating utility functions?

2006-05-15 Thread Bruno Desthuilliers
John Salerno a écrit : > Just a quickie for today: Is it common (and also preferred, which are > two different things!) to create a function that has the sole job of > calling another function? (pasted): > def convert_quote(quote): > return make_code(quote) > > Or does it not make sense

Re: Aggregate funuctions broken in MySQLdb?

2006-05-15 Thread John Salerno
Lorenzo Thurman wrote: > Thanks, that was my problem. Can you point me to some documentation on > MySQLdb? I've been googling to get answers and that obviously has not > been working. I've been looking into this too lately, and finding thorough docs for it is hard. Have you seen these yet: htt

my cryptogram program

2006-05-15 Thread John Salerno
Alrighty, here is what I've come up with. Any suggestions for tweaks or speed-boosting efficiency? Just kidding. :) Maybe the weakest part is how the code is determined (just shuffling the letters in the alphabet). Perhaps there's a better way? Although it seems effective to me import str

Re: common practice for creating utility functions?

2006-05-15 Thread John Salerno
Scott David Daniels wrote: > John Salerno wrote: >>> How can I create two separate conditions in a for loop? >> ... I tried this: >> >> punc_space = string.punctuation + string.whitespace >> for char in punc_space: > > That's probably best. If the sources are not so simple, you could use: > >

Re: Aggregate funuctions broken in MySQLdb?

2006-05-15 Thread Lou Losee
Try these:http://sourceforge.net/docman/?group_id=22307and for the Python DB API overall:http://www.python.org/dev/peps/pep-0249/ LouOn 5/15/06, Lorenzo Thurman <[EMAIL PROTECTED]> wrote: Thanks, that was my problem. Can you point me to some documentation onMySQLdb? I've been googling to get answer

Re: Aggregate funuctions broken in MySQLdb?

2006-05-15 Thread Lorenzo Thurman
Thanks, that was my problem. Can you point me to some documentation on MySQLdb? I've been googling to get answers and that obviously has not been working. In article <[EMAIL PROTECTED]>, "Wade Leftwich" <[EMAIL PROTECTED]> wrote: > Works fine for me, and I certainly hope MySQLdb is ready fo

Re: common practice for creating utility functions?

2006-05-15 Thread Scott David Daniels
John Salerno wrote: >> How can I create two separate conditions in a for loop? >... > I tried this: > > punc_space = string.punctuation + string.whitespace > for char in punc_space: That's probably best. If the sources are not so simple, you could use: import itertools for char in i

Re: A critic of Guido's blog on Python's lambda

2006-05-15 Thread Ken Tilton
Lasse Rasinen wrote: > [I trimmed some of the newsgroups away; this mostly concerns Python and Lisp] > > Ken Tilton <[EMAIL PROTECTED]> writes: > > >>Lasse Rasinen wrote: >> >>>Ken Tilton <[EMAIL PROTECTED]> writes: >>> >>> >if any concepts have survived to the Python version. Since Python

Re: common practice for creating utility functions?

2006-05-15 Thread BartlebyScrivener
QOTW "Programming is not just creating strings of instructions for a computer to execute. It's also 'literary' in that you are trying to communicate a program structure to other humans reading the code." Paul Rubin rpd -- http://mail.python.org/mailman/listinfo/python-list

Re: common practice for creating utility functions?

2006-05-15 Thread John Salerno
John Salerno wrote: > John Salerno wrote: >> Just a quickie for today > > Another quick one I'll combine in this thread: How can I create two > separate conditions in a for loop? > > Such as this, which doesn't seem to work beyond string.punctuation: > > for char in string.punctuation or string

Re: common practice for creating utility functions?

2006-05-15 Thread John Salerno
Dan Sommers wrote: > Perhaps I'm "old school," but I don't bother with classes unless I'm > going to end up with multiple instances (or I'm pushed into a corner by, > e.g., a GUI framework). Thanks to all of you! In fact, I sort of came to this same conclusion. I started with a class, but realiz

Re: OOP and Tkinter

2006-05-15 Thread Diez B. Roggisch
Ronny Mandal schrieb: > Thanks, but the problem was my undentation, after making one indent, > it worked as expected. :) I seriously doubt that. I guess you didn't show us the real code. But there is no way that an instance variable can be accessed on type-level in a derived class (or from anywh

Re: common practice for creating utility functions?

2006-05-15 Thread John Salerno
John Salerno wrote: > Just a quickie for today Another quick one I'll combine in this thread: How can I create two separate conditions in a for loop? Such as this, which doesn't seem to work beyond string.punctuation: for char in string.punctuation or string.whitespace: -- http://mail.python.o

Re: Large Dictionaries

2006-05-15 Thread Diez B. Roggisch
Maric Michaud schrieb: > Le Lundi 15 Mai 2006 19:24, Roy Smith a écrit : >> d = {} >> d.reserve (10*1000*1000) > > d={}.fromkeys(xrange(5*10**6)) ? That is a totally different beast. You don't want to insert arbitrary keys, you want the internal hash-array to be of the right size. Diez -- http

Re: OOP and Tkinter

2006-05-15 Thread Kent Johnson
Ronny Mandal wrote: > file front_ui.py: > > class Front(object): > _images = [] # Holds image refs to prevent GC > def __init__(self, root): > # Widget Initialization > self._listbox_1 = Tkinter.Listbox(root, > height = 0, > width = 0, > ... >

Re: common practice for creating utility functions?

2006-05-15 Thread Scott David Daniels
John Salerno wrote: > ...Is it common ...[and preferred] to create a function that has the sole job > of > calling another function? > > Example: ... cryptogram. Right now I have four functions: > > convert_quote -- the main function that starts it all > make_code -- makes and returns the crypt

Re: OOP and Tkinter

2006-05-15 Thread Ronny Mandal
Thanks, but the problem was my undentation, after making one indent, it worked as expected. :) -Ronny M -- http://mail.python.org/mailman/listinfo/python-list

Re: OOP and Tkinter

2006-05-15 Thread Diez B. Roggisch
Ronny Mandal schrieb: > Hello. > > I am stuck; provided is the code and error-msg: > > file front_ui.py: > > class Front(object): > _images = [] # Holds image refs to prevent GC > def __init__(self, root): > > > # Widget Initialization > self._listbox_1 = Tkinter.Listbo

Re: common practice for creating utility functions?

2006-05-15 Thread Dan Sommers
On Mon, 15 May 2006 18:26:01 GMT, John Salerno <[EMAIL PROTECTED]> wrote: > So my first question is this: should I make a Cryptogram class for > this, or are functions fine? ... Perhaps I'm "old school," but I don't bother with classes unless I'm going to end up with multiple instances (or I'm pu

Re: common practice for creating utility functions?

2006-05-15 Thread Paul Rubin
John Salerno <[EMAIL PROTECTED]> writes: > So my first question is this: should I make a Cryptogram class for > this, or are functions fine? If the latter, then back to my original > point: can I do something like this: > > def convert_quote(quote): > return make_code(quote) It's fine to do

OOP and Tkinter

2006-05-15 Thread Ronny Mandal
Hello. I am stuck; provided is the code and error-msg: file front_ui.py: class Front(object): _images = [] # Holds image refs to prevent GC def __init__(self, root): # Widget Initialization self._listbox_1 = Tkinter.Listbox(root, height = 0, widt

Re: A critic of Guido's blog on Python's lambda

2006-05-15 Thread Lasse Rasinen
[I trimmed some of the newsgroups away; this mostly concerns Python and Lisp] Ken Tilton <[EMAIL PROTECTED]> writes: > Lasse Rasinen wrote: > > Ken Tilton <[EMAIL PROTECTED]> writes: > > > >>>if any concepts have survived to the Python version. Since Python's object > >>>model is sufficiently dif

Re: Decrypt DES by password

2006-05-15 Thread Paul Rubin
Thomas Dybdahl Ahle <[EMAIL PROTECTED]> writes: > byte[] array2 = bytes1.CryptDeriveKey("DES", "MD5", 0, array1); > > Anybody know how to do this in python? I'm not aware of a standard that says how CryptDeriveKey is supposed to work. Or rather, there are multiple possible standard ways to do it.

common practice for creating utility functions?

2006-05-15 Thread John Salerno
Just a quickie for today: Is it common (and also preferred, which are two different things!) to create a function that has the sole job of calling another function? Example: for fun and exercise, I'm creating a program that takes a quote and converts it into a cryptogram. Right now I have four

Re: A critic of Guido's blog on Python's lambda

2006-05-15 Thread Ken Tilton
Ken Tilton wrote: > > > Ben wrote: > >> >> Nothing you have described sounds that complicated, and you never come >> up with concrete objections to other peoples code (apart that it took >> 10 years to write in Lisp, so it must be really hard) > > > Oh, now I have to spend an hour dissecting

Re: Large Dictionaries

2006-05-15 Thread Paul McGuire
"Claudio Grondi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Chris Foote wrote: > > Hi all. > > > > I have the need to store a large (10M) number of keys in a hash table, > > based on a tuple of (long_integer, integer). The standard python > > dictionary works well for small numb

Re: do/while structure needed

2006-05-15 Thread John Salerno
Terry Reedy wrote: > "John Salerno" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Thanks, that looks pretty good. Although I have to say, a do/while >> structure is the much more obvious way. I wonder why it hasn't been >> added to the language. > > Been suggested many times, b

Dr. Dobb's Python-URL! - weekly Python news and links (May 15)

2006-05-15 Thread Peter Otten
QOTW: "It seems if you lurk here [on comp.lang.python] long enough you eventually get all you[r] questions answered without even asking!" - Ted Landis "We're going to learn from Python. JavaScript is pretty close to Python" - Brendan Eich Scott David Daniels shows how to find all occurrenc

Re: Tabs versus Spaces in Source Code

2006-05-15 Thread Edward Elliott
Brian Quinlan wrote: > The problem with tabs is that people use tabs for alignment e.g. > > def foo(): >->query = """SELECT * >-> -> -> FROM sometable >-> -> -> WHERE condition""" Sure it's a problem. When programmers do bad things, what is your response? Slap his nose and

Re: keyword help in Pythonwin interpreter

2006-05-15 Thread BartlebyScrivener
Peter, I filed a bug report. Thanks, rick -- http://mail.python.org/mailman/listinfo/python-list

Re: Tabs versus Spaces in Source Code

2006-05-15 Thread gregarican
Peter Decker wrote: > Funny, I was going to say that the problem is when the author prefers > a font with a differntly-sized space. Some of us got rid of editing in > fixed-width fonts when we left Fortran. Don't know what all of the hub-bub here is regarding tab/space indentation. My punched car

Re: Large Dictionaries

2006-05-15 Thread Maric Michaud
Le Lundi 15 Mai 2006 19:24, Roy Smith a écrit : > d = {} > d.reserve (10*1000*1000) d={}.fromkeys(xrange(5*10**6)) ? -- _ Maric Michaud _ Aristote - www.aristote.info 3 place des tapis 69004 Lyon Tel: +33 426 880 097 -- http://mail.python.org/mailman/listinfo/python-li

Re: Tabs versus Spaces in Source Code

2006-05-15 Thread Peter Decker
On 5/15/06, Brian Quinlan <[EMAIL PROTECTED]> wrote: > The problem with tabs is that people use tabs for alignment e.g. > > def foo(): >->query = """SELECT * >-> -> -> FROM sometable >-> -> -> WHERE condition""" > > Now I change my editor to use 8-space tabs and the code is all

Re: do/while structure needed

2006-05-15 Thread Terry Reedy
"John Salerno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks, that looks pretty good. Although I have to say, a do/while > structure is the much more obvious way. I wonder why it hasn't been > added to the language. Been suggested many times, been considered, and rejected.

Re: Tabs versus Spaces in Source Code

2006-05-15 Thread Brian Quinlan
Edward Elliott wrote: > Tab is not 4 spaces. Tab is 1 level of indentation. The confusion that > tabs equals some fixed width, or can/should be set to some fixed width, is > the entire problem hampering their use. It implies that conversion between > tabs and spaces is straightforward when it is

Re: saving file permission denied on windows

2006-05-15 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I'm making a small program which takes a folder with images and > generates optimized normal-sized images and thumbnails using Python > Imaging Lbrary (PIL). The problem is here: > > os.mkdir(self.output) > > img = Image.open(os.path.join(self.dir,file)) > img =

Re: Large Dictionaries

2006-05-15 Thread Roy Smith
Aahz <[EMAIL PROTECTED]> wrote: > Don't forget that adding keys requires resizing the dict, which is a > moderately expensive operation. My guess would be that each resize grows the table by a constant factor, which IIRC, works out to amortized O(n). It's not as good as creating the dict the righ

Re: A critic of Guido's blog on Python's lambda

2006-05-15 Thread Ken Tilton
Ben wrote: > > Nothing you have described sounds that complicated, and you never come > up with concrete objections to other peoples code (apart that it took > 10 years to write in Lisp, so it must be really hard) Oh, now I have to spend an hour dissecting any code you people toss-off that doe

ANN: Vancouver Python Workshop

2006-05-15 Thread Brian Quinlan
Vancouver Python Workshop = Building on the huge success of the 2004 Vancouver Python Workshop, the Vancouver Python and Zope User Group is pleased to announce the 2006 Vancouver Python Workshop. The conference will begin with keynote addresses on August 4st. Further talks

Re: Tabs versus Spaces in Source Code

2006-05-15 Thread Edward Elliott
Harry George wrote: > This has been discussed repeatedly, and the answer is "If you only > work alone, never use anyone else's code and no one ever uses your > codes, then do as you please. The answer is "Do what works best for your project". Smart people can agree on and use whatever conventio

Re: Finding yesterday's date with datetime

2006-05-15 Thread Michael J. Fromberger
In article <[EMAIL PROTECTED]>, "Thierry Lam" <[EMAIL PROTECTED]> wrote: > Is there an easy way to determine the yesterday's date(year-month-day) > from the python datetime library if I know today's date? from datetime import datetime, timedelta today = datetime.today() yesterday = today - time

Re: Large Dictionaries

2006-05-15 Thread Aahz
In article <[EMAIL PROTECTED]>, Roy Smith <[EMAIL PROTECTED]> wrote: >In article <[EMAIL PROTECTED]>, Chris Foote <[EMAIL PROTECTED]> >wrote: >> >> I have the need to store a large (10M) number of keys in a hash table, >> based on a tuple of (long_integer, integer). The standard python >> dicti

Re: Tabs versus Spaces in Source Code

2006-05-15 Thread Peter Decker
On 5/15/06, Chris Klaiber <[EMAIL PROTECTED]> wrote: > The problem comes when the author prefers a smaller tab width than what my > editor is set to. Sure, I could change it for that file, but what if I'm > reading a whole directory? Sure, I could change the default setting in my > editor, but wha

Re: py on windows Mobile 5.0?

2006-05-15 Thread Gonzalo Monzón
Bell, Kevin escribió: >Does anyone know if/how to go about using python on a windows mobile 5.0 >PDA? > >Kevin > > > > Hi Bell, Yes, there's PythonCE (Python 2.4.3 port) for Windows CE / ARM, and seems to run with mobile 5. Please search in the pythonce mail list and you'll got the answers a

Re: List and order

2006-05-15 Thread Peter Otten
Nic wrote: > The only problem is that from: > 12 > 22 > 21 > In spite of writing > 12 12 22 > it writes > 12 21 22 > Do you know how is it possible to delete also this last trouble? I thought that the two 12 were a typo, but it seems you want to reorder the nodes inside an edge, too. Here's a fix

help with perl2python regular expressions

2006-05-15 Thread Lance Hoffmeyer
Hey all, I am trying to convert some old perl scripts I have to python. Here is a snippit of the regex I used in perl. I am trying to figure out the equivalent code in python. Can someone help? my $file =$Word->ActiveDocument->Content->Text; $file =~ /TABLE\s+1.*?JCP.*?MEAN.*?(?:(\d{1,3}\.\

Re: Finding yesterday's date with datetime

2006-05-15 Thread [EMAIL PROTECTED]
Try something like this... HTH. A. from datetime import * d1 = datetime( year=2006, month=5, day=15) d2 = datetime.now() for d in [d1,d2]: yest = d - timedelta(days =1 ) print "%s -> %s" % (d, yest) -- http://mail.python.org/mailman/listinfo/python-list

Re: List and order

2006-05-15 Thread Nic
Many thanks. Both the cases are OK. The only problem is that from: 12 22 21 In spite of writing 12 12 22 it writes 12 21 22 Do you know how is it possible to delete also this last trouble? Thanks a bunch, Nic "Peter Otten" <[EMAIL PROTECTED]> ha scritto nel messaggio news:[EMAIL PROTECTED] > Nic

  1   2   >