A static pychecker?

2006-09-08 Thread Edward K. Ream
iler.parse. Unlike the inspect module, it would peruse the code looking for possible problems. Thanks. Edward ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/

Re: Pythondocs.info : collaborative Python documentation project

2006-09-16 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > I am a bit disapointed with the current Python online documentation. I > have read many messages of people complaining about the documentation, > it's lack of examples and the use of complicated sentences that you > need to read 10 times before understanding what it means

Re: Python programs always open source?

2006-09-18 Thread Leif K-Brooks
Ben Finney wrote: > So long as you're not distributing some or all of Python itself, or a > derivative work, the license for Python has no legal effect on what > license you choose for your own work. How many Python programs use nothing from the standard library? -- http://mail.python.org/mailman

Re: Python programs always open source?

2006-09-18 Thread Leif K-Brooks
Steve Holden wrote: > Leif K-Brooks wrote: >> Ben Finney wrote: >> >>> So long as you're not distributing some or all of Python itself, or a >>> derivative work, the license for Python has no legal effect on what >>> license you choose for your

newlines and sax.saxutils.quoteattr

2006-09-19 Thread Edward K. Ream
arsers are indeed obliged to ignore newlines in attributes, would it be a good idea to (optionally?) have sax.saxutils.quoteattr perform the substitution of newlines to ' \n' ? Thanks. Edward ---- Edward K. Ream email: [

Re: newlines and sax.saxutils.quoteattr

2006-09-19 Thread Edward K. Ream
Thanks, Fredrik, for the reference to the attribute normalization algorithm. > I guess it's too late to fix OPML. It's too late for OPML 1. I'll check with Dave Winer about OPML 2. Edward ---- Edward K. Rea

Re: Reverse a String?

2006-09-23 Thread Leif K-Brooks
Gregory Piñero wrote: > Is my mind playing tricks on me? I really remember being able to > reverse a string as in: > > text='greg' > print text.reverse() >>> 'gerg' That method has never existed AFAIK. Maybe you're thinking of the reverse() method on lists? In any case, the you can reverse stri

Re: unicode, bytes redux

2006-09-25 Thread Leif K-Brooks
Paul Rubin wrote: > Duncan Booth explains why that doesn't work. But I don't see any big > problem with a byte count function that lets you specify an encoding: > > u = buf.decode('UTF-8') > # ... later ... > u.bytes('UTF-8') -> 3 > u.bytes('UCS-4') -> 4 > > That avoids creat

Re: Auto color selection PIL

2006-09-27 Thread Leif K-Brooks
Xiaolei wrote: > I'm trying to plot some points in an image. Each point has an > associating type and I'd like to have different colors (preferrably of > high contrast) for different types. The number of types in the data > file is unknown a priori. Is there a way to do this at runtime? How abo

Re: Auto color selection PIL

2006-09-27 Thread Leif K-Brooks
Xiaolei wrote: > I'm trying to plot some points in an image. Each point has an > associating type and I'd like to have different colors (preferrably of > high contrast) for different types. The number of types in the data > file is unknown a priori. Is there a way to do this at runtime? If you

Re: Auto color selection PIL

2006-09-28 Thread Leif K-Brooks
Gabriel Genellina wrote: > Try this. It first chooses 0, 1/2, then 1/4, 3/4, then */8... > It's the best I could make if you don't know the number of colors > beforehand. If you *do* know how many colors, your previous response is OK. Um, that's the same thing my second suggestion does: >>> h

Re: How to find number of characters in a unicode string?

2006-09-29 Thread Leif K-Brooks
Lawrence D'Oliveiro wrote: > Hmmm, for some reason > > len(u"C\u0327") > > returns 2. Is len(unicodedata.normalize('NFC', u"C\u0327")) what you want? -- http://mail.python.org/mailman/listinfo/python-list

Re: Looping over a list question

2006-10-03 Thread Leif K-Brooks
Tim Williams wrote: > Maybe > def myfunc(txt): > ... print txt > ... datafiles = ['1.txt','2.txt','3.txt','4.tst'] null = [myfunc(i) for i in datafiles if '.txt' in i] > 1.txt > 2.txt > 3.txt Ew. List comprehensions with side effects are very icky. -- http://mail.python.or

Re: Can't get around "IndexError: list index out of range"

2006-10-03 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > I'm trying to get this bit of code to work without triggering the > IndexError. > > import shutil, os, sys > > if sys.argv[1] != None: > ver = sys.argv[1] > else: > ver = '2.14' Catch it: try: ver = sys.argv[1] except IndexError: ver = '2.14' -- htt

sax barfs on unicode filenames

2006-10-04 Thread Edward K. Ream
dea of how to create an InputSource that can handle non-ascii filenames. Any help would be appreciated. Thanks! Edward Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front

How to ask sax for the file encoding

2006-10-04 Thread Edward K. Ream
,silent) parser.setContentHandler(handler) parser.parse(theFile) Can anyone tell me how the content handler can determine the encoding of the file? Can sax provide this info? Thanks! Edward Edward K. Ream email

Re: How to ask sax for the file encoding

2006-10-04 Thread Edward K. Ream
o it should (must) be able to determine the encoding. Furthermore, xml files start with lines like: so it would seem reasonable for sax to be able to return 'utf-8' somehow. Am I missing something? Edward ---- Edward

Re: A Universe Set

2006-10-04 Thread Leif K-Brooks
Jorgen Grahn wrote: > - infinite xrange()s itertools.count()? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to ask sax for the file encoding

2006-10-04 Thread Edward K. Ream
le. Edward ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/mailman/listinfo/python-list

Re: sax barfs on unicode filenames

2006-10-04 Thread Edward K. Ream
e. BTW: Python 2.5.0, Tk 8.4.12, Pmw 1.2 Windows 5, 1, 2600, 2, Service Pack 2 Edward Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/mailman/listinfo/python-list

Re: YouTube written in Python

2006-12-12 Thread Leif K-Brooks
Terry Reedy wrote: > In a thread on the PyDev list, Guido van Rossum today wrote: >> And I just found out (after everyone else probably :-) that YouTube is >> almost entirely written in Python. (And now I can rub shoulders with >> the developers since they're all Googlers now... :-) Interesting. I

Re: How to test if two strings point to the same file or directory?

2006-12-16 Thread Leif K-Brooks
Tim Chase wrote: >>> Comparing file system paths as strings is very brittle. >> >> Why do you say that? Are you thinking of something like this? >> >> /home//user/somedirectory/../file >> /home/user/file > > Or even > > ~/file ~ is interpreted as "my home directory" by the shell, but when it

Re: Colons, indentation and reformatting.

2007-01-09 Thread Leif K-Brooks
Paddy wrote: > Thinking about it a little, it seems that a colon followed by > non-indented code that has just been pasted in could also be used by a > Python-aware editor as a flag to re-indent the pasted code. How would it reindent this code? if foo: print "Foo!" if bar: print "Bar!" Like thi

How to invoke a tkinter menu *itself*

2006-02-10 Thread Edward K. Ream
)+1 top = c.frame.top # Leo magic. topx,topy = top.winfo_rootx(),top.winfo_rooty() menu = c.frame.menu.getMenu(name) # Leo magic. menu.post(topx+offsets.get(name,0),topy) EKR -

Re: How to invoke a tkinter menu *itself*

2006-02-11 Thread Edward K. Ream
orms the anchor for the menu. This button *is* (or should be) packed (or placed), so it should know its own location. Anyone know how to do find a menu's button? Edward ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: htt

How to tell an object's class?

2006-02-24 Thread Edward K. Ream
Hi, I would like to create a dictionary of all the classes that exist while my app is running. This is the best I can do: def defineClassesDict (self): self.allClassesDict = {} for z in gc.get_objects(): t = type(z) if t == types.ClassType: name

ANN: Leo 4.4a7 released

2006-02-28 Thread Edward K. Ream
.net/edreamleo/testimonials.html Edward ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/ma

Re: Proper class initialization

2006-03-01 Thread Leif K-Brooks
Steven Bethard wrote: > class A(object): > def _get_sum(): > return sum(xrange(10)) > sum = _get_sum() What's wrong with sum = sum(xrange(10))? -- http://mail.python.org/mailman/listinfo/python-list

Re: slicing the end of a string in a list

2006-03-02 Thread Leif K-Brooks
Ben Cartwright wrote: > No, since the line variable is unused. This: > > i = 0 > for line in switches: > line = switches[i][:-1] > i += 1 > > Would be better written as: > > for i in range(len(switches)): > switches[i] = switches[i][:-1] This is better, IMHO: for i, sw

Re: Documenting Python code.

2005-05-03 Thread Leif K-Brooks
Isaac Rodriguez wrote: > Are there any standarized ways of documenting Python code? When I check the > __doc__ attribute of the standard modules, the results are kind of plain. Is > everyone using this style? See . Epydoc has a simple language for documentation t

Re: Python Challenge ahead [NEW] for riddle lovers

2005-05-03 Thread Leif K-Brooks
Chris McAloney wrote: > Okay, so I've been working on level seven for a LONG time now. I've > decoded the first message to get the hint for the next level. Using the > same tactics, then I decode the hint as well, but there are non-printable > characters. Frira be srjre pbcvrf bs gur fnzr cvkry

ANN: Leo 4.3-b1

2005-05-04 Thread Edward K. Ream
http://sourceforge.net/cvs/?group_id=3458 Quotes: http://webpages.charter.net/edreamleo/testimonials.html Edward K. Ream email: [EMAIL PROTECTED] Leo: Literate Editor with Outlines Leo: http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/mailman/listinfo/python-list

Re: empty lists vs empty generators

2005-05-04 Thread Leif K-Brooks
Jeremy Bowers wrote: > def __init__(self, generator): > self.generator = generator You'll want to use iter(generator) there in order to handle reiterables. -- http://mail.python.org/mailman/listinfo/python-list

Re: empty lists vs empty generators

2005-05-04 Thread Leif K-Brooks
Jeremy Bowers wrote: > On Wed, 04 May 2005 13:45:00 +, Leif K-Brooks wrote: > > >>Jeremy Bowers wrote: >> >>>def __init__(self, generator): >>>self.generator = generator >> >>You'll want to use iter(generator) there in

Re: globbing multiple wildcards

2005-05-07 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > I have a path spec similar to '/home/*/.mozilla/*/*/cache*/*' (this > will probably look familiar to *nix users) with multiple wildcards. I > am finding it difficult gathering ALL file pathnames which match this > spec. Can anyone shed some light on this for a python noob

Re: Is isinstance always "considered harmful"?

2005-05-15 Thread Leif K-Brooks
Jordan Rastrick wrote: > Say you're writing, in Python, the extend() method for a Linked List > version of python's builtin list. Its really important to know what > kind of iterable youre being passed in - because if its another > Linked list, and you know it, you can connect the two in 0(1) time;

Brad Pahlke is out of the office.

2005-05-15 Thread Bradley K Pahlke
I will be out of the office starting 05/11/2005 and will not return until 05/17/2005. I will respond to your message when I return. -- http://mail.python.org/mailman/listinfo/python-list

Re: what is addMethod ?

2005-05-23 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: >I saw some python open source project with many > self.addMethod() functions (with 3 paramters) > > What does self.addMethod() is good for ? It's not a standard method, so it's good for whatever the particular class you were looking at was using it for. We might be a

ANN: Leo 4.3 final

2005-05-24 Thread Edward K. Ream
s: -- Leo: http://webpages.charter.net/edreamleo/front.html Home: http://sourceforge.net/projects/leo/ Download: http://sourceforge.net/project/showfiles.php?group_id=3458 CVS: http://sourceforge.net/cvs/?group_id=3458 Quotes: http://webpages.charter.net/edreamleo/testimoni

Re: Using properties

2005-05-25 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > name=property(getname,setname,None,None) > > However, it no longer works if I modify getname and setname to > > def getname(self): > return self.name > > def setname(self,newname="Port2"): > self.name=newname That's because you're actually

Re: Case Sensitive, Multiline Comments

2005-05-27 Thread Leif K-Brooks
John Roth wrote: > "Elliot Temple" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> One other interesting thing about case sensitivity I don't think >> anyone has mentioned: in Python keywords are all lowercase already >> (the way I want to type them). In some other languages,

Re: search/replace in Python

2005-05-28 Thread Leif K-Brooks
Oliver Andrich wrote: > re.sub(r"(.*)",r" href=http://www.google.com/search?q=\1>\1", text) For real-world use you'll want to URL encode and entityify the text: import cgi import urllib def google_link(text): text = text.group(1) return '%s' % (cgi.escape(urllib.quote(text)),

Re: search/replace in Python (solved)

2005-05-28 Thread Leif K-Brooks
Vamsee Krishna Gomatam wrote: > text = re.sub( "([^<]*)", r' href="http://www.google.com/search?q=\1";>\1', text ) But see what happens when text contains spaces, or quotes, or ampersands, or... -- http://mail.python.org/mailman/listinfo/python-list

Re: Case Sensitive, Multiline Comments

2005-05-30 Thread Leif K-Brooks
Roy Smith wrote: > Just wait until the day you're trying to figure out why some C++ function > is behaving the way it is and you don't notice that a 50-line stretch of > code is commented out with /* at the top and */ at the bottom. The same thing's happened to me in Python when I accidentally i

Re: working with pointers

2005-05-31 Thread Leif K-Brooks
Michael wrote: > a=2 > b=a > b=0 That's more or less equivalent to this C++ code: int *a; int *b; a = new int; *a = 2; b = a; b = new int; *b = 0; -- http://mail.python.org/mailman/listinfo/python-list

Re: working with pointers

2005-06-01 Thread Leif K-Brooks
Duncan Booth wrote: > The constant integers are created in advance, not when you do the > assignment. But that's just an optimization, not Python's defined behavior. It seems more useful to me to think of all integers as being created at assignment time, even if CPython doesn't actually do that.

Re: Scope

2005-06-03 Thread Leif K-Brooks
Elliot Temple wrote: > I want to write a function, foo, so the following works: > > def main(): > n = 4 > foo(n) > print n > > #it prints 7 What's wrong with: def foo(n): return 7 def main(): n = 4 n = foo(n) print n Anything else (including the tricks involving mu

Re: method = Klass.othermethod considered PITA

2005-06-04 Thread Leif K-Brooks
John J. Lee wrote: > class Klass: > > def _makeLoudNoise(self, *blah): > ... > > woof = _makeLoudNoise > > [...] > > At least in 2.3 (and 2.4, AFAIK), you can't pickle classes that do > this. Works for me: Python 2.3.5 (#2, May 4 2005, 08:51:39) [GCC 3.3.5 (Debian 1:3.3.5-12)

Re: About size of Unicode string

2005-06-06 Thread Leif K-Brooks
Frank Abel Cancio Bello wrote: > request.add_header('content-encoding', 'UTF-8') The Content-Encoding header is for things like "gzip", not for specifying the text encoding. Use the charset parameter to the Content-Type header for that, as in "Content-Type: text/plain; charset=utf-8". -- ht

Re: case/switch statement?

2005-06-11 Thread Leif K-Brooks
Joe Stevenson wrote: > I skimmed through the docs for Python, and I did not find anything like > a case or switch statement. I assume there is one and that I just > missed it. Can someone please point me to the appropriate document, or > post an example? I don't relish the idea especially lon

Re: splitting delimited strings

2005-06-15 Thread Leif K-Brooks
Mark Harrison wrote: > What is the best way to process a text file of delimited strings? > I've got a file where strings are quoted with at-signs, @like [EMAIL > PROTECTED] > At-signs in the string are represented as doubled @@. >>> import re >>> _at_re = re.compile('(?>> def split_at_line(line):

Re: Called function conditional testing (if) of form variables problem

2005-06-15 Thread Leif K-Brooks
Eduardo Biano wrote: > def foo(request): > ans01 = request.get_form_var("ans01") > if ans01 == 4: > ans_1 = 1 > return ans_1 ans01 will be a string ("4"), not an int (4). -- http://mail.python.org/mailman/listinfo/python-list

Regex for repeated character?

2005-06-16 Thread Leif K-Brooks
How do I make a regular expression which will match the same character repeated one or more times, instead of matching repetitions of any (possibly non-same) characters like ".+" does? In other words, I want a pattern like this: >>> re.findall(".+", "foo") # not what I want ['foo'] >>> re.finda

Re: Generating .pyo from .py

2005-06-16 Thread Leif K-Brooks
skn wrote: > Does the python compiler provide an option to generate a .pyo(optimized byte > code file) from a .py (source file)? > > For generating .pyc I know that I only have to pass the source file name as > an argument to py_compile.py. py_compile.py checks __debug__ to decide whether to use

Re: Overcoming herpetophobia (or what's up w/ Python scopes)?

2005-06-18 Thread Leif K-Brooks
Steven D'Aprano wrote: > The language is *always* spelt without the "a", and usually all in > lower-case: perl. The language is title-cased (Perl), but the standard interpreter is written in all lowercase (perl). Sort of like the distinction between Python and CPython. -- http://mail.python.org/m

Leo 4.4.3 beta 2 released

2007-06-12 Thread Edward K Ream
leo/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html Edward ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.html -

Leo 4.4.3 beta 3 released

2007-06-23 Thread Edward K Ream
leo/ Download: http://sourceforge.net/project/showfiles.php?group_id=3458 CVS: http://leo.tigris.org/source/browse/leo/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html ---- Edward K. Ream email: [EMAIL P

Leo 4.4.3 final released

2007-06-26 Thread Edward K Ream
3458 CVS: http://leo.tigris.org/source/browse/leo/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/e

ANN: Leo 4.4.3.1 released

2007-07-03 Thread Edward K Ream
CVS: http://leo.tigris.org/source/browse/leo/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html Edward Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.

sqlite tuples

2007-07-17 Thread John K Masters
I am fairly new to Python and am trying to get to grips with pysqlite2. >From what I have read data is returned as a list of tuples when using SELECT via connection.cursor. But I have not, despite frantic googling, found how to INSERT a list of tuples into a sqlite table. If I convert the tuple to

Re: sqlite tuples

2007-07-17 Thread John K Masters
On 17:30 Tue 17 Jul , Carsten Haese wrote: > On Tue, 2007-07-17 at 21:49 +0100, John K Masters wrote: > > I am fairly new to Python and am trying to get to grips with pysqlite2. > > >From what I have read data is returned as a list of tuples when using > > SELECT via c

Where are the strings in gc.get_objects?

2007-05-04 Thread Edward K Ream
ere the strings are? I expect at least twice the number of strings as there are leoNodes.vnode objects. Edward ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: htt

Re: Where are the strings in gc.get_objects?

2007-05-04 Thread Edward K Ream
: } 84 43373744 * large item 85 43373888 {'stack': [], 'v': } 86 43374032 {34: (, 8), 3: (, 8), 38: (, 8), 8: (, 8), 43: (, 8), 13: (< pos 27406256 lvl: 0 [0] byte-code tests>, 8), 47: (, 8), 18: (, 8), 53: (, 8), 22: (, 8), 26: (, 8)} 87 43374176 {'stack': [], 'v': } 88 43374464 {'stack': [], 'v': } 89 43374608 {'stack': [], 'v': } 90 43374752 {'stack': [], 'v': } 91 43374896 {'stack': [], 'v': } 92 43375040 {'stack': [], 'v': } 93 43375184 {'stack': [], 'v': } 94 43375328 {'stack': [], 'v': } 95 43375472 {'stack': [], 'v': } 96 43375616 {'stack': [], 'v': } 97 43376192 {'stack': [], 'v': } 98 43380784 [] 99 43380824 (leoTkTextWidget id: 25543504 name: head-3, 14) 100 43381024 (, 8) 101 43381184 [] 102 43381224 (leoTkTextWidget id: 25544544 name: head-7, 31) 103 43381424 (, 8) 104 43381584 [] 105 43381624 (leoTkTextWidget id: 27572024 name: head-1, 4) 106 43381824 (, 8) 107 43382024 (leoTkTextWidget id: 25543704 name: head-4, 19) 108 43382224 (, 8) 109 43382424 (, 8) 110 43382704 (leoTkTextWidget id: 27572424 name: head-5, 23) 111 43382824 [] 112 43382864 (leoTkTextWidget id: 27627608 name: head-12, 54) 113 43383384 * large item 114 43384912 115 43425840 116 43426032 117 43426224 (None, , '- %d new objects', 200, 0, 1, '%3d', '* large item', '=') 118 43442512 * large item = I think this answers the question about where the strings are: they are enclosed in tuples. My guess is that the tuples are the way that Python's bytecode accesses the strings. For example, there is a LOAD_CONST i bytecode whose argument i is an index into the stack frame (or is it the code objects). Anyway, my guess is that strings seldom (never?) exist outside the tuple by which they are referenced. So I think this answers the mystery, mostly. Edward Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/mailman/listinfo/python-list

GUI tutorial

2007-05-13 Thread John K Masters
Can someone point me in the direction of a good tutorial on programming python with a GUI? I'm just starting out with python and have written a few scripts successfully but would like to add a graphical front end to them to make it easier for my work colleagues, most of whom have never used a comma

Re: GUI tutorial

2007-05-14 Thread John K Masters
On 15:03 Mon 14 May , Jarek Zgoda wrote: > John K Masters napisał(a): > > > Can someone point me in the direction of a good tutorial on programming > > python with a GUI? I'm just starting out with python and have written a > > few scripts successfully but would

Leo 4.4.3 beta 1 released

2007-05-21 Thread Edward K Ream
o/testimonials.html ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/mailman/listinfo/python-list

Re: ten small Python programs

2007-05-26 Thread John K Masters
On 11:43 Sat 26 May , Steve Howell wrote: > I've always thought that the best way to introduce new > programmers to Python is to show them small code > examples. > > When you go to the tutorial, though, you have to wade > through quite a bit of English before seeing any > Python examples. >

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread John K Masters
On 16:33 Thu 26 Jul , brad wrote: > [EMAIL PROTECTED] wrote: > > Python is a better language, with php support, anyway, but I am fed up > > with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin > > Perl experience for everyone. Instead of being helpful, snide remarks, > > back-

Bug? exec converts '\n' to newline in docstrings!?

2007-07-30 Thread Edward K Ream
("\n") ''' >>> print s strings = 'abc'.split(" ") I see this in my own calls to exec and execfile. Is this a bug or am I missing something? Edward --

Re: Bug? exec converts '\n' to newline in docstrings!?

2007-07-30 Thread Edward K Ream
ed the problem. Edward ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread John K Masters
On 15:34 Tue 31 Jul , Wingware wrote: > Hi, > > I'm happy to announce the first beta release of Wing IDE 3.0. It is > available from http://wingware.com/wingide/beta > If their support for paid customers is anything like their support for prospective customers then I would leave well alone.

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread John K Masters
On 13:45 Wed 01 Aug , Joshua J. Kugler wrote: > On Wednesday 01 August 2007 13:28, John K Masters wrote: > > > On 15:34 Tue 31 Jul , Wingware wrote: > >> Hi, > >> > >> I'm happy to announce the first beta release of Wing IDE 3.0. It is >

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-02 Thread John K Masters
On 18:23 Wed 01 Aug , Steve Holden wrote: > Joshua J. Kugler wrote: > > On Wednesday 01 August 2007 13:53, Robert Dailey wrote: > >> He's secretly an employee of Wing IDE in disguise!!! > > > > Sorry to destroy your conspiracy theories, but no, I've never been employed > > by Wing IDE in any f

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-02 Thread John K Masters
On 08:00 Thu 02 Aug , [EMAIL PROTECTED] wrote: > On Aug 1, 6:42 pm, John K Masters <[EMAIL PROTECTED]> wrote: > > To suggest that, because the autocompletion worked on one method of a > > module and not on another was because I had not configured the > > PYTH

Re: Puzzled by "is"

2007-08-09 Thread John K Masters
On 15:53 Thu 09 Aug , Steve Holden wrote: > Dick Moores wrote: > > At 10:46 AM 8/9/2007, Bill Scherer wrote: > >> Dick Moores wrote: > [...] > >> There is only one empty tuple. > >> Does that clear it up for you? > > > > But isn't that the same as saying, "That's just the reality of > > Pytho

Leo 4.4.4 beta 1 released

2007-08-10 Thread Edward K Ream
html Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/mailman/listinfo/python-list

Re: negative polar axis

2007-08-13 Thread John K Masters
On 10:58 Mon 13 Aug , Erik Max Francis wrote: > Steve Holden wrote: > > > About the best interpretation I can think of is to add 180 degrees to > > the angle and reverse the sign of the magnitude, but this would be a > > hack. Where are those coordinates coming from? > > Well, sometimes in

replacement for string.printable

2007-08-15 Thread John K Masters
>From what I have read the string module is obsolete and should not be used but I am working on a project that parses printable files created in a DOS program and creates a web page for each file. I am using the string.printable constant to determine which characters should be kept; the files conta

Re: replacement for string.printable

2007-08-15 Thread John K Masters
On 19:03 Wed 15 Aug , Marc 'BlackJack' Rintsch wrote: > On Wed, 15 Aug 2007 19:56:01 +0100, John K Masters wrote: > > > From what I have read the string module is obsolete and [???] > > The `string` module isn't obsolete. It even contains a more or less

Python equivalent of Perl's $/

2007-08-20 Thread John K Masters
I am currently working my way through Jeffrey Friedl's book Mastering Regular Expressions. Great book apart from the fact it uses Perl for the examples. One particular expression that interests me is '$/ = ".\n"' which, rather than splitting a file into lines, splits on a period-newline boundary.

Re: Python equivalent of Perl's $/

2007-08-20 Thread John K Masters
On 10:30 Mon 20 Aug , Nick Craig-Wood wrote: > Something like this maybe? > > import re > > input_data = """I am currently working my way through Jeffrey Friedl's book > Mastering > Regular Expressions. Great book apart from the fact it uses Perl for the > examples. > > One particular expre

Re: Python equivalent of Perl's $/

2007-08-20 Thread John K Masters
On 19:19 Mon 20 Aug , [EMAIL PROTECTED] wrote: > > import StringIO > > text = """\ > To mimic Perl's input record separator in > Python, you can use a generator. > And a substring test. > Perhaps something like the following > is what you wanted. > """ > > mockfile = StringIO.StringIO(text)

mailbox module, Maildir, and flags

2007-09-10 Thread jesse . k . rosenthal
Dear all, I'm trying to figure out if mailbox will let me get the flags of a Maildir message without running get_message on it, and reading the whole message. It seems like it should work by doing this: >>> import mailbox >>> mybox = mailbox.Maildir('~/Maildir/', mailbox.MaildirMessage) >>> myfol

Re: UTF-8

2007-03-10 Thread Leif K-Brooks
Laurent Pointal wrote: > You should prefer to put > # -*- coding: utf-8 -*- > at the begining of your sources files. With that you are ok with all Python > installations, whatever be the defautl encoding. > Hope this will become mandatory in a future Python version. The default encoding

Re: dict.items() vs dict.iteritems and similar questions

2007-03-14 Thread Leif K-Brooks
Laurent Pointal wrote: > Both work, you may prefer xrange/iteritems for iteration on large > collections, you may prefer range/items when processing of the result > value explicitly need a list (ex. calculate its length) or when you are > going to manipulate the original container in the loop. xra

Re: Converting a list to a dictionary

2007-03-14 Thread Leif K-Brooks
Samuel wrote: > This does not work: > > res_dict = dict([r.get_id(), r for r in res_list]) This does: res_dict = dict([(r.get_id(), r) for r in res_list]) -- http://mail.python.org/mailman/listinfo/python-list

Re: No module named ...

2007-03-20 Thread Leif K-Brooks
gtb wrote: > I was having trouble with the 'no module named' error message when > trying to import and noticed that other successful imports were > pulling from .py files that had the dot replaced with $ and .class > appended to the name. Actually in one case it picked up a .pyc file > then created

YouTube showing repr() of a tuple

2007-03-29 Thread Leif K-Brooks
Thought this might amuse some of you: I'd heard that YouTube uses Python, but it's fun to see proof of that, even if it comes in the form of a minor bug. -- http://mail.python.org/mailman/listinfo/python-list

Re: YouTube showing repr() of a tuple

2007-03-29 Thread Leif K-Brooks
Leif K-Brooks wrote: > Thought this might amuse some of you: > > <http://youtube.com/results?search_query=korect+my+speling> Better example: <http://youtube.com/results?search_query=korect+my+speling%C2%A1> -- http://mail.python.org/mailman/listinfo/python-list

Re: YouTube showing repr() of a tuple

2007-04-02 Thread Leif K-Brooks
Paul Boddie wrote: > On 2 Apr, 16:19, Steve Holden <[EMAIL PROTECTED]> wrote: >> Both fixed by the time I managed to follow the links. > > There wasn't much to see, and putting apostrophes into the input > didn't seem to cause "proper" repr() behaviour. So I suspect that the > Python resemblance w

Python Speech tools

2007-04-10 Thread Amit K Saha
Hi list I intend to design a Speech Recognition system.Can I have some pointers to the available Python speech tools? Till date I am aware of only Python bindings for a speech tool called Snack (http://www.speech.kth.se/snack/) Any help will be appreciated. -- Amit K Saha <[EMAIL PROTEC

Re: Python-list Digest, Vol 43, Issue 155

2007-04-10 Thread Amit K Saha
Hi mike! > > I've played with the win32 module's text-to-speech abilities a little. > > You may be able to get ideas from that. Here's a link to more info: > > http://surguy.net/articles/speechrecognition.xml > > > > http://www.cs.unc.edu/~parente/tech/tr02.shtml > > I forgot to mention that I am

working of round()

2007-04-15 Thread Krishna . K . 1900
Does round() always perfectly return the output expected or are there some artifacts which don't allow perfect functionality Using python 2.5: >>> round(12.234, 2) 12.23 >>> round(12.234, 3) 12.234 >>> round(12.234, 1) 12.199 >>> but was expecting 12.2 Also, for round(x,n), can't 'x'

Leo 4.4.4 beta 3 released

2007-10-23 Thread Edward K Ream
ttp://sourceforge.net/project/showfiles.php?group_id=3458 CVS: http://leo.tigris.org/source/browse/leo/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: http://w

ANN: Leo 4.4.4 beta 4 released

2007-10-27 Thread Edward K Ream
eamleo/testimonials.html ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/mailman/listinfo/python-list

[ANN] Leo 4.4.4 Final released

2007-11-02 Thread Edward K Ream
ront.html Home: http://sourceforge.net/projects/leo/ Download: http://sourceforge.net/project/showfiles.php?group_id=3458 CVS: http://leo.tigris.org/source/browse/leo/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html -

Legally correct way of copying stdlib module?

2007-01-10 Thread Leif K-Brooks
I'm writing a package where I need to use the uuid module. Unfortunately, that module is only available in Python 2.5, and my package needs to be compatible with 2.4. I'm planning to copy it from Python 2.5's stdlib into my package, and import it like this: try: import uuid except ImportEr

Re: __getattr__ equivalent for a module

2007-01-15 Thread Leif K-Brooks
Maksim Kasimov wrote: > so my question is: how to tune up a module get default attribute if we > try to get access to not actually exists attribute of a module? You could wrap it in an object, but that's a bit of a hack. import sys class Foo(object): def __init__(self, wrapped): s

Re: Convert from unicode chars to HTML entities

2007-01-28 Thread Leif K-Brooks
Steven D'Aprano wrote: > I have a string containing Latin-1 characters: > > s = u"© and many more..." > > I want to convert it to HTML entities: > > result => > "© and many more..." > > Decimal/hex escapes would be acceptable: > "© and many more..." > "© and many more..." >>> s = u"© and many

Re: Random passwords generation (Python vs Perl) =)

2007-01-28 Thread Leif K-Brooks
NoName wrote: > from random import choice > import string > print ''.join([choice(string.letters+string.digits) for i in > range(1,8)]) > > !!generate password once :( So add a while true: line. > who can write this smaller or without 'import'? Why are those your goals? -- http://mail.python.

<    1   2   3   4   5   6   7   8   >