[issue35831] Format Spec example says limited to 3.1+ but works in 2.7

2019-01-25 Thread Mitchell L Model
Change by Mitchell L Model : -- assignee: -> docs@python components: +Documentation nosy: +docs@python ___ Python tracker <https://bugs.python.org/issu

[issue35831] Format Spec example says limited to 3.1+ but works in 2.7

2019-01-25 Thread Mitchell L Model
New submission from Mitchell L Model : https://docs.python.org/3/library/string.html#format-examples includes this line: '{}, {}, {}'.format('a', 'b', 'c') # 3.1+ only This does in fact work in 2.7. I don't see anything special about this -- seems an entirely straightforward format

Re: sys.stdout vs. sys.stderr

2010-03-09 Thread Mitchell L Model
On Jan 11, 2010, at 1:47 PM Nobody nob...@nowhere.com wrote: On Mon, 11 Jan 2010 10:09:36 +0100, Martin v. Loewis wrote: In Python 3.1 is there any difference in the buffering behavior of the initial sys.stdout and sys.stderr streams? No. Were they different at some earlier point in

CGI, POST, and file uploads

2010-03-03 Thread Mitchell L Model
On Mar 2, 2010, at 4:48 PM, I wrote: Can someone tell me how to upload the contents of a (relatively small) file using an HTML form and CGI in Python 3.1? As far as I can tell from a half-day of experimenting, browsing, and searching the Python issue tracker, this is broken. followed by

CGI, POST, and file uploads

2010-03-02 Thread Mitchell L Model
Can someone tell me how to upload the contents of a (relatively small) file using an HTML form and CGI in Python 3.1? As far as I can tell from a half-day of experimenting, browsing, and searching the Python issue tracker, this is broken. Very simple example: html head /head body

lists as an efficient implementation of large two-dimensional arrays(!)

2010-02-02 Thread Mitchell L Model
An instructive lesson in YAGNI (you aren't going to need it), premature optimization, and not making assumptions about Python data structure implementations. I need a 1000 x 1000 two-dimensional array of objects. (Since they are instances of application classes it appears that the array

Re: python 3's adoption

2010-01-28 Thread Mitchell L Model
I have been working with Python 3 for over a year. I used it in writing my book Bioinformatics Programming Using Python (http://oreilly.com/catalog/9780596154509 ). I didn't see any point in teaching an incompatible earlier version of a language in transition. In preparing the book and its

Re: python 3's adoption

2010-01-28 Thread Mitchell L Model
On Jan 28, 2010, at 12:00 PM, python-list-requ...@python.org wrote: From: Roy Smith r...@panix.com Date: January 28, 2010 11:09:58 AM EST To: python-list@python.org Subject: Re: python 3's adoption In article mailman.1545.1264694607.28905.python-l...@python.org, Mitchell L Model mlm

Re: python 3's adoption

2010-01-28 Thread Mitchell L Model
On Jan 28, 2010, at 1:40 PM, Terry Reedy tjre...@udel.edu wrote ... On 1/28/2010 11:03 AM, Mitchell L Model wrote: I have been working with Python 3 for over a year. ... I agree completely. Such sweet words to read! Conversion of old code is greatly facilitied by the 2to3 tool

Re: I really need webbrowser.open('file://') to open a web browser

2010-01-27 Thread Mitchell L Model
On Jan 15, 2010, at 3:59 PM, Timur Tabi ti...@freescale.com After reading several web pages and mailing list threads, I've learned that the webbrowser module does not really support opening local files, even if I use a file:// URL designator. In most cases, webbrowser.open() will indeed open

Re: I really need webbrowser.open('file://') to open a web browser

2010-01-27 Thread Mitchell L Model
On Jan 27, 2010, at 3:31 PM, Timur Tabi wrote: On Wed, Jan 27, 2010 at 12:29 PM, Mitchell L Model mlm...@comcast.net wrote: I had some discussions with the Python documentation writers that led to the following note being included in the Python 3.1 library documentation

sys.stdout vs. sys.stderr

2010-01-10 Thread Mitchell L Model
In Python 3.1 is there any difference in the buffering behavior of the initial sys.stdout and sys.stderr streams? They are both line_buffered and stdout doesn't seem to use a larger-grain buffering, so they seem to be identical with respect to buffering. Were they different at some earlier

Re: Python-list Digest, Vol 76, Issue 97

2010-01-09 Thread Mitchell L Model
On Jan 8, 2010, at 7:35:39 PM EST, Terry Reedy tjre...@udel.edu wrote: On 1/8/2010 12:02 PM, Mitchell L Model wrote: On further reflection, I will add that what appears to be happening is that during import both the global and local dictionaries are set to a copy of the globals() from

Re: One function calling another defined in the same file being exec'd

2010-01-08 Thread Mitchell L Model
On Jan 7, 2010, at 10:45 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote an extensive answer to my questions about one function calling another in the same file being exec'd. His suggestion about printing out locals() and globals() in the various possible places provided

Re: One function calling another defined in the same file being exec'd

2010-01-08 Thread Mitchell L Model
On Jan 8, 2010, at 9:55 AM, Gabriel Genellina gagsl- p...@yahoo.com.ar wrote: Ok - short answer or long answer? Short answer: Emulate how modules work. Make globals() same as locals(). (BTW, are you sure you want the file to run with the *same* globals as the caller? It sees the

One function calling another defined in the same file being exec'd

2010-01-07 Thread Mitchell L Model
[Python 3.1] I thought I thoroughly understood eval, exec, globals, and locals, but I encountered something bewildering today. I have some short files I want to exec. (Users of my application write them, and the application gives them a command that opens a file dialog box and execs the

Re: One function calling another defined in the same file being exec'd

2010-01-07 Thread Mitchell L Model
I forgot to offer one answer for question [3] in what I just posted: I can define all the secondary functions inside one main one and just call the main one. That provides a separate local scope within the main function, with the secondary functions defined inside it when (each time) the

Re: invoking a method from two superclasses

2009-07-01 Thread Mitchell L Model
[Continuing the discussion about super() and __init__] The documentation of super points out that good design of diamond patterns require the methods to have the same signature throughout the diamond. That's fine for non-mixin classes where the diamond captures different ways of handling the

invoking a method from two superclasses

2009-06-30 Thread Mitchell L Model
In Python 3, how should super() be used to invoke a method defined in C that overrides its two superclasses A and B, in particular __init__? class A: def __init__(self): print('A') class B: def __init__(self): print('B') class C(A, B):

Re: invoking a method from two superclasses

2009-06-30 Thread Mitchell L Model
Allow me to add to my previous question that certainly the superclass methods can be called explicitly without resorting to super(), e.g.: class C(A, B): def __init__(self): A.__init__(self) B.__init__(self) My question is really whether there is any way of

Re: invoking a method from two superclasses

2009-06-30 Thread Mitchell L Model
From: Scott David Daniels scott.dani...@acm.org Date: Tue, 30 Jun 2009 16:49:18 -0700 Message-ID: ieudnfm_j89ep9fxnz2dnuvz_g6dn...@pdx.net Subject: Re: invoking a method from two superclasses Mitchell L Model wrote: In Python 3, how should super() be used to invoke a method defined in C

sqlite3, qmarks, and NULL values

2009-05-19 Thread Mitchell L Model
Suppose I have a simple query in sqlite3 in a function: def lookupxy(x, y): conn.execute(SELECT * FROM table WHERE COL1 = ? AND COL2 = ?, (x, y)) However, COL2 might be NULL. I can't figure out a value for y that would retrieve rows for which COL2 is NULL. It