[Edu-sig] End of 2010... Happy \N

kirby urner kirby.urner at gmail.com
Fri Dec 31 22:58:26 CET 2010


Code Blit:

The string module has translate and maketrans, through multiple versions.
 In per 3.x,
an optional argument listed "letters to delete".

The first argument was a kind of mapping, of 256 symbols to itself, except
with some
letters changed, what we would call a "permutation" in group theory (not
promising
a bijectional one-to-one mapping, no way, more likely surjective, do we
agree?).

http://www.youtube.com/watch?v=xKNX8BUWR0g

Here we are in 2.6, where the bytes type is not yet operative.

IDLE 2.6.5
>>> b'a'
'a'
>>> type(b'a')
<type 'str'>

Now let's replay that action in 3.1:

>>> b'a'
b'a'
>>> type(b'a')
<class 'bytes'>

Here's my idea of a punctuation filter in 3.x, where the delete characters
clause
is now a delete bytes clause in the byte type superobject.

import string
def filterpunc(thestr):
    return thestr.encode('utf-8').translate(bytes.maketrans(b'',b''),
string.punctuation.encode('utf-8')).decode('utf-8')

See:
http://diveintopython3.org/strings.html
http://www.devx.com/opensource/Article/42659/1763
if curious.

This'd be used to strip string.punctuation characters out of any string.
 Other solutions possible, including with regexps.

Suggestions for Features (SFFs -- not as prestigious or important as PEPs
but sometimes the genetic precursor of a PEP).

Save Session in IDLE or other PyShell:

This is probably already out there, in IPython or one of those.  It's
so cool to be able to interactively bind names to working code in
memory, but when you resume your session later, all that has
gone away.  In some other shell environments, you have the
option to hibernate and resume, Smalltalk's being the most famous.

Would it come with a source code snapshot version that encapsulates
all the definitions as runnable code?  The latest version of f, all
the latest object values?  That's another way to "pickle", to just
write out a module that recreates what was there, when run.

Python in Mathland:

A link to a recent summary that mentions Python quite a bit:
http://groups.google.com/group/mathfuture/browse_thread/thread/3d642708c2f2a80?hl=en

Kirby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20101231/053419ce/attachment.html>


More information about the Edu-sig mailing list