OT: Accessibility: Jana Schroeder's Holman Prize Application

2021-05-10 Thread Jonathan Fine
Perhaps Off Topic, but for a good cause. This year I met Jana Schroeder, a blind person forced to change jobs as part of the social cost of Covid. Her outsider experience of computer coding training became a wish to make things better. She has applied for a Holman Prize ($25,000 over a year) to

What could 'f(this:that=other):' mean?

2005-01-05 Thread Jonathan Fine
Giudo has suggested adding optional static typing to Python. (I hope suggested is the correct word.) http://www.artima.com/weblogs/viewpost.jsp?thread=85551 An example of the syntax he proposes is: > def f(this:that=other): > print this This means that f() has a 'this' parameter, of type 'tha

Re: What could 'f(this:that=other):' mean?

2005-01-05 Thread Jonathan Fine
Jeff Shannon wrote: Jonathan Fine wrote: Giudo has suggested adding optional static typing to Python. (I hope suggested is the correct word.) http://www.artima.com/weblogs/viewpost.jsp?thread=85551 An example of the syntax he proposes is: > def f(this:that=other): > print this I&#

Re: What could 'f(this:that=other):' mean?

2005-01-07 Thread Jonathan Fine
Jonathan Fine wrote: I'll post some usage examples later today, I hope. Well, here are some examples. A day later, I'm afraid. ** Pipelines and other composites This is arising for me at work. I produce Postscript by running TeX on a document. And then running dvips on the output of T

Re: What could 'f(this:that=other):' mean?

2005-01-07 Thread Jonathan Fine
Jeff Shannon wrote: Jonathan Fine wrote: The use of *args and **kwargs allows functions to take a variable number of arguments. The addition of ***nsargs does not add significantly. I've posted usage examples elsewhere in this thread. I think they show that ***nsargs do provide a benefi

Re: What could 'f(this:that=other):' mean?

2005-01-11 Thread Jonathan Fine
Nick Coghlan wrote: If the caller is meant to supply a namespace, get them to supply a namespace. def f(ns1, ns2): print ns1['a'], ns1['b'], ns2['a'], ns2['b'] f(ns1 = dict(a=1, b=2), ns2 = dict(a=3, b=4)) Hey, where's Steve? Maybe his generic objects should be called namespaces instead of bun

Re: best way to do a series of regexp checks with groups

2005-01-24 Thread Jonathan Fine
Mark Fanty wrote: In perl, I might do (made up example just to illustrate the point): if(/add (\d+) (\d+)/) { do_add($1, $2); } elsif (/mult (\d+) (\d+)/) { do_mult($1,$2); } elsif(/help (\w+)/) { show_help($1); } or even do_add($1,$2) if /add (\d+) (\d+)/; do_mult($1,$2) if /mult (\d+) (\d+)

Converting TeX tokens into characters

2005-06-28 Thread Jonathan Fine
I'm sort of wishing to convert TeX tokens into characters. We can assume the standard (i.e. plain) category codes. And that the characters are to be written to a file. This proceess to take place outside of TeX. Say in a Python program. Think of a pretty-printer. * Read the TeX in as tokens. * W

Non-blocking input on windows, like select in Unix

2005-03-01 Thread Jonathan Fine
Hello I have written a program that interacts with a command line program. Roughly speaking, it mimics human interaction. (With more speed and accuracy, less intelligence.) It works fine under Linux, using select(). But Windows does not support select for files. Only for sockets. Here's a google se

Re: Non-blocking input on windows, like select in Unix

2005-03-01 Thread Jonathan Fine
Paul Rubin wrote: Jonathan Fine <[EMAIL PROTECTED]> writes: My question is this: Under Windows, is it possible to read as many bytes as are available from stdout, without blocking? I think Windows implements non-blocking i/o calls. However the traditional (to some) Python or Java appro

Re: Non-blocking input on windows, like select in Unix

2005-03-02 Thread Jonathan Fine
fraca7 wrote: Jonathan Fine a écrit : Paul Rubin wrote: As I recall, some posts to this list say that Windows provides non-blocking i/o for sockets but not for files. No, Windows does provide non-blocking I/O for regular files, but it's a completely different mechanism than the one us

Simple Python + Tk text editor

2005-04-13 Thread Jonathan Fine
Hi I'm looking for a simple Python + Tk text editor. I want it as a building block/starting point. I need basic functions only: open a file, save a file, new file etc. It has to be open source. Anyone know of a candidate? -- Jonathan http://qatex.sourceforge.org -- http://mail.python.org/mailman/

Re: Simple Python + Tk text editor

2005-04-13 Thread Jonathan Fine
Paul Rubin wrote: Jonathan Fine <[EMAIL PROTECTED]> writes: I'm looking for a simple Python + Tk text editor. I want it as a building block/starting point. Something wrong with IDLE? Thanks for this suggestion. For some reason, I did not think of IDLE as an editor. Must have been a

Re: Simple Python + Tk text editor

2005-04-14 Thread Jonathan Fine
Eric Brunel wrote: Do you know the (apparently dead) project named e:doc? You can find it here: http://members.nextra.at/hfbuch/edoc/ It's a kind of word processor that can produce final documents to various formats using backends, and one of the backends is for LaTeX. It's written in Perl, but

A Python script to put CTAN into git (from DVDs)

2011-11-06 Thread Jonathan Fine
Hi This it to let you know that I'm writing (in Python) a script that places the content of CTAN into a git repository. https://bitbucket.org/jfine/python-ctantools I'm working from the TeX Collection DVDs that are published each year by the TeX user groups, which contain a snapshot of CT

Re: A Python script to put CTAN into git (from DVDs)

2011-11-06 Thread Jonathan Fine
On 06/11/11 16:42, Jakub Narebski wrote: Jonathan Fine writes: Hi This it to let you know that I'm writing (in Python) a script that places the content of CTAN into a git repository. https://bitbucket.org/jfine/python-ctantools I hope that you meant "repositories" (pl

Re: A Python script to put CTAN into git (from DVDs)

2011-11-07 Thread Jonathan Fine
On 06/11/11 20:28, Jakub Narebski wrote: Note that for gitPAN each "distribution" (usually but not always corresponding to single Perl module) is in separate repository. The dependencies are handled by CPAN / CPANPLUS / cpanm client (i.e. during install). Thank you for your interest, Jakub, an

Re: A Python script to put CTAN into git (from DVDs)

2011-11-07 Thread Jonathan Fine
On 07/11/11 21:49, Jakub Narebski wrote: [snip] But now I understand that you are just building tree objects, and creating references to them (with implicit ordering given by names, I guess). This is to be a start of further work, isn't it? Yes, that's exactly the point, and my apologies if

Writing a bytecode interpreter (for TeX dvi files)

2005-05-26 Thread Jonathan Fine
I'm writing some routines for handling dvi files. In case you didn't know, these are TeX's typeset output. These are binary files containing opcodes. I wish to write one or more dvi opcode interpreters. Are there any tools or good examples to follow for writing a bytecode interpreter? I am alrea

Packing a simple dictionary into a string - extending struct?

2007-06-20 Thread Jonathan Fine
nyone know of any related work? -- Jonathan Fine -- http://mail.python.org/mailman/listinfo/python-list

Re: Packing a simple dictionary into a string - extending struct?

2007-06-20 Thread Jonathan Fine
"Sridhar Ratna" <[EMAIL PROTECTED]> wrote in message > What about JSON? You can serialize your dictionary, for example, in > JSON format and then unserialize it in any language that has a JSON > parser (unless it is Javascript). Thank you for this suggestion. The growing adoption of JSON in Ajax

Re: Packing a simple dictionary into a string - extending struct?

2007-06-22 Thread Jonathan Fine
Jonathan Fine wrote: > Thank you for this suggestion. The growing adoption of JSON in Ajax > programming is a strong argument for my using it in my application, although > I think I'd prefer something a little more binary. > > So it looks like I'll be using JSON. W

Re: Packing a simple dictionary into a string - extending struct?

2007-06-22 Thread Jonathan Fine
John Machin wrote: > def unpack(bytes, unpack_entry=unpack_entry): > '''Return dictionary gotten by unpacking supplied bytes. > Both keys and values in the returned dictionary are byte-strings. > ''' > bytedict = {} > ptr = 0 > while 1: > key, val, ptr = unpack_entr

distutils - how to get more flexible configuration

2007-03-07 Thread Jonathan Fine
ble = '/wobble' === And when a distribution is created and installed we get === $ python setup.py install running install running build running install_data creating /wibble copying data/wibble.txt -> /wibble creating /wobble copying data/wobble.txt -> /wobble === This is an exa

Wanted: a python24 package for Python 2.3

2007-03-20 Thread Jonathan Fine
Hello My problem is that I want a Python 2.4 module on a server that is running Python 2.3. I definitely want to use the 2.4 module, and I don't want to require the server to move to Python 2.4. More exactly, I am using subprocess, which is new in Python 2.4. What I am writing is something like

Re: Wanted: a python24 package for Python 2.3

2007-03-20 Thread Jonathan Fine
[EMAIL PROTECTED] wrote: > On Mar 20, 10:33 am, Jonathan Fine <[EMAIL PROTECTED]> wrote: >>My problem is that I want a Python 2.4 module on >>a server that is running Python 2.3. I definitely >>want to use the 2.4 module, and I don't want to >>require th

Re: Wanted: a python24 package for Python 2.3

2007-03-20 Thread Jonathan Fine
Alex Martelli wrote: > Jonathan Fine <[EMAIL PROTECTED]> wrote: >... > >>In other words, I'm asking for a python24 package that >>contains all (or most) of the modules that are new to >>Python 2.4. > > > For subprocess specifically, s

Re: Wanted: a python24 package for Python 2.3

2007-03-21 Thread Jonathan Fine
Gerald Klix wrote: > Hi, > You can't import subproces from future, only syntactic and semantic > changes that will become standard feature in future python version can > be activated that way. > > You can copy the subprocess module from python 2.4 somewhere where it > will be found from python

[ANN] Metatest 0.1.0

2007-09-18 Thread Jonathan Fine
oject/showfiles.php?group_id=204046 -- Jonathan Fine -- http://mail.python.org/mailman/listinfo/python-list

Re: Metatest 0.1.0

2007-09-18 Thread Jonathan Fine
Kay Schluehr wrote: >> http://metatest.sourceforge.net/doc/pyconuk2007/metatest.html >From the HTML slides: > >Assertion tests are easy to write but report and run poorly. > > I tend to think this is a prejudice that leads to ever more ways to > write tests perform test discoveries, inv

Re: cvs module

2007-09-18 Thread Jonathan Fine
Tim Arnold wrote: > Hi, I need to do some scripting that interacts with CVS. I've been just > doing system calls and parsing the output to figure out what's going on, but > it would be nice to deal with CVS directly. > > Does anyone know of a python module I can use to interface with CVS? > than

Re: can Python be useful as functional? (off topic)

2007-09-18 Thread Jonathan Fine
Steve Holden wrote: > You remind me of the conversation between the philosopher and an > attractive lady whom he was seated next to at dinner. He asked her if > she would sleep with him for a million dollars, to which she readily > agreed. So he followed this by asking her if she'd sleep with h

Re: [ANN] Metatest 0.1.0

2007-09-18 Thread Jonathan Fine
Ben Finney wrote: > Jonathan Fine <[EMAIL PROTECTED]> writes: > >>Here's how to write some tests using Metatest. We can think of the >>tests as an executable specification. >> >>from metatest.py.mymod import plus, Point >> >>#

Re: Metatest 0.1.0

2007-09-18 Thread Jonathan Fine
Kay Schluehr wrote: >>Sounds interesting. Is this code, or examples of its use, available? > > > Sure, it's part of EasyExtend. See also www.fiber-space.de OK. So the ULR for the documentation of consoletest is: http://www.fiber-space.de/EasyExtend/doc/consoletest/consoletest.html It has a r

Re: [ANN] Metatest 0.1.0

2007-09-18 Thread Jonathan Fine
Ben Finney wrote: > [Jonathan, please don't send me copies of messages sent to the > discussion thread. I follow comp.lang.python via a non-mail interface, > and it's irritating to get unwanted copies of messages via email.] [Thank you for letting me know your preference. For myself, I often app

Re: Metatest 0.1.0

2007-09-19 Thread Jonathan Fine
Kay Schluehr wrote: > On 19 Sep., 01:30, Jonathan Fine <[EMAIL PROTECTED]> wrote: > > >>>there is no fundamental reason why it can't be separated from >>>eeconsole.py. >> >>OK. That might be a good idea. > > > Ironically, I liked

Two mappings inverse to each other: f, g = biject()

2007-02-06 Thread Jonathan Fine
Hello As part of the MathTran project I found myself wanting to maintain a bijection between long names and short names. http://www.open.ac.uk/mathtran In other words, I wanted to have two dictionaries f and g such that f[a] == b g[b] == a are equivalent statements. A google search for

Re: Two mappings inverse to each other: f, g = biject()

2007-02-06 Thread Jonathan Fine
Nick Vatamaniuc wrote: > If you need to get a short name, given a long name or vice-verse _and_ > the set of short names and long names is distinct (it would be > confusing if it wasn't!) then you can just have one dictionary, no > need to complicate things too much: > f[a]=b > f[b]=a > You won't

Re: Two mappings inverse to each other: f, g = biject()

2007-02-07 Thread Jonathan Fine
[EMAIL PROTECTED] wrote: >>A google search for biject.py and bijection.py >>produced no hits, so I suspect that this may not >>have been done before. > > > There are few (good too) implementations around, but they are called > bidict or bidirectional dicts. Sometimes I use this implementation, >

struct.pack bug?

2007-02-08 Thread Jonathan Fine
Hello I find the following inconsistent: === >>> sys.version '2.4.1a0 (#2, Feb 9 2005, 12:50:04) \n[GCC 3.3.5 (Debian 1:3.3.5-8)]' >>> pack('>B', 256) '\x00' >>> pack('>> pack('B', 256) Traceback (most recent call last): File "", line 1, in ? struct.error: ubyte format requires 0<=number<=2

[ANN] MathTran project

2007-02-22 Thread Jonathan Fine
://www.jisc.ac.uk/whatwedo/programmes/elearning_framework/toolkit_mathtran.aspx -- Jonathan Fine The Open University, Milton Keynes, England -- http://mail.python.org/mailman/listinfo/python-list

Wanted: something more Pythonic than _winreg.

2008-10-10 Thread Jonathan Fine
Hello I'm using the _winreg module to change Windows registry settings, but its rather low level, and I'd prefer to be working with something more Pythonic. Does anyone have any recommendations? Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Generating test data from an XML Schema

2008-09-17 Thread Jonathan Fine
Hello I want to generate test data from an XML schema. I've had a quick look at existing tools (such as minixsv and amara) but from what I've seen they don't seem to help. It is of course easy to extract all the element names from a schema, but I want more than that. Motivation: I wish t

Re: Generating test data from an XML Schema

2008-09-17 Thread Jonathan Fine
Mark Thomas wrote: Has anyone seen anything that might help generate test data from a schema? I'm unaware of anything in Python, but Eclipse can generate sample documents from a schema: http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.wst.xmleditor.doc.user/topics/tcrexxsd.html As

FYI: ConfigParser, ordered options, PEP 372 and OrderedDict + big thank you

2009-11-17 Thread Jonathan Fine
Hi A big thanks to Armin Ronacher and Raymond Hettinger for PEP 372: Adding an ordered dictionary to collections I'm using ConfigParser and I just assumed that the options in a section were returned in the order they were given. In fact, I relied on this fact. http://docs.python.org/li

WANTED: Regular expressions for breaking TeX/LaTeX document into tokens

2010-02-24 Thread Jonathan Fine
Hi Does anyone know of a collection of regular expressions that will break a TeX/LaTeX document into tokens? Assume that there is no verbatim or other category code changes. Thanks Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: WANTED: Regular expressions for breaking TeX/LaTeX document into tokens

2010-02-26 Thread Jonathan Fine
Wes James wrote: On Wed, Feb 24, 2010 at 5:03 AM, Jonathan Fine wrote: Hi Does anyone know of a collection of regular expressions that will break a TeX/LaTeX document into tokens? Assume that there is no verbatim or other category code changes. I'm not sure how this does it, but it

WANTED: A good name for the pair (args, kwargs)

2010-03-04 Thread Jonathan Fine
Hi We can call a function fn using val = fn(*args, **kwargs) I'm looking for a good name for the pair (args, kwargs). Any suggestions? Here's my use case: def doit(fn , wibble, expect): args, kwargs = wibble actual = fn(*args, **kwargs) if actual != expect:

Re: WANTED: A good name for the pair (args, kwargs)

2010-03-05 Thread Jonathan Fine
Jonathan Fine wrote: Hi We can call a function fn using val = fn(*args, **kwargs) I'm looking for a good name for the pair (args, kwargs). Any suggestions? Here's my use case: def doit(fn , wibble, expect): args, kwargs = wibble actual = fn(*args, **kwargs)

Q: We have *args and **kwargs. Woud ***allargs be useful?

2010-04-01 Thread Jonathan Fine
The idioms def f(*args, **kwargs): # Do something. and args = (1, 2, 3) kwargs = dict(a=4, b=5) g(*args, **kwargs) are often useful in Python. I'm finding myself picking up /all/ the arguments and storing them for later use (as part of a testing framework). So for me it

Re: Q: We have *args and **kwargs. Woud ***allargs be useful?

2010-04-01 Thread Jonathan Fine
Jon Clements wrote: I'm not sure this'll catch on, it'll be interesting to see other comments. However, I believe you can get the behaviour you desire something like: import inspect class AllArgs(object): def __init__(self, func): self._func = func self._spec = inspect.geta

Wanted: Python solution for ordering dependencies

2010-04-24 Thread Jonathan Fine
Hi I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possible, I want to order them so that each item has its dependencies met before it is processed. I think I could get what I want by writing and running a suitable makefile, but t

Re: Wanted: Python solution for ordering dependencies

2010-04-25 Thread Jonathan Fine
Chris Rebert wrote: On Sat, Apr 24, 2010 at 1:53 PM, Jonathan Fine wrote: Hi I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possible, I want to order them so that each item has its dependencies met before it is processed

Re: Wanted: Python solution for ordering dependencies

2010-04-25 Thread Jonathan Fine
Aahz wrote: In article , Jonathan Fine wrote: I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possible, I want to order them so that each item has its dependencies met before it is processed. I think I could get what

Re: Wanted: Python solution for ordering dependencies

2010-04-25 Thread Jonathan Fine
Makoto Kuwata wrote: On Sun, Apr 25, 2010 at 5:53 AM, Jonathan Fine wrote: I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possible, I want to order them so that each item has its dependencies met before it is processed.

Re: Wanted: Python solution for ordering dependencies

2010-04-25 Thread Jonathan Fine
Eduardo Schettino wrote: On Sun, Apr 25, 2010 at 4:53 AM, Jonathan Fine wrote: Hi I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possible, I want to order them so that each item has its dependencies met before it is pro

Re: ANN: Oktest-0.2.2 - a new-style testing library

2010-04-25 Thread Jonathan Fine
Makoto Kuwata wrote: Hi, I released Oktest 0.2.2. http://packages.python.org/Oktest/ http://pypi.python.org/pypi/Oktest/ Overview Oktest is a new-style testing library for Python. :: from oktest import ok ok (x) > 0 # same as assert_(x > 0) ok (s) == 'foo

Re: Wanted: Python solution for ordering dependencies

2010-04-25 Thread Jonathan Fine
Eduardo Schettino wrote: On Sun, Apr 25, 2010 at 11:44 PM, Jonathan Fine wrote: Eduardo Schettino wrote: On Sun, Apr 25, 2010 at 4:53 AM, Jonathan Fine wrote: Hi I'm hoping to avoid reinventing a wheel (or other rolling device). I've got a number of dependencies and, if possib

Re: Is there any module/utility like 'rsync' in python

2010-06-15 Thread Jonathan Fine
hiral wrote: Hi, Is there any module/utility like 'rsync' in python. Thank you in advance. Not exactly what you asked for, but Mercurial provides a Python interface. You might find this URL a good starting point: http://mercurial.selenic.com/wiki/MercurialApi -- Jonathan -- http://mail

A new syntax for writing tests

2010-08-04 Thread Jonathan Fine
Hi I just discovered today a new syntax for writing tests. The basic idea is to write a function that contains some statements, and run it via a decorator. I wonder if anyone had seen this pattern before, and how you feel about it. For myself, I quite like it. Let's suppose we want to tes

Do anyone here use Python *embedded* in a database?

2009-08-05 Thread Jonathan Fine
Hi I'm writing a talk that compares embed and extend, and wondered if anyone here ever used the Python *embedded* in a database server. http://twistedmatrix.com/users/glyph/rant/extendit.html Web frameworks (such as Django) use extend, to import an extension module that makes a connection

Re: Do anyone here use Python *embedded* in a database?

2009-08-05 Thread Jonathan Fine
Jon Clements wrote: On 5 Aug, 13:17, Jonathan Fine wrote: Hi I'm writing a talk that compares embed and extend, and wondered if anyone here ever used the Python *embedded* in a database server. http://twistedmatrix.com/users/glyph/rant/extendit.html Web frameworks (such as Django

Using 'apply' as a decorator, to define constants

2009-08-21 Thread Jonathan Fine
Hi It might seem odd to use 'apply' as a decorator, but it can make sense. I want to write: # Top level in module. tags = where the list is most easily constructed using a function. And so I write: @apply def tags(): value = [] # complicated code return

Re: Using 'apply' as a decorator, to define constants

2009-08-21 Thread Jonathan Fine
alex23 wrote: Unfortunately, apply() has been removed as a built-in in 3.x. I'm not sure if it has been relocated to a module somewhere, there's no mention of such in the docs. The old use of apply() You can save yourself the tidy up by using the same name for the function & the label:

Re: Using 'apply' as a decorator, to define constants

2009-08-22 Thread Jonathan Fine
Jonathan Gardner wrote: On Aug 21, 9:09 am, alex23 wrote: On Aug 21, 11:36 pm, Jonathan Fine wrote: class ColourThing(object): @apply def rgb(): def fset(self, rgb): self.r, self.g, self.b = rgb def fget(self): return (self.r, self.g, self.b

Re: Using 'apply' as a decorator, to define constants

2009-08-22 Thread Jonathan Fine
Steven D'Aprano wrote: There's a standard idiom for that, using the property() built-in, for Python 2.6 or better. Here's an example including a getter, setter, deleter and doc string, with no namespace pollution, imports, or helper functions or deprecated built-ins: class ColourThing(obje

Re: Using 'apply' as a decorator, to define constants

2009-08-22 Thread Jonathan Fine
Steven D'Aprano wrote: On Sat, 22 Aug 2009 10:51:27 +0100, Jonathan Fine wrote: Steven D'Aprano wrote: There's a standard idiom for that, using the property() built-in, for Python 2.6 or better. Here's an example including a getter, setter, deleter and doc strin

Author of a Python Success Story Needs a Job!

2009-12-27 Thread Andrew Jonathan Fine
ner for new and completely original work, then for the love of God I implore you to contact me. A mind is a terrible thing to waste. Sincerely, Andrew Jonathan Fine BEE, MSCS, 15 years experience, 5 in Python, the rest in C/C++, about 1/3 embedded design and device drivers, and 2/3 in applica

Re: Author of a Python Success Story Needs a Job!

2009-12-28 Thread Andrew Jonathan Fine
On Dec 28, 6:21 am, Steve Holden wrote: > Andrew Jonathan Fine wrote: > > To whom it may concern, > > > I am the author of "Honeywell Avoids Documentation Costs with Python > > and other Open Standards!" > > > I was laid off by Honeywell several months