[issue17390] display python version on idle title bar

2014-06-04 Thread Kent Johnson
Changes by Kent Johnson k...@kentsjohnson.com: -- nosy: -kjohnson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17390 ___ ___ Python-bugs-list

[issue17390] display python version on idle title bar

2013-04-13 Thread Kent Johnson
Kent Johnson added the comment: issue17390_editor_title.patch is not correct, it changes the title on any window that inherits from EditorWindow, including the shell window. Here is a new patch that changes short_title() instead of saved_change_hook(), so it can be overridden by derived

[issue17719] IDLE help text refers to incorrect Python version

2013-04-13 Thread Kent Johnson
New submission from Kent Johnson: The IDLE help text says, Running without a subprocess: (DEPRECATED in Python 3.5 see Issue 16123). According to the referenced issue, this feature is scheduled to be deprecated in *3.4* and *removed* in 3.5. The attached patch corrects the help text

[issue17719] IDLE help text refers to incorrect Python version

2013-04-13 Thread Kent Johnson
Kent Johnson added the comment: Note: this text does not appear in Doc/library/idle.rst so it does not have to be corrected there. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17719

Re: Generators and propagation of exceptions

2011-04-09 Thread Kent Johnson
On Apr 8, 3:47 pm, r nbs.pub...@gmail.com wrote: I'm already making something like this (that is, if I understand you correctly). In the example below (an almost real code this time, I made too many mistakes before) all the Expressions (including the Error one) implement an 'eval' method that

Re: Python 2.7.1

2010-11-29 Thread Kent Johnson
On Nov 27, 11:33 pm, Benjamin Peterson benja...@python.org wrote: On behalf of the Python development team, I'm happy as a clam to announce the immediate availability of Python 2.7.1. Will there be Mac binaries for 2.7.1 and 3.1.3? Currently the web site shows only source and Windows binaries.

[issue10303] small inconsistency in tutorial

2010-11-07 Thread Kent Johnson
Kent Johnson k...@kentsjohnson.com added the comment: Attached patch deletes the referenced sentence. -- keywords: +patch nosy: +kjohnson Added file: http://bugs.python.org/file19536/issue10303.diff ___ Python tracker rep...@bugs.python.org http

[issue7935] Cross-reference ast.literal_eval() from eval() docs

2010-02-15 Thread Kent Johnson
New submission from Kent Johnson k...@kentsjohnson.com: eval() is a known security hole. Since Python 2.6 ast.literal_eval() provides a better alternative in many cases. literal_eval() is not as well known as eval() and not easy to find even if you know it exists (but don't remember the name

[issue7310] Unhelpful __repr__() in os.environ

2009-11-12 Thread Kent Johnson
New submission from Kent Johnson k...@kentsjohnson.com: In Python 2.x, os.environ extends UserDict.IterableUserDict and therefore os.environ.__repr__() shows the environment. This makes it easy and intuitive to view the entire environment in the interactive interpreter. In Python 3.1

Re: ANN: PyGUI 2.0.4

2009-04-21 Thread Kent Johnson
On Apr 21, 8:05 am, Greg Ewing greg.ew...@canterbury.ac.nz wrote: PyGUI 2.0.4 is available:    http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Fixes a few more bugs and hopefully improves things on Windows, although I can't be sure it will fix all the Windows problems people are

[issue4156] Docs for BaseHandler.protocol_xxx methods are unclear

2008-10-21 Thread Kent Johnson
New submission from Kent Johnson [EMAIL PROTECTED]: In the docs for urllib2.BaseHandler previous to Python 2.6, the names of the protocol_xxx() methods were spelled with 'protocol' in italics to indicate that it is a placeholder; the actual method name is e.g. http_opener(). http

Re: utf-8 read/write file

2008-10-08 Thread Kent Johnson
On Oct 8, 5:55 pm, gigs [EMAIL PROTECTED] wrote: Benjamin wrote: On Oct 8, 12:49 pm, Bruno [EMAIL PROTECTED] wrote: Hi! I have big .txt file which i want to read, process and write to another .txt file. I have done script for that, but im having problem with croatian characters

[issue4017] IDLE 2.6 broken on OSX (Leopard)

2008-10-07 Thread Kent Johnson
Changes by Kent Johnson [EMAIL PROTECTED]: -- nosy: +kjohnson ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4017 ___ ___ Python-bugs-list mailing list

Re: tcl/tk version confusion with tkinter in Python 2.6, on OS X

2008-10-06 Thread Kent Johnson
On Oct 6, 5:58 pm, [EMAIL PROTECTED] wrote: On Oct 6, 4:48 pm, [EMAIL PROTECTED] wrote: I'm having trouble with tkinter on a new installation of Python (2.6), built with the framework option from source that was downloaded from python.org. I'm running OS 10.4 on a PowerPC G4. The

[issue4012] Minor errors in multiprocessing docs

2008-10-02 Thread Kent Johnson
Kent Johnson [EMAIL PROTECTED] added the comment: On Thu, Oct 2, 2008 at 1:07 PM, Jesse Noller [EMAIL PROTECTED] wrote: Jesse Noller [EMAIL PROTECTED] added the comment: Which examples are you talking about Georg? I think you mean me, not Georg...I was referring to the example

[issue4012] Minor errors in multiprocessing docs

2008-10-01 Thread Kent Johnson
New submission from Kent Johnson [EMAIL PROTECTED]: In the docs for AsyncResult http://docs.python.org/dev/library/multiprocessing.html#multiprocessing.pool.AsyncResult get([timeout) is missing a ] In the example following, it refers to pool.applyAsync() in two places; the docs spell

[issue3866] int() doesn't 'guess'

2008-09-14 Thread Kent Johnson
New submission from Kent Johnson [EMAIL PROTECTED]: The library reference for int() says, If radix is zero, the proper radix is guessed based on the contents of string; the interpretation is the same as for integer literals. The use of the word 'guess' implies that there is some heuristic used

[issue3671] What's New in 2.6 - corrections

2008-09-04 Thread Kent Johnson
Kent Johnson [EMAIL PROTECTED] added the comment: For the itertools examples, perhaps you could remove the [ ] from the result text so it doesn't look like a list. For example: itertools.izip_longest([1,2,3], [1,2,3,4,5]) - (1, 1), (2, 2), (3, 3), (None, 4), (None, 5

[issue3670] Reporting bugs - no such sections

2008-08-24 Thread Kent Johnson
New submission from Kent Johnson [EMAIL PROTECTED]: The Reporting Bugs section of the Python 2.6b3 docs http://docs.python.org/dev/bugs.html says, please use either the “Add a comment” or the “Suggest a change” features of the relevant page in the most recent online documentation at http

[issue3671] What's New in 2.6 - corrections

2008-08-24 Thread Kent Johnson
New submission from Kent Johnson [EMAIL PROTECTED]: These are minor corrections to the What's New in Python 2.6[b3] doc. Note: the PEP references are to the headers in What's New, not the actual PEPs - PEP 371: The multiprocessing Package - apply() or apply_async, adding a single request

[issue3670] Reporting bugs - no such sections

2008-08-24 Thread Kent Johnson
Kent Johnson [EMAIL PROTECTED] added the comment: You should add something like the old About this document footer. AFAICT there is no information in the new docs about how to report a problem with the docs. ___ Python tracker [EMAIL PROTECTED] http

[issue1163367] correct/clarify documentation for super

2008-03-21 Thread Kent Johnson
Kent Johnson [EMAIL PROTECTED] added the comment: This issue seems to have foundered on finding an explanation for the finer points of super(). Perhaps the glaring errors could at least be corrected, or the fine points could be omitted or glossed over? For example change the first sentence

Re: Prioritization function needed (recursive help!)

2008-01-21 Thread Kent Johnson
rh0dium wrote: Hi all, I need some help on writing a recursive priority function Given a list = [ A, B, C, D] Where the following constraints are in place: A depends on [B, C] C depends on [B] Figure out real order that prioritizes these. You need a topological sort.

Blogmaker 0.5 - blog app for Django

2007-12-12 Thread Kent Johnson
PreFab Software has released Blogmaker (tm) 0.5, a full-featured, production-quality blogging application for Django. It supports trackbacks, ping and comments with moderation and honeypot spam prevention. Blogmaker is free, open-source software licensed under a BSD license. Blogmaker powers

Re: Is there any way to automatically create a transcript of an interactive Python session?

2007-02-18 Thread Kent Johnson
Jonathan Mark wrote: Some languages, such as Scheme, permit you to make a transcript of an interactive console session. Is there a way to do that in Python? Maybe IPython's logging feature is what you want? http://ipython.scipy.org/doc/manual/node6.html#SECTION00066000 Kent --

Re: multiple inheritance of a dynamic list of classes?

2007-02-12 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Hi, I am currently using the Cmd module for a mixed cli+gui application. I am starting to refactor my code and it would be highly desirable if many commands could be built as simple plugins. My idea was: - Load a list of plugin names (i.e. from the config file,

Re: Array delete

2007-02-08 Thread Kent Johnson
azrael wrote: if you are new to python then this will be easier to understand. if you change this a liitle bit (depending on syntax) it should work in any language. just copy and paste to a .py file Yikes. If you are new to Python please ignore this un-Pythonic abomination. Check(listItem,

Re: in place-ness of list.append

2007-02-05 Thread Kent Johnson
Bart Van Loon wrote: Hi all, I would like to find out of a good way to append an element to a list without chaing that list in place, like the builtin list.append() does. currently, I am using the following (for a list of integers, but it could be anything, really)

Re: Unicode formatting for Strings

2007-02-05 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Hi, I´m trying desperately to tell the interpreter to put an 'á' in my string, so here is the code snippet: # -*- coding: utf-8 -*- filename = uAtaris Aquáticos #2.txt f = open(filename, 'w') Then I save it with Windows Notepad, in the UTF-8 format. So: 1)

Re: Can I undecorate a function?

2007-01-29 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Matt In some instances I want to access just the function f, though, Matt and catch the values before they've been decorated. def f(x): return x * x @as_string def fs(x): return f(x) or just fs = as_string(f) Kent Call the one you want.

Re: Learning Python book, new edition?

2007-01-11 Thread Kent Johnson
Bjoern Schliessmann wrote: Demel, Jeff wrote: Does anyone know if there's a plan in the works for a new edition of Learning Python? The current edition (2nd) is a few years old and looks like it only covers Python 2.3. IIRC, differences to 2.4 are in it, too. No, it is one version back

Re: Some basic newbie questions...

2007-01-02 Thread Kent Johnson
jonathan.beckett wrote: I'm just finding it a bit weird that some of the built in functions are static, rather than methods of objects (such as len() being used to find the length of a list). Another explanation here:

Re: Slowdown in Jython

2006-12-29 Thread Kent Johnson
tac-tics wrote: I have an application written in jython which has to process a number of records. It runs fine until it gets to about 666 records (and maybe that's a sign), and then, it's performance and responsiveness goes down the toilet. It looks like it's running out of memory and is being

Re: One module per class, bad idea?

2006-12-25 Thread Kent Johnson
Carl Banks wrote: Kent Johnson wrote: Carl Banks wrote: Now, I think this is the best way to use modules, but you don't need to use modules to do get higher-level organization; you could use packages instead. It's a pain if you're working on two different classes in the same system you have

Re: One module per class, bad idea?

2006-12-22 Thread Kent Johnson
Carl Banks wrote: Now, I think this is the best way to use modules, but you don't need to use modules to do get higher-level organization; you could use packages instead. It's a pain if you're working on two different classes in the same system you have to keep switching files; but I guess

Re: reloading modules

2006-12-15 Thread Kent Johnson
Dustan wrote: [EMAIL PROTECTED] wrote: I'm using python.exe to execute my modules. I have a music.py module which contains my classes and a main.py module which uses these classes. In python.exe, I call import main to execute my program. The problem is that I have to close python and reopen

Re: Common Python Idioms

2006-12-15 Thread Kent Johnson
Fredrik Lundh wrote: Stephen Eilert wrote: I do think that, if it is faster, Python should translate x.has_key(y) to y in x. http://svn.python.org/view/sandbox/trunk/2to3/fix_has_key.py?view=markup Seems to have moved to here:

Re: Functions, callable objects, and bound/unbound methods

2006-12-01 Thread Kent Johnson
Ron Garret wrote: The reason I want to do this is that I want to implement a trace facility that traces only specific class methods. I want to say: trace(c1.m1) and have c1.m1 be replaced with a wrapper that prints debugging info before actually calling the old value of m1. The reason

Re: Functions, callable objects, and bound/unbound methods

2006-12-01 Thread Kent Johnson
Ron Garret wrote: The reason I want to do this is that I want to implement a trace facility that traces only specific class methods. I want to say: trace(c1.m1) and have c1.m1 be replaced with a wrapper that prints debugging info before actually calling the old value of m1. The reason

Re: a quickie: range - x

2006-11-30 Thread Kent Johnson
Steven D'Aprano wrote: On Wed, 29 Nov 2006 19:42:16 -0800, rjtucke wrote: I want an iterable from 0 to N except for element m (=M). x = range(m-1) + range(m+1, N) Should be range(m) + range(m+1, N) Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: multi split function taking delimiter list

2006-11-14 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Hi, I'm looking for something like: multi_split( 'a:=b+c' , [':=','+'] ) returning: ['a', ':=', 'b', '+', 'c'] whats the python way to achieve this, preferably without regexp? What do you have against regexp? re.split() does exactly what you want: In [1]:

Re: Book about database application development?

2006-10-17 Thread Kent Johnson
Wolfgang Keller wrote: I know about the existence of MVC. But what I'm actually missing is a nice textbook that teaches how to actually implement it (and other design patterns which are useful for database applications) in a real-world application in a way that leads to non-ridiculous

Re: why should dict not be callable?

2006-10-17 Thread Kent Johnson
[EMAIL PROTECTED] wrote: A couple of times recently I've come across this problem: I have a large list to sort and I need to the the key=function argument to sort appropriately. But I actually have the key mapping in a big dictionary. Now I have to make an intermediary function: def

Re: command text parsing and hints displaying on user input.

2006-10-17 Thread Kent Johnson
Andy wrote: Hi guys, I'm writing a program with a feature of accepting user input as command text and parsing it to correct function calls...example: 5 minutes later/5 min later/5 minute later/after 5 minutes... are being parsed as the same rule so the system will call a later function

Re: preemptive OOP?

2006-10-04 Thread Kent Johnson
Mark Elston wrote: * Kent Johnson wrote (on 9/30/2006 2:04 PM): John Salerno wrote: So my question in general is, is it a good idea to default to an OOP design like my second example when you aren't even sure you will need it? I know it won't hurt, and is probably smart to do sometimes

Re: preemptive OOP?

2006-09-30 Thread Kent Johnson
John Salerno wrote: So my question in general is, is it a good idea to default to an OOP design like my second example when you aren't even sure you will need it? I know it won't hurt, and is probably smart to do sometimes, but maybe it also just adds unnecessary code to the program. In

Re: windev vs python SOS

2006-09-29 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Hi Stéphane, stéphane bard wrote: hello, my boss ask me to prefer windev to python. I have to argue First, no matter how good is Python, you should not desagree with your boss. Second, Windew is quite good and fun, you will love it. Yes, the boss is always

Re: Looking for the Perfect Editor

2006-09-11 Thread Kent Johnson
Dick Moores wrote: At 06:30 PM 9/10/2006, Kent Johnson wrote: Dick Moores wrote: Also, why do you use TextPad instead of IDLE? You're kidding, right? No. Tell me, please. Macros? Comparing files? What else? OK...please, no one interpret this as IDLE bashing or attempt to show me a better

Re: efficient text file search.

2006-09-11 Thread Kent Johnson
noro wrote: Is there a more efficient method to find a string in a text file then: f=file('somefile') for line in f: if 'string' in line: print 'FOUND' Probably better to read the whole file at once if it isn't too big: f = file('somefile') data = f.read() if 'string' in data:

Re: Looking for the Perfect Editor

2006-09-10 Thread Kent Johnson
Dick Moores wrote: At 01:10 PM 9/8/2006, Doug Stell wrote: Try www.TextPad.com. I've used it for years and love it. It understands many programming language constructs and can be taught to understand python so that things show up in color. Any tips on how to teach TextPad to understand

Re: Looking for the Perfect Editor

2006-09-10 Thread Kent Johnson
Dick Moores wrote: I downloaded Python (7) from http://www.textpad.com/add-ons/synn2t.html and put the file PythonV2.4.syn in C:\Program Files\TextPad 4\system . However, no syntax highlighting is showing up. so I must have done something wrong. Do I have to do something other than put

Re: Finding the name of a class

2006-08-02 Thread Kent Johnson
Kirk Strauser wrote: Larry Bates wrote: print print b.__class__.__name__ gives what you want That doesn't seem to do it, though. Here's the result of importing a module from my company's internally-developed library: from Daycos.TableCopier.copyfro import StateProcessor print

Python proficiency test

2006-07-21 Thread Kent Johnson
I recently helped create an on-line Python proficiency test. The publisher of the test is looking for beta testers to try the test and give feedback. If you are interested, here is an announcement from the publisher: Brainbench is currently beta testing a new series of test questions for

Re: Standard Yes / No Windows Dialog box creation

2006-06-21 Thread Kent Johnson
[EMAIL PROTECTED] wrote: I found a way to create Open File or Open Folder windows dialog boxes, but not to create an easier Yes / No dialog box... Maybe someone has a solution for this? Maybe you would like EasyGui http://www.ferg.org/easygui/ Kent --

Re: nested functions

2006-06-15 Thread Kent Johnson
Fredrik Lundh wrote: George Sakkis wrote: It shouldn't come as a surprise if it turns out to be slower, since the nested function is redefined every time the outer is called. except that it isn't, really: all that happens is that a new function object is created from prebuilt parts, and

Re: Is there a better way of accessing functions in a module?

2006-06-13 Thread Kent Johnson
Ant wrote: Ant wrote: ... But this feels like a hack... Is there a cleaner way for accessing the functions of the current module similar to the __dict__ attribute of classes? i.e. a way to access the local symbol table? Sorry - posted too soon. Found the globals() built-in... You can also

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: 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 me

Re: regexp questoin

2006-06-09 Thread Kent Johnson
[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 search

Re: Storing nothing in a dictionary and passing it to a function

2006-06-05 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Hi, I'm writing a hand-written recursive decent parser for SPICE syntax parsing. In one case I have one function that handles a bunch of similar cases (you pass the name and the number of tokens you're looking for). In another case I have a function that handles a

Re: ANN: PQRC - Python Quick Reference Card - v 0.55

2006-06-04 Thread Kent Johnson
Laurent Pointal wrote: And I'll maintain a fixed URL at http://laurent.pointal.org/python/pqrc/ Broken at the moment. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] lxml 1.0 released

2006-06-02 Thread Kent Johnson
Stefan Behnel wrote: Hallo everyone, I have the honour to announce the availability of lxml 1.0. http://codespeak.net/lxml/ It's downloadable from cheeseshop: http://cheeseshop.python.org/pypi/lxml Are there any plans to offer a Windows installer? Thanks, Kent --

Re: os.walk trouble

2006-06-01 Thread Kent Johnson
The Prophet wrote: As my first Python script, I am trying to make a program that recurses a directory searching for files whose names match a pattern. If your patterns are simple (supported by fnmatch), the path module makes this very easy: import path for f in

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Hi Alex, With all due respect to your well-deserved standing in the Python community, I'm not convinced that equality shouldn't imply invariance under identical operations. Perhaps the most fundamental notion is mathematics is that the left and right sides of an

Re: Python for Visual Basic or C# programmers

2006-06-01 Thread Kent Johnson
A.M wrote: I am trying to find the equivalent functions such as vb's str or asc in Python. Is there any resource that help me to find these kinds of functions in Python faster? The Library Reference has a section on built-in functions: http://docs.python.org/lib/built-in-funcs.html Also

Re: genexp performance problem?

2006-05-30 Thread Kent Johnson
Delaney, Timothy (Tim) wrote: python -mtimeit sum(int(L) for L in xrange(3000)) 100 loops, best of 3: 6.76 msec per loop python -mtimeit -s g = (int(L) for L in xrange(3000)) sum(g) 100 loops, best of 3: 1.09 usec per loop The generator comprehension needs to create a new generator

Re: Speed up this code?

2006-05-26 Thread Kent Johnson
[EMAIL PROTECTED] wrote: I'm creating a program to calculate all primes numbers in a range of 0 to n, where n is whatever the user wants it to be. I've worked out the algorithm and it works perfectly and is pretty fast, but the one thing seriously slowing down the program is the following

Re: Parsing python dictionary in Java using JPython

2006-05-26 Thread Kent Johnson
sandip desale wrote: Hi, We have some tools which are developed in Python and using python dictionaries. Now for some new requirments we are using Java and want to use the existing dictionaries as both the tools are executed on the same platform. So we are trying to use the existing

Re: Finding Upper-case characters in regexps, unicode friendly.

2006-05-25 Thread Kent Johnson
[EMAIL PROTECTED] wrote: I'm trying to make a unicode friendly regexp to grab sentences reasonably reliably for as many unicode languages as possible, focusing on european languages first, hence it'd be useful to be able to refer to any uppercase unicode character instead of just the typical

Re: Best way to handle exceptions with try/finally

2006-05-25 Thread Kent Johnson
Zameer wrote: I wonder where the else goes in try..except..finally... try / except / else / finally See the PEP: http://www.python.org/dev/peps/pep-0341/ Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: NEWB: how to convert a string to dict (dictionary)

2006-05-24 Thread Kent Johnson
manstey wrote: Hi, How do I convert a string like: a={'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'} into a dictionary: b={'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'} Try this recipe:

GUI viewer for profiler output?

2006-05-23 Thread Kent Johnson
Can anyone point me to a GUI program that allows viewing and browsing the output of the profiler? I know I have used one in the past but I can't seem to find it... Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: can't figure out error: module has no attribute...

2006-05-23 Thread Kent Johnson
Chris_147 wrote: but it seems to depend on from where I start the Python shell. so I've got a module selfservicelabels.py with some variables defined, like this: BtnSave = link=label.save DeliveryAutomaat= //[EMAIL PROTECTED]'deliveryMethod' and @value='AU'] This module is

Re: grabbing portions of a file to output files

2006-05-22 Thread Kent Johnson
[EMAIL PROTECTED] wrote: hi. I have a file with this kind of structure: Hxxx . . . x Hxxx ... ... x H . and so onlines starting with 'H' are headers.

Re: who can give me the detailed introduction of re modle?

2006-05-19 Thread Kent Johnson
softwindow wrote: the re module is too large and difficult to study i need a detaild introduction. http://www.amk.ca/python/howto/regex/ Kent -- http://mail.python.org/mailman/listinfo/python-list

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: retain values between fun calls

2006-05-14 Thread Kent Johnson
George Sakkis wrote: Gary Wessle wrote: Hi the second argument in the functions below suppose to retain its value between function calls, the first does, the second does not and I would like to know why it doesn't? and how to make it so it does? thanks # it does def f(a, L=[]):

Re: any plans to make pprint() a builtin?

2006-05-14 Thread Kent Johnson
Duncan Booth wrote: Personally I'd just like to see 'python' a builtin shorthand for importing a name you aren't going to use much e.g. python.pprint.pprint(x) Would you settle for import py py.std.pprint.pprint(x) ? http://codespeak.net/py/current/doc/misc.html#the-py-std-hook Kent

Re: Memory leak in Python

2006-05-11 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Sure, are there any available simulators...since i am modifying some stuff i thought of creating one of my own. But if you know some exisiting simlators , those can be of great help to me. http://simpy.sourceforge.net/ --

Re: unittest: How to fail if environment does not allow execution?

2006-05-11 Thread Kent Johnson
Kai Grossjohann wrote: I wrote a test case that depends on a certain file existing in the environment. So, I guess I should test that the file exists in the setUp method. But what if it doesn't exist? How do I fail in that case? I would like to emit an error message explaining what is

Re: glob() that traverses a folder tree

2006-05-11 Thread Kent Johnson
[EMAIL PROTECTED] wrote: # i'm guessing os.walk() is the best way to traverse folder trees. import os, glob for dir, subdir, files in os.walk('.\InteropSolution'): for file in files: if glob.fnmatch.fnmatch(file,*.dll) or glob.fnmatch.fnmatch(file,*.exe): print

Re: regular expressions, substituting and adding in one step?

2006-05-10 Thread Kent Johnson
John Salerno wrote: Call me crazy, but I'm interested in regular expressions right now. :) Not crazy at all. REs are a powerful and useful tool that every programmer should know how to use. They're just not the right tool for every job! Kent --

Re: data entry tool

2006-05-10 Thread Kent Johnson
Peter wrote: This post seeks advice on whether python would be appropriate for a task, or whether you can suggest another approach. The project is to transcribe historical records such as schools admissions, ship passenger lists, birth/death/marriages, etc for genealogy studies. What we

Re: reusing parts of a string in RE matches?

2006-05-10 Thread Kent Johnson
John Salerno wrote: I probably should find an RE group to post to, but my news server at work doesn't seem to have one, so I apologize. But this is in Python anyway :) So my question is, how can find all occurrences of a pattern in a string, including overlapping matches? You can

Re: Global utility module/package

2006-05-09 Thread Kent Johnson
Christoph Haas wrote: Evening, I'm currently working on a larger Python project that consists of multiple programs and packages. As I need a few utility functions time and again I moved them all into a Utility package and created a class there. ... As I know that importing packages from

Re: regular expressions, substituting and adding in one step?

2006-05-09 Thread Kent Johnson
John Salerno wrote: Ok, this might look familiar. I'd like to use regular expressions to change this line: self.source += 'p' + paragraph + '/p\n\n' to read: self.source += 'p%s/p\n\n' % paragraph Now, matching the middle part and replacing it with '%s' is easy, but how would I

Re: Enumerating Regular Expressions

2006-05-09 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Hi all, Does anybody know of a module that allows you to enumerate all the strings a particular regular expression describes? Make a generator that yields *all* strings in your chosen alphabet (see the monthly threads about permutations and combinations for hints).

Re: Designing Plug-in Systems in Python

2006-05-07 Thread Kent Johnson
mystilleef wrote: Hello, I need to design a plug-in system for a project. The goal is to allow third party developers interact with an application via plug-ins in a clean and robust manner. At this point I am overwhelmed by my inexperience with designing plug-in systems. One of these

Re: the print statement

2006-05-07 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Thank you. Yes, that post answers most of the questions. I now have a bit of an understanding of the \xhh pattern. It's still unclear to me, however, how one can go from the \x92 pattern and arrive at the apostrophe character. Is \x92 theh apostrophe character in

Re: Replace

2006-05-06 Thread Kent Johnson
Eric wrote: I have a string... str = tyrtrbd =ffgtyuf == =tyryr =u=p ff I want to replace the characters after each '=', If you are replacing any char after = with # then re.sub() makes it easy: In [1]: import re In [2]: s = tyrtrbd =ffgtyuf == =tyryr =u=p ff In [3]: re.sub('=.',

Re: string.find first before location

2006-05-03 Thread Kent Johnson
Gary Wessle wrote: ps. is there a online doc or web page where one enters a method and it returns the related docs? The index to the library reference is one place: http://docs.python.org/lib/genindex.html and of course help() in the interactive interpreter... Kent --

Re: Regular Expression help

2006-04-28 Thread Kent Johnson
Edward Elliott wrote: [EMAIL PROTECTED] wrote: If you are parsing HTML, it may make more sense to use a package designed especially for that purpose, like Beautiful Soup. I don't know Beautiful Soup, but one advantage regexes have over some parsers is handling malformed html. Beautiful

Re: best way to determine sequence ordering?

2006-04-28 Thread Kent Johnson
I V wrote: Incidentally, does python have a built-in to do a binary search on a sorted list? Obviously it's not too tricky to write one, but it would be nice if there was one implemented in C. See the bisect module. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: list of functions question

2006-04-27 Thread Kent Johnson
val bykoski wrote: Hi The List: I have a modeling app where i'm detecting events (in temporal dynamics) applying a set of (boolean) functions - kind of: event_list = f1 f2 etc.split() # each fi detects a specific event i have defs for functions fi, or simple boolean expressions for

Re: can this be done without eval/exec?

2006-04-27 Thread Kent Johnson
Schüle Daniel wrote: and now the obvious one (as I thought at first) lst=[] for i in range(10): ... lst.append(lambda:i) ... lst[0]() 9 i 9 I think I understand where the problem comes from lambda:i seems not to be fully evalutated it just binds object with name i

Re: Thanks from the Java Developer

2006-04-21 Thread Kent Johnson
Alex Martelli wrote: Ant [EMAIL PROTECTED] wrote: Python ruined my life. Python ruined me for Java coding too. At least in the Bay Area, the jobmarket for Python programmers is wild, right now -- firms such as Google, Pixar, BitTorrent, IronPort, etc, etc, all hungry for Pythonistas --

Re: Confused by Python and nested scoping (2.4.3)

2006-04-20 Thread Kent Johnson
Kelvie Wong wrote: There are only two scopes in Python -- global scope and function scope. No, Python has local, nested, global and built-in scope. Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: Method Call in Exception

2006-04-20 Thread Kent Johnson
Carl Banks wrote: mwt wrote: In my latest attempt at some Python code, I've been tempted to write something in the form of: try: [...] #doing some internet stuff except IOError: alternate_method_that_doesnt_need_internet() This works when I try it, but I feel vaguely uneasy about

Re: how to transfer a python object to other computer?

2006-04-20 Thread Kent Johnson
Hey, all.Now I wanna to transfer a object to other computer, Maybe I could serialize the object to a file by pickle moudle, then send the file and get it from the file.But I think the efficency is awful, because the disk io is very slow. Someone could do me a favor to give me some

Re: send cookie on request with urllib2

2006-04-20 Thread Kent Johnson
itay_k wrote: Hi, I dont understand why this is so complicated, just to add one line of cookie header on the GET request. This is my unworking code: import time import Cookie import cookielib, urllib2 c= cookielib.Cookie(1,Name,Tom, 80,False, itay, False, False, d:\\asddd,False,

  1   2   3   4   5   6   7   >