Re: Everything is an object in python - object class and type class

2015-06-02 Thread Jon Ribbens
On 2015-06-02, BartC wrote: > On 02/06/2015 18:00, Steven D'Aprano wrote: >> Again, this is not relevant. Javascript is dynamically typed, but some >> values are machine primitives and other values are objects. The interpreter >> keeps track of this at runtime. > > Javascript primitives include Nu

Re: fork/exec & close file descriptors

2015-06-02 Thread Jon Ribbens
On 2015-06-02, Marko Rauhamaa wrote: > Skip Montanaro : > >> On Tue, Jun 2, 2015 at 10:28 AM, Marko Rauhamaa wrote: >>> >>> The only problem is that you don't know how high you need to go in >>> general. >> >> Sure, but I didn't know anyway, so no matter what upper bound I choose >> (or what func

Re: Fwd: Lossless bulletproof conversion to unicode (backslashing) (fwd)

2015-05-29 Thread Jon Ribbens
On 2015-05-29, Ian Kelly wrote: > On Fri, May 29, 2015 at 2:05 AM, anatoly techtonik > wrote: >> Added Mailman to my suxx tracker: >> https://github.com/techtonik/suxx-tracker#mailman > > What a useless tool. Instead of tiredly complaining that things suck, > why not take some initiative to make

Re: Decoding JSON file using python

2015-05-27 Thread Jon Ribbens
On 2015-05-27, Karthik Sharma wrote: > I tried modifying the program as follows as per your > suggestion.Doesn't seem to work. That's because you didn't modify the program as per their suggestion, you made completely different changes that bore no relation to what they said. > import cjson What

Re: Ah Python, you have spoiled me for all other languages

2015-05-23 Thread Jon Ribbens
On 2015-05-23, Michael Torrie wrote: > On 05/22/2015 10:10 PM, Ian Kelly wrote: >> There is still some value in TLS with a self-signed certificate in >> that at least the connection is encrypted and can't be eavesdropped >> by an attacker who can only read the channel, but there is no >> assuranc

Re: Best way to rewrite Popen

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Cecil Westerhof wrote: > It looks like that this does what I want (the dot is needed so that it > also works with 2.7): > files = sorted(os.listdir('.')) > p = re.compile('actions-2015-05-[0-9][0-9].sql$') > current_month = [ file for file in files if p.match(file) ] Yo

Re: Best way to rewrite Popen

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Cecil Westerhof wrote: > Op Tuesday 19 May 2015 19:36 CEST schreef Jon Ribbens: > >> On 2015-05-19, Cecil Westerhof wrote: >>> At the moment I am playing with things like: p = >>> subprocess.Popen('ls -l', shell = True, stdout = subproces

Re: subprocess.getstatusoutput does not exist in 2.7

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Cecil Westerhof wrote: > At the moment I want my code to run with 2.7 and 3.4+. > > But the command: > subprocess.getstatusoutput > does not exist in 2.7. Is this an oversight or is there a reason for > it? > > I can rewrite the code (back) to work with Popen again, but I found

Re: Best way to rewrite Popen

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Cecil Westerhof wrote: > At the moment I am playing with things like: > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > > I think that most of the times this are the values I want. So it would > be nice to overrule the defaults. What is the best way to do

Re: fork/exec & close file descriptors

2015-05-19 Thread Jon Ribbens
On 2015-05-19, Skip Montanaro wrote: > Yeah, I'm still on 2.7, and am aware of PEP 446. Note that many of the file > descriptors will not have been created by my Python code. They will have > been created by underlying C/C++ libraries, so I can't guarantee which > flags were set on file open. The

Re: Writing list of dictionaries to CSV

2015-05-06 Thread Jon Ribbens
On 2015-05-06, Denis McMahon wrote: > You need to format your CSV date into a date format that Excel > understands when it imports it. > > First thing to try would be to export some dates from excel as CSV and > see what format excel puts them in. Beware of assuming that Excel can import its ow

Re: Stripping unencodable characters from a string

2015-05-05 Thread Jon Ribbens
On 2015-05-05, Paul Moore wrote: > I want to write a string to an already-open file (sys.stdout, > typically). However, I *don't* want encoding errors, and the string > could be arbitrary Unicode (in theory). The best way I've found is > > data = data.encode(file.encoding, errors='replace').de

Re: Unicode surrogate pairs (Python 3.4)

2015-05-03 Thread Jon Ribbens
On 2015-05-03, MRAB wrote: > There's also a mistake in this bit: > > """ > # Note that according to the \u escaping convention, a supplemental > character (> 0x10) is represented > # by a sequence of two surrogate characters: the first between D800 and > DBFF, and the second between DC00

Re: Unicode surrogate pairs (Python 3.4)

2015-05-03 Thread Jon Ribbens
On 2015-05-03, Chris Angelico wrote: > On Mon, May 4, 2015 at 1:32 AM, Jon Ribbens > wrote: >> That would, unfortunately, be "tell the Unicode Consortium to format >> their documents differently", which seems unlikely to happen. I'm >> trying to read in: h

Re: Unicode surrogate pairs (Python 3.4)

2015-05-03 Thread Jon Ribbens
On 2015-05-03, MRAB wrote: > On 2015-05-03 16:32, Jon Ribbens wrote: >> That would, unfortunately, be "tell the Unicode Consortium to format >> their documents differently", which seems unlikely to happen. I'm >> trying to read in: http://www.unicode.org/Publ

Re: Unicode surrogate pairs (Python 3.4)

2015-05-03 Thread Jon Ribbens
On 2015-05-03, Chris Angelico wrote: > On Mon, May 4, 2015 at 12:40 AM, Jon Ribbens > wrote: >> If I have a string containing surrogate pairs like this in Python 3.4: >> >> "\udb40\udd9d" >> >> How do I convert it into the proper form: >> &g

Unicode surrogate pairs (Python 3.4)

2015-05-03 Thread Jon Ribbens
If I have a string containing surrogate pairs like this in Python 3.4: "\udb40\udd9d" How do I convert it into the proper form: "\U000E019D" ? The answer appears not to be "unicodedata.normalize". -- https://mail.python.org/mailman/listinfo/python-list

Re: l = range(int(1E9))

2015-05-02 Thread Jon Ribbens
On 2015-05-03, Terry Reedy wrote: > On 5/2/2015 8:01 PM, Jon Ribbens wrote: >> On 2015-05-02, Terry Reedy wrote: >>> On 5/2/2015 5:40 PM, Jon Ribbens wrote: >>>> For information, it looks like xrange() was added on 26 Oct 1993, >>>> which pre-dates Pyt

Re: l = range(int(1E9))

2015-05-02 Thread Jon Ribbens
On 2015-05-02, BartC wrote: > On 02/05/2015 22:40, Jon Ribbens wrote: >> I think the issue is that nobody else here thinks the "original way" >> of iterating was to use range(), for anything other than extremely >> small ranges. > > What /is/ the way to ite

Re: l = range(int(1E9))

2015-05-02 Thread Jon Ribbens
On 2015-05-02, Terry Reedy wrote: > On 5/2/2015 5:40 PM, Jon Ribbens wrote: >> For information, it looks like xrange() was added on 26 Oct 1993, >> which pre-dates Python 1.0. > > 1.0 was released Feb 1991. 3.2 exactly 20 years later. No, you are thinking of 0.9, which was

Re: l = range(int(1E9))

2015-05-02 Thread Jon Ribbens
On 2015-05-02, BartC wrote: > So do I, I think, if no-one is willing to admit that the original way of > implementing range() was a glaring mistake. I think the issue is that nobody else here thinks the "original way" of iterating was to use range(), for anything other than extremely small range

Re: Is my implementation of happy number OK

2015-05-02 Thread Jon Ribbens
On 2015-05-01, Peter Otten <__pete...@web.de> wrote: > A computer that cannot calculate a lookup table with all 3-digit cases > should be almost as hard to find as the one needed by Jon ;) ... or anyone else writing code to return the set of happy numbers. -- https://mail.python.org/mailman/list

Re: Is my implementation of happy number OK

2015-05-01 Thread Jon Ribbens
On 2015-04-30, Dave Angel wrote: > On 04/30/2015 07:31 PM, Jon Ribbens wrote: >> On 2015-04-30, Dave Angel wrote: >>> But the real reason I didn't like it was it produced a much larger >>> set of happy_numbers, which could clog memory a lot sooner. For >>&

Re: Is my implementation of happy number OK

2015-04-30 Thread Jon Ribbens
On 2015-04-30, Dave Angel wrote: > Finally, I did some testing on Jon Ribben's version. His was > substantially faster for smaller sets, and about the same for 10*7. So > it's likely it'll be slower than yours and mine for 10**8. You know what they say about assumptions. Actually, my version

Re: Is my implementation of happy number OK

2015-04-30 Thread Jon Ribbens
On 2015-04-30, Cecil Westerhof wrote: > Besides it need some documentation: is it a good implementation? Or > are there things I should do differently? Here's an alternative implementation which is a bit neater: def find_happy(maximum): """Return set of happy numbers between 1 and `m

Re: l = range(int(1E9))

2015-04-30 Thread Jon Ribbens
On 2015-04-30, Cecil Westerhof wrote: > If I execute: > l = range(int(1E9) > > The python process gobbles up all the memory and is killed. The > problem is that after this my swap is completely used, because other > processes have swapped to it. This make those programs more slowly. Is > there

Re: Huh? No way to markup announcements here?

2015-04-18 Thread Jon Ribbens
On 2015-04-18, edream...@gmail.com wrote: > Many google groups support markdown or other markup. > > I see no mention of markup here: > https://www.python.org/community/clpya-guidelines.txt/ > > Is there any way to format announcements? If so, how. If not, why not? Because this is not a "google

Re: New to Python - block grouping (spaces)

2015-04-16 Thread Jon Ribbens
On 2015-04-16, Blake McBride wrote: > 2. Having been an employer, it is difficult to force programmers to > use any particular editor or style. Different editors handle tabs > and spaces differently. This is all a bloody nightmare with Python. > > 3. Languages that use braces (or the like) can

Re: Python 3 lack of support for fcgi/wsgi.

2015-03-29 Thread Jon Ribbens
On 2015-03-29, John Nagle wrote: > The Python 2 module "fcgi" is gone in Python 3. > The Python 3 documentation at > > https://docs.python.org/3/howto/webservers.html > > recommends "flup" and links here: > > https://pypi.python.org/pypi/flup/1.0 > > That hasn't been updated since 2007, and the SV

Re: Python Worst Practices

2015-03-03 Thread Jon Ribbens
On 2015-03-03, Steven D'Aprano wrote: > Jon Ribbens wrote: >> On 2015-03-02, Dennis Lee Bieber wrote: >>> A pub's a bar; a bar's a gate; a gate's a street >> >> If each of those is supposed to be English first and then the American >

Re: Python Worst Practices

2015-03-03 Thread Jon Ribbens
On 2015-03-03, Dennis Lee Bieber wrote: > On Mon, 2 Mar 2015 17:12:24 + (UTC), Jon Ribbens > declaimed the following: >>On 2015-03-02, Dennis Lee Bieber wrote: >>> A pub's a bar; a bar's a gate; a gate's a street >> >>If each of those is su

Re: Python Worst Practices

2015-03-02 Thread Jon Ribbens
On 2015-03-02, sohcahto...@gmail.com wrote: > On Monday, March 2, 2015 at 9:13:21 AM UTC-8, Jon Ribbens wrote: >> On 2015-03-02, Dennis Lee Bieber wrote: >> >A pub's a bar; a bar's a gate; a gate's a street >> >> If each of those is suppo

Re: Python Worst Practices

2015-03-02 Thread Jon Ribbens
On 2015-03-02, Dennis Lee Bieber wrote: > A pub's a bar; a bar's a gate; a gate's a street If each of those is supposed to be English first and then the American equivalent second, then I'm afraid the first one is misleading and the other two are just nonsense. -- https://mail.python.org/m

Re: Python is DOOMED! Again!

2015-01-22 Thread Jon Ribbens
On 2015-01-22, Steven D'Aprano wrote: > You can't use "raise" as a parameter name, since that's a keyword. Using > floats for money is Just Wrong and anyone who does so should have their > licence to program taken away. And I really don't understand what this > function is supposed to do, that it

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Jon Ribbens
On 2014-11-23, Roy Smith wrote: > In article , > Skip Montanaro wrote: >> > But it breaks all the picture that I've built in my head about comps till >> > now... >> >> Note that list comprehensions are little more than syntactic sugar for for >> loops. If you're having terrible writing or under

Re: Lazy-evaluation lists/dictionaries

2014-10-27 Thread Jon Ribbens
On 2014-10-26, Tim Delaney wrote: > On 27 October 2014 01:14, Jon Ribbens wrote: >> I have a need, in a Python C extension I am writing, for lists and >> dictionaries with "lazy evaluation" - by which I mean that at least >> some of the values in the lists/

Re: Lazy-evaluation lists/dictionaries

2014-10-27 Thread Jon Ribbens
On 2014-10-26, Terry Reedy wrote: > On 10/26/2014 10:14 AM, Jon Ribbens wrote: >> Is there any better way to do this other than simply re-implementing >> these types from scratch, emulating all their methods and operations? >> (i.e. using UserList/UserDict). I was under the

Lazy-evaluation lists/dictionaries

2014-10-26 Thread Jon Ribbens
I have a need, in a Python C extension I am writing, for lists and dictionaries with "lazy evaluation" - by which I mean that at least some of the values in the lists/dictionaries are "proxy objects" which, rather than returning as themselves, should return the thing they are a proxy for when retri

Re: Flask and Python 3

2014-09-23 Thread Jon Ribbens
On 2014-09-23, Juan Christian wrote: > if __name__ == '__main__': > app.run(port = 8000) app.run(port=8000, debug=True) might've made the problem easier to find. -- https://mail.python.org/mailman/listinfo/python-list

Re: Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Jon Ribbens
On 2014-08-26, Terry Reedy wrote: > On 8/26/2014 12:03 PM, Jon Ribbens wrote: >> Flask suggests the following file layout: >> >> runflaskapp.py >> flaskapp/ >> __init__.py >> >> runflaskapp.py contains: >> >>

Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Jon Ribbens
Flask suggests the following file layout: runflaskapp.py flaskapp/ __init__.py runflaskapp.py contains: from flaskapp import app app.run(debug=True) flaskapp/__init__.py contains: from flask import Flask app = Flask(__name__) Running this with 'python3 runflask

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Jon Ribbens
On 2008-05-01, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > I used XML files before for this purpose and found YAML much easier and > better suitable for the task. > > Please explain why don't like YANL so much? Because even the examples in the spec itself are unreadable gibberish. The PyYAML lib

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Jon Ribbens
On 2008-05-01, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > IMO .ini-like config files are from the stone age. The modern approach is > to use YAML (http://www.yaml.org). You mean YAML isn't a joke!? It's so ludicrously overcomplicated, and so comprehensively and completely fails to achieve its

Re: Why can't timedeltas be divided?

2008-04-27 Thread Jon Ribbens
On 2008-04-27, webograph <[EMAIL PROTECTED]> wrote: > On 2008-04-27 14:18, Jon Ribbens wrote: >> Yes, that's where it was decided that the datetime module was fine >> that way it is and must not be changed. > could you give me some pointers to that discussion?

Re: Why can't timedeltas be divided?

2008-04-27 Thread Jon Ribbens
On 2008-04-27, Martin v. Löwis <[EMAIL PROTECTED]> wrote: >> Last time I brought up this sort of thing, it seemed fairly unanimous >> that the shortcomings of the datetime module were 'deliberate' and >> would not be fixed, patch or no patch. > > Ok, so then if the answer to my question is "yes", t

Re: Why can't timedeltas be divided?

2008-04-26 Thread Jon Ribbens
On 2008-04-27, Martin v. Löwis <[EMAIL PROTECTED]> wrote: >> sorry for bringing up such an old thread, but this seems important to me >> -- up to now, there are thousands [1] of python programs that use >> hardcoded time calculations. > > Would you like to work on a patch? Last time I brought up

Re: Why is None <= 0

2008-04-25 Thread Jon Ribbens
On 2008-04-25, Martin v. Löwis <[EMAIL PROTECTED]> wrote: > None is smaller than anything. According to Tim Peters, this is not true. See http://bugs.python.org/issue1673405 -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting expirty data on a cookie

2008-04-25 Thread Jon Ribbens
On 2008-04-25, David <[EMAIL PROTECTED]> wrote: > Another note: 'expires' is apprantly a legacy attribute for early > Netscape browsers. The RFC and python source comments suggest that you > use 'Max-Age' instead. Theoretically, yes. In practice, no. *Nobody* uses the new-style cookies, everyone u

Re: Python Success stories

2008-04-23 Thread Jon Ribbens
On 2008-04-23, Mark Wooding <[EMAIL PROTECTED]> wrote: > Python is actually one of the few to define one but not the other. (The > other one I can think of is Acorn's BBC BASIC, for whatever that's > worth; it too lacks `++'.) You should've added it in Termite Basic then :-p -- http://mail.python

Re: Finally had to plonk google gorups.

2008-04-16 Thread Jon Ribbens
On 2008-04-16, Grant Edwards <[EMAIL PROTECTED]> wrote: > But that's not a battle you can win, so I broke down and joined all > the other people that just killfile everything posted via google.groups. I did the same about an hour ago. -- http://mail.python.org/mailman/listinfo/python-list

Re: Regarding coding style

2008-03-07 Thread Jon Ribbens
On 2008-03-07, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: >> 2. You should use two spaces after a sentence-ending period. >> >> For heavens sake, why? I've always been obstructed by the double >> blanks but tolerated them. Now, that i read that it actually is a >> recommendation, i need to ask ab

Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Christian Heimes <[EMAIL PROTECTED]> wrote: > Jon Ribbens wrote: >> Why? I don't think you do. >> Neither does BSD daemon.c or glibc daemon.c > > The problem is well documented at > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012

Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Rolf van de Krol <[EMAIL PROTECTED]> wrote: > To create a deamon, you indeed need to fork two times. For more > information and a working example see: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731 . I'm > quite sure this works, because I used it several times to

Re: Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Bernard <[EMAIL PROTECTED]> wrote: > #Fork and commit suicide > if os.fork(): > sys.exit(0) I'm pretty sure that should be os._exit(0) > #What to do in parent process This is now the child process. > sys.stdin =

Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Christian Heimes <[EMAIL PROTECTED]> wrote: >> Although bear in mind it's pretty UNIX-y. > > IIRC you have to fork a second time after you have changed the working > dir and created a new session group. Why? I don't think you do. Neither does BSD daemon.c or glibc daemon.c -- http:

Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Gilles Ganault <[EMAIL PROTECTED]> wrote: > I need to launch a Python script, and fork it so that the calling > script can resume with the next step will the Python script keeps > running. > > I tried those two, but they don't work, as the calling script is stuck > until the Py

Re: Best way to protect my new commercial software.

2007-12-18 Thread Jon Ribbens
On 2007-12-18, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-12-18, Jan Claeys <[EMAIL PROTECTED]> wrote: >> No, it's only copyrighted when you _publish_ it. > > Interesting. So, in Europe, if somebody steals something you > wrote before you get it published, they're free to do with it > as t

Re: count pages in a pdf

2007-11-27 Thread Jon Ribbens
On 2007-11-27, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > is it possible to parse a pdf file in python? for starters, i would > like to count the number of pages in a pdf file. i see there is a > project called ReportLab, but it seems to be a pdf generator... i > can't tell if i would be able

Re: Iteration for Factorials

2007-10-23 Thread Jon Ribbens
On 2007-10-23, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > Yuk. Reminds me of one of the Hitachi processors that > has a single depth hardware "link register" that tells a > subroutine where it was called from. That's how ARM processors work, and they're everywhere these days. -- http://mai

Re: smtp debugging methods

2007-09-14 Thread Jon Ribbens
On 2007-09-14, Sean Nakasone <[EMAIL PROTECTED]> wrote: > I'm having trouble with sending smtp mail. It's hanging after the > smtplib.SMTP() line. It doesn't works from home but not from work. What's > the best way to debug this? > > # Here's the error server = smtplib.SMTP("smtp.gmail.com

Re: list index()

2007-08-31 Thread Jon Ribbens
On 2007-08-31, Erik Max Francis <[EMAIL PROTECTED]> wrote: >> I say the 'oll' in troll like the 'ol' in frolic, and pronounce roll >> and role similarly. >> >> My accent is probably from the East Midlands of the UK, but is not >> pronounced. > > _Troll_ and _frolic_ aren't pronounced with the same

Re: Why PHP is so much more popular for web-development

2007-07-27 Thread Jon Ribbens
On 2007-07-26, Steve Holden <[EMAIL PROTECTED]> wrote: >> That sounds trivial to ameliorate (at least somewhat) by putting your >> uploads in a directory whose name is known only to you (let's say it's >> a random 20-letter string). The parent directory can be protected to >> not allow reading the

Re: 16bit hash

2007-06-27 Thread Jon Ribbens
On 2007-06-27, Robin Becker <[EMAIL PROTECTED]> wrote: > Is the any way to get an efficient 16bit hash in python? int(md5.new(s).hexdigest()[:4], 16) ? -- http://mail.python.org/mailman/listinfo/python-list

Re: File writing success

2007-05-11 Thread Jon Ribbens
On 2007-05-11, HMS Surprise <[EMAIL PROTECTED]> wrote: > If file writing has no return value (http://docs.python.org/lib/bltin- > file-objects.html), how do you know if the write was successful? Because no exception was thrown? Although bear in mind that some errors might not become apparent unti

Re: I need a string/list/generator/comprehension incantation.

2007-04-20 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Steven W. Orr wrote: > Now I want something that's going to give me a string whose value is the > set of all of the first letters of months. Order is not important. "".join(set(m[0] for m in calendar.month_abbr[1:])) > And for extra credit, I need the string whose

Re: #!/usr/bin/env python > 2.4?

2007-03-23 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Gabriel Genellina wrote: > Uh... I never thought it was an implied formula there - that F0 had to > come from 1.5 = 15 = 0xF. > I think it should be stated much more clearly. I'm not sure what you're saying. You are correct that the documentation is rather vague.

Re: #!/usr/bin/env python > 2.4?

2007-03-22 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > I don't see any problem with:: > > if version_info[0] <= 2 and version_info[1] < 4: > raise RuntimeError() What if the version number is 1.5? -- http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/env python > 2.4?

2007-03-21 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Sion Arrowsmith wrote: > Jon Ribbens <[EMAIL PROTECTED]> wrote: >> if sys.hexversion < 0x020400f0: >>... error ... > > "Readability counts." > > if sys.version_info < (2, 4): > ... error ... Ma

Re: #!/usr/bin/env python > 2.4?

2007-03-21 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Stargaming wrote: > from sys import version_info > if version_info[0] < 2 or version_info[1] < 4: > raise RuntimeError("You need at least python2.4 to run this script") That'll fail when the major version number is increased (i.e. Python 3.0). You want: if

Re: Watching a file another app is writing

2007-03-12 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: >> On Unix a quick shortcut would be to simply read the output of 'tail - >> f ' command... > > "tail -f" just checks the file size once a second. It's not doing > anything exciting. That's not actually always true these days. *BSD, at least,

Re: Database module & multithreading

2007-03-11 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Gabriel Genellina wrote: I don't know, but stock Python 2.5 seems to stick mysterious '.egg' files in the site-packages directory when you install things. >>> >>> Which "stock" Python? Not the one from www.python.org... >> >> Yes, the one from www.python.or

Re: Database module & multithreading

2007-03-11 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Gabriel Genellina wrote: >> I don't know, but stock Python 2.5 seems to stick mysterious '.egg' >> files in the site-packages directory when you install things. > > Which "stock" Python? Not the one from www.python.org... Yes, the one from www.python.org. -- http:

Re: Database module & multithreading

2007-03-10 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: > Is the "egg" packaging gimmick considered mainstream Python, or just some > wierd idea from the "Peak" people? It seems to complicate installation > without adding much value. I don't know, but stock Python 2.5 seems to stick mysterious '.eg

Re: Database module & multithreading

2007-03-10 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: > As for "some modules not being maintained", it really is sad > that MySQLdb is kind of behind. If you're running Windows and need > MySQL, you're either stuck with Python 2.4 Looks like that's changed: http://sourceforge.net/project/showfi

Re: Recommended FastCGI module?

2007-03-07 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: > Jon Ribbens wrote: >>> The "JonPy" version: >>> http://jonpy.sourceforge.net/fcgi.html >>> Last revised in 2004. >> >> I'd recommend my one, but it's just possi

Re: Recommended FastCGI module?

2007-03-07 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: > The "JonPy" version: > http://jonpy.sourceforge.net/fcgi.html > Last revised in 2004. I'd recommend my one, but it's just possible I'm not impartial ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple content-types break cgi.py

2007-03-04 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Janto Dreijer wrote: >> It's not a bug - sending multiple content-types is just totally broken. >> What would such a header even be supposed to mean? It's like saying >> "this is an apple orange". > > Hmmm. Thanks! I suspected as much. > > Rough inspection suggests

Re: multiple content-types break cgi.py

2007-03-04 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Janto Dreijer wrote: > The Nokia Java SDK allows one to define multiple content-types in a > single HTTP header field. I'm not sure if it's standard, but it's > happening from some Java-enabled phones. > > The only reference to this "bug" I can find dates back to 19

Re: Checking for EOF in stream

2007-02-19 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Gabriel Genellina wrote: > So this is the way to check for EOF. If you don't like how it was spelled, > try this: > >if data=="": break How about: if not data: break ? ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Raw strings and escaping

2006-10-03 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Duncan Booth wrote: >> I presume there was originally some reason for this bizarre behaviour >> - it'd be interesting to know what it is/was, if anyone knows? >> > See the FAQ for the explanation: > > http://www.python.org/doc/faq/general/#why-can-t-raw-strings-r-s

Re: Raw strings and escaping

2006-10-03 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Matthew Warren wrote: > I would expect this to work, > > rawstring=r'some things\new things\some other things\' > > But it fails as the last backslash escapes the single quote. String constants in Python are weird - raw strings doubly so. In a raw string, backslas

Re: CGI -> mod_python

2006-10-03 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Paul Boddie wrote: >> it is a kind of nooby question. Is there a way to transfer a CGI python >> script to mod_python without rewriting the code? > > Had you used WebStack [1] to begin with, this migration would involve > changing a few lines of glue code. Or Jonpy

Re: Computer Language Popularity Trend

2006-09-27 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: >> http://xahlee.org/lang_traf/index.html > > Careful there with the sweeping generalizations and quick judgments > about languages :) I just read "PHP as a language is rather dry and business-like", and fell off my chair. -- http://mail.p

Re: A critique of cgi.escape

2006-09-27 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Gabriel G wrote: > By example, I do not validate a "page". I validate that all methods > that make up pieces of a page, build them the way they should - these > are our "unit tests". Then, it's up to the templating library to join > all the pieces into the final h

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Brian Quinlan wrote: > If, in the example that I showed, the less-than character was not > correctly escaped, then it might not manifest itself frequently in a > typical application because the less-than character is seldom used in > English prose. OK, but effect

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Brian Quinlan wrote: > Well, there are dozens (hundreds?) of templating systems for Python. I know, I wrote one of them ;-) > t = Template("test.html") > t['foo'] = 'Brian -> "Hi!"' > assert str(t) == 'Brian -> "Hi"' > > So how would you test our template system?

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Brian Quinlan wrote: >> Your summary seems pretty reasonable, but please note that later on, >> the thread was not about cgi.escape escaping (or not) quote >> characters (as described in your summary), but about Fredrik arguing, >> somewhat incoherently, that it shou

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > I know the answer. I'm pretty sure everyone else who's actually > read my posts to this thread might have figured it out by now, too. > But since you're still trying to "win" the debate, long after it's > over, I think it's safest to end this

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Brian Quinlan wrote: > A summary of this pointless argument: Your summary seems pretty reasonable, but please note that later on, the thread was not about cgi.escape escaping (or not) quote characters (as described in your summary), but about Fredrik arguing, somewh

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: >> What do XML Information Sets have to do with escaping control >> characters in HTML? > > figure out the connection, and you'll have the answer to your "substantial > point". If you don't know the answer, you can say so y'know. There's no sha

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: >> This has nothing to do with character encodings. > > it has *everything* to do with encoding of existing data into HTML > so it can be safely transported to, and recreated by, an HTML-aware > client. I can't tell if you're disagreeing or not

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: >>> the same documentation tells people what function to use if they >>> want to quote *every-thing* that might need to be quoted, so if >>> people did actually understand everything that was written in a >>> reasonably clear way, this thread wou

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > Jon Ribbens wrote: > >>> does the word "information set" mean anything to you? >> >> You would appear to be talking about either game theory, or XML, >> neither of which have anything to do w

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: >> It's a pity he's being rude when presented with well-informed comment >> then. > > since when is the output of > [snip code] > > well-informed? heck, it doesn't even pass the turing test ;-) Since when did that bear any resemblance to wha

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Steve Holden wrote: >> Why do you say that? I have confined myself to simple logical >> arguments, and been frankly very restrained when presented with >> rudeness and misunderstanding from other thread participants. >> In what way should I have modified my postings?

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > the same documentation tells people what function to use if they > want to quote *every-thing* that might need to be quoted, so if > people did actually understand everything that was written in a > reasonably clear way, this thread wouldn't ev

Re: A critique of cgi.escape

2006-09-26 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Steve Holden wrote: >> I would have hoped that people don't treat that as a licence to be >> obnoxious, though. I am aware of Fredrik's history, which is why I >> was somewhat surprised and disappointed that he was being so rude >> and unpleasant in this thread. He i

Re: QuoteSQL

2006-09-25 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Lawrence D'Oliveiro wrote: > You're proposing two separate functions: > > 1) quoting of non-wildcard specials > 2) quoting of wildcard specials Lawrence, you're wrong in this thread for the same reason you were right in the cgi.escape thread. Escaping gener

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Georg Brandl wrote: >> Here's a point for you - the documentation for cgi.escape says that >> the characters "&", "<" and ">" are converted, but not what they are >> converted to. > > It says "to HTML-safe sequences". That's reasonably clear without the need > to re

Re: A critique of cgi.escape

2006-09-25 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Brian Quinlan wrote: >> Now you're just being ridiculous. In this thread you have been rude, >> evasive, insulting, vague, hypocritical, and have failed to answer >> substantive points in favour of sarcastic and erroneous sniping - I'd >> suggest it's you that needs

<    1   2   3   4   5   6   7   >