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

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

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

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

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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

<    2   3   4   5   6   7