Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Alice BevanMcGregor
On 2016-04-18 21:14:02 +, Pete Forman said: Why is it that Python continues to use a fixed width font and therefore specifies the maximum line width as a character count? An essential part of the language is indentation which ought to continue to mandate that lines start with a multiple of

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-24 Thread Alice BevanMcGregor
On 2010-11-24 12:08:04 -0800, Raymond Hettinger said: I'm writing-up more guidance on how to use super() and would like to point at some real-world Python examples of cooperative multiple inheritance. The SocketServer module (http://docs.python.org/library/socketserver.html) uses cooperative

Re: building a web interface

2010-11-25 Thread Alice BevanMcGregor
Howdy! I'm mildly biased, being the author of the framework, but I can highly recommend WebCore for rapid prototyping of web applications; it has templating via numerous template engines, excellent JSON (AJAJ) support, and support for database back-ends via SQLAlchemy. It also has session su

Re: Processing file with lists.

2010-11-25 Thread Alice BevanMcGregor
You describe a two-part problem. The first, loading the data, is easily accomplished with the Python CSV module: http://docs.python.org/library/csv.html e.g.: reader = csv.reader(open('filename', 'rb'), delimiter=';', quotechar=None) In the above example, you can iterate over 'reade

Re: a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-25 Thread Alice BevanMcGregor
Accepting input from a human is frought with dangers and edge cases. ;) Some time ago I wrote a regular expression generator that creates regexen that can parse arbitrarily delimited text, supports quoting (to avoid accidentally separating two elements that should be treated as one), and work

Re: a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-25 Thread Alice BevanMcGregor
Now that I think about it, and can be stripped using a callback function as the 'normalize' argument to my KeywordProcessor class: def normalize(value): value = value.strip() if value.startswith("and"): value = value[3:] return value parser = KeywordProcessor(',', normalize=no

Re: do something every n seconds

2010-11-25 Thread Alice BevanMcGregor
how can I do something (e.g. check if new files are in the working directory) every n seconds in Python? The simplest method is executing time.sleep(n) within an infinite while loop. There are more elegant solutions: using coroutine frameworks, threaded task schedulers, etc. — Alice

Strategies for unit testing an HTTP server.

2010-11-29 Thread Alice BevanMcGregor
Hello! Two things are missing from the web server I've been developing before I can release 1.0: unit tests and documentation. Documentation being entirely my problem, I've run into a bit of a snag with unit testing; just how would you go about it? Specifically, I need to test things like H

Re: how to go on learning python

2010-11-30 Thread Alice BevanMcGregor
Howdy Xavier! [Apologies for the length of this; I didn't expect to write so much!] I've been a Python programmer for many years now (having come from a PHP, Perl, C, and Pascal background) and I'm constantly learning new idioms and ways of doing things that are more "Pythonic"; cleaner, more

Re: Comparison with False - something I don't understand

2010-12-02 Thread Alice BevanMcGregor
Howdy! When I run pychecker through my modules I get the message that comparisons with "False" is not necessary and that it might yield unexpected results. Comparisons against False -are- dangerous, demonstrated below. Yet in some situations I need to specifically check whether False was ret

Re: A web site using Python

2010-12-06 Thread Alice BevanMcGregor
1. Pick a web framework, I'd suggest looking at: Django (http://www.djangoproject.com/) Pyramid (http://docs.pylonshq.com/pyramid/dev/) I'm biased, but I can highly recommend WebCore (http://www.web-core.org/) as it more easily supports small to mid-sized applications and actively enco

Re: Python Average Salary Report

2010-12-25 Thread Alice BevanMcGregor
Howdy! I'm doing a market research report on the average hourly rates for Python/Django developers. Any input on this? I do understand that it does depend on the location, amount of experience and skills. I'd like to hear what are the hourly rates within your area :-) Thanks! I'm a strange c

Re: Design Ideals Goals Python 3 - Forest for the trees

2010-12-25 Thread Alice BevanMcGregor
I was interested in what the design goals/philosphy was of Python 3 from a birds eye view, forest for the trees approach. I think I can safely point to the Zen of Python[1] as many of the points therein directly apply to the simplifiation, clarification, and goals of Python 3. Most notably:

Re: Design Ideals Goals Python 3 - Forest for the trees

2010-12-26 Thread Alice BevanMcGregor
So do the new changes(to the GIL) nullify concerns raised by David Beazely here http://dabeaz.com/python/UnderstandingGIL.pdf Ah, good catch. I had watched the recorded presentation some time ago. Yes, the rewritten GIL should alleviate those problems. Instead of simply releasing and re-acqu

Re: Python3 Web Framework

2010-12-31 Thread Alice BevanMcGregor
On 2010-12-30 23:47:17 -0800, Aman said: Hey all... I just started with Python, and I chose Python3 because it seemed a subtle choice as compared to doing Pthon 2.x now and then porting to Python3.x later... I plan to start with Web Development soon... I wanted to know what all web frameworks

Re: Python3 Web Framework

2010-12-31 Thread Alice BevanMcGregor
On 2010-12-31 02:20:47 -0800, Terry Reedy said: I believe some will be improved or even solved in 3.2. Evidence to back this statement up would be appreciated. ;) - Alice. -- http://mail.python.org/mailman/listinfo/python-list

Re: Interrput a thread

2010-12-31 Thread Alice BevanMcGregor
On 2010-12-31 10:28:26 -0800, John Nagle said: Even worse, sending control-C to a multi-thread program is unreliable in CPython. See "http://blip.tv/file/2232410"; for why. It's painful. AFIK, that has been resolved in Python 3.2 with the introduction of an intelligent thread scheduler as p

Re: tempfile.NamedTemporaryFile use case?

2010-12-31 Thread Alice BevanMcGregor
I'm a bad person, but one use case I have is for shuffling templates around such that: * An inherited ('parent') template can be stored in a database. * The 'views' of my application are told to either use the real master template or the db parent template. * The rendering engine loads the par

Re: opinion: comp lang docs style

2011-01-04 Thread Alice BevanMcGregor
On 2011-01-04 22:29:31 -0800, Steven D'Aprano said: In any case, your assumption that any one documentation work should stand on its own merits is nonsense -- *nothing* stands alone. +1 How many RFCs still in use today don't start with: The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",

Re: Trying to decide between PHP and Python

2011-01-05 Thread Alice BevanMcGregor
On 2011-01-04 12:53:02 -0800, Alan Meyer said: I confess that I haven't used PHP so someone correct me if I'm wrong. [snip] +1 You're pretty much on the ball with your description. I might summarize it as: PHP (PHP: Hypertext Processor) is a templating language with a significant enough st

Streaming templating languages for use as WSGI body.

2011-01-05 Thread Alice BevanMcGregor
Howdy! I'm trying to find a templating engine whose templates can be consumed directly as a WSGI response body iterable. So far I haven't been very successful with Google; the engines I've found universally generate a monolithic rendered string. Bonus points for templating engines that supp

Re: Streaming templating languages for use as WSGI body.

2011-01-05 Thread Alice BevanMcGregor
Not sure if it's bad form to respond to your own posts, but here goes. ;) Coding up a quick hack of a templating engine, I've produced this: http://pastie.textmate.org/private/ws5jbeh1xyeaqtrhahevqw (The implementation of the engine itself is a base class that overrides __call__ and __getit

Re: Searching Python-list

2011-01-05 Thread Alice BevanMcGregor
On 2011-01-05 17:31:13 -0800, Slie said: I was wondering if anyone could tell me how to search through the Archives otter then manually looking through each month. Grab a Usenet news reader (such as Thunderbird or Unison), point it at: nntps://news.gmane.org/gmane.comp.python.general

Re: How suitable is Python to write system utilities?

2011-01-06 Thread Alice BevanMcGregor
On 2011-01-06 01:35:58 -0800, Rohit Coder said: Is Python suitable to write low-level system utilities like Defrag, Malware Removal Tools and Drivers? Yes and no. Python does include libraries (and has available third-party libraries) to interface with external low-level libraries of every k

Re: How suitable is Python to write system utilities?

2011-01-06 Thread Alice BevanMcGregor
On 2011-01-06 06:38:24 -0800, David Boddie said: Just out of interest, which module/package are you using to examine ELF files? http://pypi.python.org/pypi/elffile - Alice. -- http://mail.python.org/mailman/listinfo/python-list

Re: Streaming templating languages for use as WSGI body.

2011-01-06 Thread Alice BevanMcGregor
On 2011-01-06 10:00:39 -0800, Adam Tauno Williams said: With HTTP/1.0 [and WSGI is HTTP/1.0 only] you have to provide a Content-Length header - so you have to generate the entire response at once [however you want to muddy "at once"]. Both of these statements are false. Streaming responses t

Re: Can I have both Python 2.7 and Python 3.1 at the same time on the Mac?

2011-01-06 Thread Alice BevanMcGregor
On 2011-01-06 11:44:13 -0800, Bill Felton said: I've also seen various resources indicate that one can install both Python 2.7 and Python 3.1 -- but when I did this, I get no end of problems in the 2.7 install. I have Apple's native Python installations (2.5 and 2.6, I believe), plus Python 2

Re: Streaming templating languages for use as WSGI body.

2011-01-06 Thread Alice BevanMcGregor
On 2011-01-06 11:11:27 -0800, Adam Tauno Williams said: On Thu, 2011-01-06 at 11:07 -0800, Alice Bevan–McGregor wrote: On 2011-01-06 10:00:39 -0800, Adam Tauno Williams said: With HTTP/1.0 [and WSGI is HTTP/1.0 only] you have to provide a Content-Length header - so you have to generate the

Re: Streaming templating languages for use as WSGI body.

2011-01-07 Thread Alice BevanMcGregor
On 2011-01-07 07:17:33 -0800, Michael Ströder said: As I read section 7.2.2 (Length) the Content-length header is only required in HTTP *requests* if the body contains data. According to the text it's not required in HTTP *responses*. You are correct; I mis-read that section in my haste.

Re: apscheduler error

2011-01-07 Thread Alice BevanMcGregor
Howdy! On 2011-01-07 17:08:28 -0800, linna li said: I tried to use the apscheduler and used the sample code below from the tutorial, but got the error message: Exception in thread APScheduler (most likely raised during interpreter shutdown). What's going on here? I really appreciate any help!

Re: Python use growing fast

2011-01-10 Thread Alice BevanMcGregor
On 2011-01-10 13:02:09 -0800, MRAB said: On 10/01/2011 20:29, Dan Stromberg wrote: ...despite our wikipedia page whose first paragraph almost seems like it was written with the intention of scaring off new converts, with its "unusual" comment... Indentation as a syntatitical structure is not

Re: apscheduler error

2011-01-10 Thread Alice BevanMcGregor
On 2011-01-10 17:23:34 -0800, linna li said: I see the latest version is APScheduler 1.3.1. Where can I get APScheduler 2.0? https://bitbucket.org/agronholm/apscheduler/ I don't think 2.0 has been released yet, but that is the version number in apscheduler/__init__.py on HG tip. The example

Re: Ideas for a module to process command line arguments

2011-01-10 Thread Alice BevanMcGregor
On 2011-01-10 21:18:41 -0800, Sohail said: Hey, every body has their own favorite method/ways to process command line arguments. I've worked on a little CPython extension to handle command line arguments may be you'll find it interesting and useful Even I've implemented my own way to hand

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Alice BevanMcGregor
On 2011-01-11 00:32:32 -0800, Michele Simionato said: On Jan 11, 8:25 am, Alice Bevan–McGregor wrote: I got tired of using PasteScript and OptParse.  Mostly OptParse, actually.  :/ It's a pity that the argument parsing modules in the standard library are so verbose that everybo

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Alice BevanMcGregor
On 2011-01-11 00:32:32 -0800, Michele Simionato said: It's a pity that the argument parsing modules in the standard library are so verbose that everybody is reinventing the same thing :-( It looks like you have reinvented plac: http://pypi.python.org/pypi/plac After looking into it, Plac's def

Re: Ideas for a module to process command line arguments

2011-01-12 Thread Alice BevanMcGregor
On 2011-01-11 21:41:24 -0800, Michele Simionato said: Originally plac too was able to recognize flags automatically by looking at the default value (if the default value is a boolean then the option is a flag); however I removed that functionality because I wanted to be able to differentiate b

Re: Python use growing fast

2011-01-12 Thread Alice BevanMcGregor
On 2011-01-10 19:49:47 -0800, Roy Smith said: One of the surprising (to me, anyway) uses of JavaScript is as the scripting language for MongoDB (http://www.mongodb.org/). I just wish they'd drop spidermonkey and go with V8 or another, faster and more modern engine. :( - Alice. --

Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Alice BevanMcGregor
On 2011-01-15 08:15:25 -0800, Sherm Pendley said: "Captain Obvious" writes: XL> ... i recall, i stopped doing Mathematica in 1998 because it's a XL> career dead-end as a programing lang, and dived into the utterly XL> idiotic Perl & unix & mysql world. (See: The Unix Pestilence ◇ Xah XL> Lee'

Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Alice BevanMcGregor
On 2011-01-15 08:55:47 -0800, rantingrick said: On Jan 15, 10:38 am, Grant Edwards wrote: Yeah, James Cameron made a *ton* of money using it to make Avatar. Too bad he couldn't have used it to make a better movie. I found the graphics impressive; the "blue people" was merely an effort to

Re: __pycache__, one more good reason to stck with Python 2?

2011-01-17 Thread Alice BevanMcGregor
find . -name \*.pyc -exec rm -f {} \; vs. rm -rf __pycache__ I do not see how this is more difficult, but I may be missing something. — Alice. -- http://mail.python.org/mailman/listinfo/python-list

Re: __pycache__, one more good reason to stck with Python 2?

2011-01-19 Thread Alice BevanMcGregor
On 2011-01-19 13:01:04 -0800, Steven D'Aprano said: I know I've seen problems executing .pyc files from the shell in the past... perhaps I was conflating details of something else. Ah, I know! [steve@sylar ~]$ chmod u+x toto.pyc [steve@sylar ~]$ ./toto.pyc : command not found �� ./toto.pyc: lin

Re: how to read the last line of a huge file???

2011-01-27 Thread Alice BevanMcGregor
On 2011-01-26 02:59:26 -0800, Xavier Heruacles said: I have do some log processing which is usually huge. The length of each line is variable. How can I get the last line?? Don't tell me to use readlines or something like linecache... This is not optimum or efficient, but it works! If you wa

Re: Turbogears 2.1 with mako tmplates

2011-02-07 Thread Alice BevanMcGregor
On 2011-02-07 07:13:43 -0800, Vineet Deodhar said: For web-based solutions, I have started learning TG 2.1 By and large, the documentation on TG 2.1 official site is a work-in-process. As regards to the templates, it tells how to go about Genshi. I wish to go with mako. Gone through the docs of