Re: Search or compai problem

2006-08-18 Thread John Machin
Gallagher, Tim (NE) wrote: > I am new to python and I want to compare 2 strings, here is my code: > [start] > > import active_directory > import re > > lstUsers = [] Using "lst" or "l" as a variable name is bad news in any language; with many fonts they are too easily misread as "1st" or "1" respe

Re: couple more questions about sqlite

2006-08-18 Thread John Machin
John Salerno wrote: > [EMAIL PROTECTED] wrote: > >> 2. What's the difference between sqlite and pysqlite? Do you need both, > >> just one, or is one an older version of the same thing? > > > > To access your database from python you need both (or some alternative > > to pysqlite) > > I can understa

Re: how do you get the name of a dictionary?

2006-08-18 Thread Matimus
You could do something like this: >>> class MyDict(dict): ... pass >>> bananna = MyDict({"foo":"bar"}) #dict constructor still works >>> bananna.name = "bananna" >>> bananna.name 'bananna' >>> bananna {'foo': 'bar'} Or, you could also just do this: >>> bananna = {"name":"bananna"} Depending

Re: Python for arcgis

2006-08-18 Thread Gabriel Genellina
At Thursday 17/8/2006 00:25, subramanian2003 wrote: From where can I get the python tutorial for arcgis customisation?. Tried google? Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo

Using Beautiful Soup

2006-08-18 Thread Tempo
Heya. I have never used a module/script before, and the first problem I have run into is that I do not know how to install a module/script. I have downloaded Beautiful Soup, but how do I use it in one of my own programs? I know that I use an "include" statement, but do I first need to make a copy o

Re: Py2Exe and sys.argv : The Lost Arguments

2006-08-18 Thread Gabriel Genellina
At Thursday 17/8/2006 16:42, Thomas W wrote: Is it impossible to compile a script using py2exe and pass selected items in Explorer to my script? It works fine when called on the command line so it might be something related to Explorer but I'm completly lost. Yes, it is related to Explorer -so

Re: couple more questions about sqlite

2006-08-18 Thread Paul McGuire
"John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would strongly recommend for a learner of SQL and the Python DBAPI: > (1) start with sqlite; it's great, and there's minimal admin involved > (2) download the command-line utility from the sqlite website -- you'll > need

Re: Using Beautiful Soup

2006-08-18 Thread Jorge Godoy
"Tempo" <[EMAIL PROTECTED]> writes: > Heya. I have never used a module/script before, and the first problem I > have run into is that I do not know how to install a module/script. I > have downloaded Beautiful Soup, but how do I use it in one of my own > programs? I know that I use an "include" st

Re: couple more questions about sqlite

2006-08-18 Thread John Salerno
John Machin wrote: > Your confusion is quite understandable. I started looking at sqlite > when the announcement that it would be included in Python 2.5 came out. > Puzzlement reigned. I ended up with the following up the front of my > experimental module: So does this mean that when 2.5 is relea

text editor suggestion?

2006-08-18 Thread John Salerno
Ok, I know it's been asked a million times, but I have a more specific question so hopefully this won't be just the same old post. I've tried a few different editors, and I really like UltraEdit, but it's Windows-only and I'm working more on Linux nowadays. Here are my criteria: 1. syntax high

Re: couple more questions about sqlite

2006-08-18 Thread John Machin
John Salerno wrote: > John Machin wrote: > > > Your confusion is quite understandable. I started looking at sqlite > > when the announcement that it would be included in Python 2.5 came out. > > Puzzlement reigned. I ended up with the following up the front of my > > experimental module: > > So do

Re: Http client to POST using multipart/form-data

2006-08-18 Thread Gabriel Genellina
At Friday 18/8/2006 03:06, Bruno Dilly wrote: I'm implementing a http client to POST using multipart/form-data. It uses urllib2 module, and files are uploaded correctly. But I need to know how much has been uploaded at a given moment, to inform the user the proportion of the file already upload

Re: sum and strings

2006-08-18 Thread Paddy
Fredrik Lundh wrote: > Paddy wrote: > > > Here is where I see the break in the 'flow': > > > 1+2+3 > > 6 > sum([1,2,3], 0) > > 6 > [1] + [2] +[3] > > [1, 2, 3] > sum([[1],[2],[3]], []) > > [1, 2, 3] > '1' + '2' + '3' > > '123' > sum(['1','2','3'], '') > > Traceback (m

Re: text editor suggestion?

2006-08-18 Thread nemesian
Have you tried Notepad++? It's a neat text-editor. -- http://mail.python.org/mailman/listinfo/python-list

Re: sum and strings

2006-08-18 Thread Paul Rubin
Georg Brandl <[EMAIL PROTECTED]> writes: > Why would you try to sum up strings? Besides, the ''.join idiom is quite > common in Python. Just because it's common doesn't mean it's obvious. In my opinion it's as ugly as sin, and the fact that it's an idiom shows a shortcoming in Python. The obviou

Re: sum and strings

2006-08-18 Thread Paddy
Georg Brandl wrote: > Paddy wrote: <> > > I get where you are coming from, but in this case we have a function, > > sum, that is not as geeral as it could be. sum is already here, and > > works for some types but not for strings which seems an arbitrary > > limitation that impede duck typing. > >

Re: sum and strings

2006-08-18 Thread Paul Rubin
Sybren Stuvel <[EMAIL PROTECTED]> writes: > > Those are obvious??? > Yup. Just read the string documentation and you're off. Huh? Just because some obscure weirdness like this is in the manual, doesn't make it obvious or natural. -- http://mail.python.org/mailman/listinfo/python-list

Re: text editor suggestion?

2006-08-18 Thread Ben Finney
John Salerno <[EMAIL PROTECTED]> writes: > Here are my criteria: > > 1. syntax highlighting (highly customizable) > 2. auto/smart indenting > 3. ability to run script > 4. light-weight text editor, not an IDE > 5. cross-platform (not really necessary, but nice) The two big names in text editing,

Re: sum and strings

2006-08-18 Thread Paul Rubin
"Paddy" <[EMAIL PROTECTED]> writes: > Pythons designers seem to know and apply the advantages of having fewer > 'themes' that can be applied with less constraints I am curious about > such a constraint on sum. The opposing argument is that sum is sort of like reduce, i.e. sum((a,b,c,d)) could conc

Re: text editor suggestion?

2006-08-18 Thread Simon Forman
John Salerno wrote: > Ok, I know it's been asked a million times, but I have a more specific > question so hopefully this won't be just the same old post. I've tried a > few different editors, and I really like UltraEdit, but it's > Windows-only and I'm working more on Linux nowadays. > > Here are

Re: text editor suggestion?

2006-08-18 Thread Paul Rubin
"Simon Forman" <[EMAIL PROTECTED]> writes: > Have you tried IDLE? It ships with python, meets your 5 criteria(*), > can be customized (highlighting colors and command keys and more), and > includes a usable GUI debugger. It's got some warts, but I like it a > lot, it's pretty much all I use for m

Re: sum and strings: Summary

2006-08-18 Thread Paddy
Paul Rubin wrote: > "Paddy" <[EMAIL PROTECTED]> writes: > > Pythons designers seem to know and apply the advantages of having fewer > > 'themes' that can be applied with less constraints I am curious about > > such a constraint on sum. > > The opposing argument is that sum is sort of like reduce,

Re: sum and strings: Summary

2006-08-18 Thread Paul Rubin
"Paddy" <[EMAIL PROTECTED]> writes: > I also found this from Guido: > http://mail.python.org/pipermail/python-dev/2003-April/034853.html > And this, in the same thread: > http://mail.python.org/pipermail/python-dev/2003-April/034854.html > > So, > The upshot is that complexity matters. The alg

Re: how do you get the name of a dictionary?

2006-08-18 Thread BartlebyScrivener
Tim Chase wrote: > How would you ask for the object? > > >>> print get_name(banana) > > you might as well write > > >>> print "banana" > Or there used to be a guy in this group who said it was like asking a cat for its name. He headbanged himself unconscious though, or so they say. http://tinyur

Re: text editor suggestion?

2006-08-18 Thread David Isaac
http://www.american.edu/econ/notes/soft.htm#EDITORS has some relevant discussion and suggestions. Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you get the name of a dictionary?

2006-08-18 Thread Steve Holden
John Salerno wrote: > Fredrik Lundh wrote: > >>Andy Terrel wrote: >> >> >>>for i in dir(): >>> if eval(i) == Banana: >>> print i >> >>(sound of head hitting desk) >> >> >> > lol Right. Plus it's fun to imagine the effbot hitting itself as hard as some people would obviously have

Re: text editor suggestion?

2006-08-18 Thread Simon Forman
Paul Rubin wrote: > "Simon Forman" <[EMAIL PROTECTED]> writes: > > Have you tried IDLE? It ships with python, meets your 5 criteria(*), > > can be customized (highlighting colors and command keys and more), and > > includes a usable GUI debugger. It's got some warts, but I like it a > > lot, it's

Re: text editor suggestion?

2006-08-18 Thread OriginalBrownster
John Salerno wrote: > Ok, I know it's been asked a million times, but I have a more specific > question so hopefully this won't be just the same old post. I've tried a > few different editors, and I really like UltraEdit, but it's > Windows-only and I'm working more on Linux nowadays. > > Here are

Re: how do you get the name of a dictionary?

2006-08-18 Thread Steve Holden
BartlebyScrivener wrote: > Tim Chase wrote: > >>How would you ask for the object? >> >> >>> print get_name(banana) >> >>you might as well write >> >> >>> print "banana" >> > > Or there used to be a guy in this group who said it was like asking a > cat for its name. He headbanged himself unconscio

Re: efficient memoize decorator?

2006-08-18 Thread Gabriel Genellina
At Friday 18/8/2006 17:14, [EMAIL PROTECTED] wrote: sorry memoize is http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496879 This implementation uses cPickle to generate a key from the supplied function arguments, which is very slow and defeats the purpose of memoizing. In your example

Questions on unittest behaviour

2006-08-18 Thread Collin Winter
While working on a test suite for unittest these past few weeks, I've run across some behaviours that, while not obviously wrong, don't strike me as quite right, either. Submitted for your consideration: 1) TestCase.tearDown() is only run if TestCase.setUp() succeeded. It seems to me that tearDown

Re: Search or compai problem

2006-08-18 Thread timgerr
John Machin wrote: > Gallagher, Tim (NE) wrote: > > I am new to python and I want to compare 2 strings, here is my code: > > [start] > > > > import active_directory > > import re > > > > lstUsers = [] > > Using "lst" or "l" as a variable name is bad news in any language; with > many fonts they are

Re: text editor suggestion?

2006-08-18 Thread BartlebyScrivener
John Salerno wrote: > Ok, I know it's been asked a million times, but I have a more specific > question so hopefully this won't be just the same old post. You got 65 answers last time :) http://tinyurl.com/rsfjq rd -- http://mail.python.org/mailman/listinfo/python-list

Re: couple more questions about sqlite

2006-08-18 Thread Robert Kern
John Machin wrote: > John Salerno wrote: >> John Machin wrote: >> >>> Your confusion is quite understandable. I started looking at sqlite >>> when the announcement that it would be included in Python 2.5 came out. >>> Puzzlement reigned. I ended up with the following up the front of my >>> experime

py2exe: cannot identify image file

2006-08-18 Thread Daniel Mark
Hello all: I have following code that works well under command line, but it doesn't work after I convert it as exe application. ### file: testPath.py import getopt, math, sys, os, Image, ImageDraw, aggdraw def processline(): try: imgDir = 'c:/' lumenImageName = '0

Re: sum and strings

2006-08-18 Thread Georg Brandl
Paul Rubin wrote: > Georg Brandl <[EMAIL PROTECTED]> writes: >> Why would you try to sum up strings? Besides, the ''.join idiom is quite >> common in Python. > > Just because it's common doesn't mean it's obvious. In my opinion > it's as ugly as sin, and the fact that it's an idiom shows a > shor

Re: efficient memoize decorator?

2006-08-18 Thread Fredrik Lundh
Gabriel Genellina wrote: > This implementation uses cPickle to generate a key from the supplied > function arguments, which is very slow and defeats the purpose of > memoizing. depends on the cost of recreating an object, of course. it's a bit surprising that so many programmers seem to think

Re: how do you get the name of a dictionary?

2006-08-18 Thread [EMAIL PROTECTED]
jojoba wrote: > Does anyone know how to find the name of a python data type. > > Conside a dictionary: > > Banana = {} > > Then, how do i ask python for a string representing the name of the > above dictionary (i.e. 'Banana')? The reason people are banging their heads is because the question doesn

Re: efficient memoize decorator?

2006-08-18 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > all of the memoize decorators at the python cookbook seem to make my > code slower. if you want good performance, use the following pattern: def col(n, count, memo={}): try: return memo[n, count] except KeyError: # ... calc

Re: Search or compai problem

2006-08-18 Thread Gabriel Genellina
At Saturday 19/8/2006 01:16, [EMAIL PROTECTED] wrote: it is really lstusers (it is an L not a # 1), Some of the output from print lstUsers has the output of None. I and trying to filter the None out of the list. I come from a perl background and this is how I do thing in perl None is a uni

Re: text editor suggestion?

2006-08-18 Thread John Salerno
BartlebyScrivener wrote: > John Salerno wrote: > >> Ok, I know it's been asked a million times, but I have a more specific >> question so hopefully this won't be just the same old post. > > You got 65 answers last time :) > > http://tinyurl.com/rsfjq > > rd > Hmm, I forgot all about that. Alt

Re: text editor suggestion?

2006-08-18 Thread John Salerno
Ben Finney wrote: > The two big names in text editing, Vim and Emacs, will both meet these > criteria easily. They also have the advantage that you'll find one or > the other, or both, on just about any Unix system intended for use by > a programmer. > > There is also an enormous amount of support

Re: couple more questions about sqlite

2006-08-18 Thread John Salerno
Dennis Lee Bieber wrote: > SQLite, in whatever incarnation, is a "file server" database. There > is no separate database server running -- each application is linked > directly to the code that opens and processes the database file(s). > > If SQLite is supplied with the impending Pyth

Re: text editor suggestion?

2006-08-18 Thread Ant
John Salerno wrote: > I'd really like to learn vim, but I spent days just trying to figure out > how to get the syntax highlighting and indentation working, where these > settings are and how to edit them, and it still doesn't work for me. It > just feels so insurmountable that I can't even start

<    1   2