Re: Turkic I and re

2011-09-15 Thread Alan Plum

On 2011-09-15 15:02, MRAB wrote:

The regex module at http://pypi.python.org/pypi/regex currently uses a
compromise, where it matches 'I' with 'i' and also 'I' with 'ı' and 'İ'
with 'i'.

I was wondering if it would be preferable to have a TURKIC flag instead
("(?T)" or "(?T:...)" in the pattern).


I think the problem many people ignore when coming up with solutions 
like this is that while this behaviour is pretty much unique for Turkish 
script, there is no guarantee that Turkish substrings won't appear in 
other language strings (or vice versa).


For example, foreign names in Turkish are often given as spelled in 
their native (non-Turkish) script variants. Likewise, Turkish names in 
other languages are often given as spelled in Turkish.


The Turkish 'I' is a peculiarity that will probably haunt us programmers 
until hell freezes over. Unless Turkey abandons its traditional 
orthography or people start speaking only a single language at a time 
(including names), there's no easy way to deal with this.


In other words: the only way to make use of your proposed flag is if you 
have a fully language-tagged input (e.g. an XML document making 
extensive use of xml:lang) and only ever apply regular expressions to 
substrings containing one culture at a time.

--
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-15 Thread Alan Plum

On 2011-09-11 02:50, Littlefield, Tyler wrote:
I replied to that one off list I guess, but I figured Django was way 
more overhead than I wanted, doesn't really fit with solving the speed 
issue.


Depending on your needs, you may find something like bottle or Flask a 
better choice then.


Django can be scaled down a lot, but it's a full-featured framework at 
its heart. Bottle is pretty minimal (IIRC it doesn't even come with any 
templating). Flask is somewhere in between as it bundles Werkzeug (a 
pure WSGI framework) with Jinja (a template library) with some glue code.


I have used Flask in the past but often found myself implementing half 
of Django anyway, which is why I eventually switched. When I only need a 
bare API with no database and without templates, I usually go for Bottle 
these days.


If you feel like coding closer to the metal and care more about 
performance than readability, you might also find Twisted useful.

--
http://mail.python.org/mailman/listinfo/python-list