[ANN] git JSONRPC web service and matching pyjamas front-end

2010-06-30 Thread Luke Kenneth Casson Leighton
as more than just a proof-of-concept but to get pyjamas out of looking like a nice toy, doesn't do much, great demos, shame about real life, i've created yet another git repository browser. this one, thanks to pyjamas, obviously runs as both a desktop application and also as a web application -

RE: Python profiler usage with objects

2010-06-30 Thread Ben Kaplan
-Original Message- From: python-list-bounces+bsk16=case@python.org [mailto:python-list- bounces+bsk16=case@python.org] On Behalf Of rik Sent: Tuesday, June 29, 2010 10:52 PM To: python-list@python.org Subject: Re: Python profiler usage with objects harit harit.himanshu

Re: Python profiler usage with objects

2010-06-30 Thread rik
Ben Kaplan bsk16 at case.edu writes: Let's take this code as an example: def foo() : return None import profile profile.run(foo()) What does the profile.run call do? First thin it does is evaluate foo(), which returns None. So you're calling profile.run(None) There's

Re: Python profiler usage with objects

2010-06-30 Thread rik
Ben Kaplan bsk16 at case.edu writes: First thin it does is evaluate foo(), which returns None. So you're calling profile.run(None) There's nothing special about profile.run- you have to hand it something to execute, not something already executed. Try calling Profile.run(doSomething) # no

Re: Python profiler usage with objects

2010-06-30 Thread Rami Chowdhury
On 2010-06-30 06:39, rik wrote: Ben Kaplan bsk16 at case.edu writes: Let's take this code as an example: def foo() : return None import profile profile.run(foo()) What does the profile.run call do? First thin it does is evaluate foo(), which returns None. So

Re: Python profiler usage with objects

2010-06-30 Thread rik
Ben Kaplan bsk16 at case.edu writes: There's nothing special about profile.run- you have to hand it something to execute, not something already executed. Try calling Profile.run(doSomething) # no parenthesis for doSomething. your hint and REREADING THE DOCUMENTATION made me realize it was

Re: A question about the posibility of raise-yield in Python

2010-06-30 Thread Дамјан Георгиевски
I'm writing this as a complete newbie (on the issue), so don't be surprised if it's the stupidest idea ever. I was wondering if there was ever a discusision in the python community on a 'raise-yield' kind-of combined expression. I'd like to know if it was

Re: Find slope of function given empirical data.

2010-06-30 Thread Peter Otten
Thomas wrote: Trying to find slope of function using numpy. Getting close, but results are a bit off. Hope someone out here can help. You don't make it easy to understand your post. In the future please try to rely more on plain english than on lots of numbers and code that doesn't run.

Re: PDF Generation With Reportlab

2010-06-30 Thread Tim Roberts
Albert Leibbrandt albe...@compuscan.co.ug wrote: I am hoping there is someone out there that knows reportlab quite well. I posted this on the reportlab mailing list but there is not much activity on that list Never the less, that is the correct forum for this question. The ReportLab mailing

Re: [python] how to ensure item in list or dict bind with an uuid meaning integer type ID?

2010-06-30 Thread Tim Roberts
kee chen keekychen.sha...@gmail.com wrote: I have 2 lists stored in 2 text files may have duplicated records, the raw data looks like this: lfruit lcountry == = orange japan pear

pyc runtime error

2010-06-30 Thread Baris CUHADAR
Can anyone explain this unexpected behavior? all files chmod 755, i've compiled x.py with py_compilefiles, also tried within python console with import x system: centos 5.4 32bit This a PATH related problem i think? [r...@centos-14 cgi-bin]# ./x.pyc : command not found ./x.pyc: line 2: syntax

Re: pyc runtime error

2010-06-30 Thread Chris Rebert
On Wed, Jun 30, 2010 at 1:06 AM, Baris CUHADAR 189...@gmail.com wrote: Can anyone explain this unexpected behavior? all files chmod 755, i've compiled x.py with py_compilefiles, also tried within python console with import x system:  centos 5.4 32bit This a PATH related problem i think?

Re: pyc runtime error

2010-06-30 Thread Rami Chowdhury
On 2010-06-30 01:06, Baris CUHADAR wrote: Can anyone explain this unexpected behavior? I'm sorry -- can you let us know what behavior you're expecting? all files chmod 755, i've compiled x.py with py_compilefiles, also tried within python console with import x system: centos 5.4 32bit

Re: git JSONRPC web service and matching pyjamas front-end

2010-06-30 Thread Martin P. Hellwig
On 06/30/10 03:29, CM wrote: On Jun 29, 6:54 pm, Luke Kenneth Casson Leightonl...@lkcl.net wrote: as more than just a proof-of-concept but to get pyjamas out of looking like a nice toy, doesn't do much, great demos, shame about real life, cut If may be generated with pyjamas but I'm not sure

Build unordered list in HTML from a python list

2010-06-30 Thread Nico Grubert
Dear list members I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False}, {'indent': 1, 'title':'Item 2', 'hassubfolder':False}, {'indent': 1, 'title':'Folder 1', 'hassubfolder':True}, {'indent': 2, 'title':'Sub

Re: pyc runtime error

2010-06-30 Thread Baris CUHADAR
On Jun 30, 11:31 am, Rami Chowdhury rami.chowdh...@gmail.com wrote: On 2010-06-30 01:06, Baris CUHADAR wrote: Can anyone explain this unexpected behavior? I'm sorry -- can you let us know what behavior you're expecting? all files chmod 755, i've compiled x.py with py_compilefiles, also

Re: Python dynamic attribute creation

2010-06-30 Thread Andre Alexander Bell
On 06/29/2010 06:46 PM, WANG Cong wrote: On 06/29/10 17:48, Andre Alexander Bell p...@andre-bell.de wrote: var a a - should raise an variable 'unset' exception Keep in mind that the module you are writing in is just an object as is any function or method. So using local variables therein

Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Jorgen Grahn
On Wed, 2010-06-30, Michael Torrie wrote: On 06/29/2010 10:17 PM, Michael Torrie wrote: On 06/29/2010 10:05 PM, Michael Torrie wrote: #include stdio.h int main(int argc, char ** argv) { char *buf = malloc(512 * sizeof(char)); const int a = 2, b = 3; snprintf(buf, sizeof buf,

Re: pyc runtime error

2010-06-30 Thread Christian Heimes
Actually i wrote some scripts in python that are working as gateway controlling scripts iptables/tc/squid-proxy, and i want to execute them as cgi. Protection of source code is also important. These scripts works fine with ubuntu 9.10 and ubuntu 10.04, trying to eleminate this execution error

Ancient C string conventions (was Re: Why Is Escaping Data Considered So Magical?)

2010-06-30 Thread Jorgen Grahn
On Wed, 2010-06-30, Carl Banks wrote: On Jun 28, 2:44 am, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Carl Banks wrote: Indeed, strncpy does not copy that final NUL if it's at or beyond the nth element.  Probably the most mind-bogglingly stupid thing about the standard C library,

1.5.1 Py_XDECREF Core

2010-06-30 Thread Sunil
Hi,   We are using a legacy product which is using 1.5.1 version of Python and we have seen frequent core dumps offlate which is as below   #0  0x2b79b0 in list_dealloc (op=0x414b11d0) at listobject.c:220 #1  0x283c48 in dict_dealloc (mp=0x415b8c18) at dictobject.c:491 #2  0x2b4760 in

Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Cameron Simpson
On 29Jun2010 21:49, Carl Banks pavlovevide...@gmail.com wrote: | On Jun 28, 2:44 am, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: | Carl Banks wrote: | Indeed, strncpy does not copy that final NUL if it's at or beyond the | nth element.  Probably the most mind-bogglingly stupid thing

Re: 1.5.1 Py_XDECREF Core

2010-06-30 Thread Thomas Jollans
On 06/30/2010 11:39 AM, Sunil wrote: Hi, We are using a legacy product which is using 1.5.1 version of Python and we have seen frequent core dumps offlate which is as below #0 0x2b79b0 in list_dealloc (op=0x414b11d0) at listobject.c:220 #1 0x283c48 in dict_dealloc (mp=0x415b8c18) at

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Kushal Kumaran
On Wed, Jun 30, 2010 at 2:04 PM, Nico Grubert nicogrub...@yahoo.de wrote: Dear list members I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False},        {'indent': 1, 'title':'Item 2', 'hassubfolder':False},        {'indent': 1,

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Stefan Behnel
Nico Grubert, 30.06.2010 10:34: I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False}, {'indent': 1, 'title':'Item 2', 'hassubfolder':False}, {'indent': 1, 'title':'Folder 1', 'hassubfolder':True}, {'indent': 2, 'title':'Sub Item 1.1',

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Nico Grubert
Use a stack? Whenever you start a new list, push the corresponding closing tag onto a stack. Whenever your indent level decreases, pop the stack and write out the closing tag you get. It's straightforward to use a python list as a stack. Thanks for the tip, Kushal. Do you have a short code

Re: pyc runtime error

2010-06-30 Thread Baris CUHADAR
On Jun 30, 12:06 pm, Christian Heimes li...@cheimes.de wrote: Actually i wrote some scripts in python that are working as gateway controlling scripts iptables/tc/squid-proxy, and i want to execute them as cgi. Protection of source code is also important. These scripts works fine with

Re: pyc runtime error

2010-06-30 Thread Baris CUHADAR
On Jun 30, 2:20 pm, Baris CUHADAR 189...@gmail.com wrote: On Jun 30, 12:06 pm, Christian Heimes li...@cheimes.de wrote: Actually i wrote some scripts in python that are working as gateway controlling scripts iptables/tc/squid-proxy, and i want to execute them as cgi. Protection of

Re: pyc runtime error

2010-06-30 Thread Thomas Jollans
On 06/30/2010 01:20 PM, Baris CUHADAR wrote: On Jun 30, 12:06 pm, Christian Heimes li...@cheimes.de wrote: Actually i wrote some scripts in python that are working as gateway controlling scripts iptables/tc/squid-proxy, and i want to execute them as cgi. Protection of source code is also

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Remi Carton
Dear list members I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False}, {'indent': 1, 'title':'Item 2', 'hassubfolder':False}, {'indent': 1, 'title':'Folder 1', 'hassubfolder':True}, {'indent': 2,

Re: Why are String Formatted Queries Considered So Magical?

2010-06-30 Thread Nobody
On Tue, 29 Jun 2010 08:41:03 -0400, Roy Smith wrote: And what about regular expressions? What about them? As the saying goes: Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. That's silly. RE is a

Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Roy Smith
In article mailman.14.1277891765.1673.python-l...@python.org, Cameron Simpson c...@zip.com.au wrote: Jeez. PDP-11s, 16 bit addressing, tiny tiny disc drives! What you talking about, tiny? An RK-05 was huge! Why would anybody ever need more than that? The original V7 (and probably earlier)

Re: I strongly dislike Python 3

2010-06-30 Thread Lie Ryan
On 06/27/10 11:24, Steven D'Aprano wrote: Producing print function takes a little bit more effort than producing a print statement. (1) The main use-cases for print are quick (and usually dirty) scripts, interactive use, and as a debugging aid. That is precisely how the quick-and-dirty

Re: Find slope of function given empirical data.

2010-06-30 Thread Thomas
On Jun 30, 3:28 am, Peter Otten __pete...@web.de wrote: Thomas wrote: Trying to find slope of function using numpy. Getting close, but results are a bit off. Hope someone out here can help. You don't make it easy to understand your post. In the future please try to rely more on plain

Re: PDF Generation With Reportlab

2010-06-30 Thread Albert Leibbrandt
On 2010/06/30 10:52 AM, Tim Roberts wrote: Albert Leibbrandtalbe...@compuscan.co.ug wrote: I am hoping there is someone out there that knows reportlab quite well. I posted this on the reportlab mailing list but there is not much activity on that list Never the less, that is the

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Dave Angel
Nico Grubert wrote: Use a stack? Whenever you start a new list, push the corresponding closing tag onto a stack. Whenever your indent level decreases, pop the stack and write out the closing tag you get. It's straightforward to use a python list as a stack. Thanks for the tip, Kushal.

Re: pyc runtime error

2010-06-30 Thread Baris CUHADAR
On Jun 30, 3:10 pm, Thomas Jollans tho...@jollans.com wrote: On 06/30/2010 01:20 PM, Baris CUHADAR wrote: On Jun 30, 12:06 pm, Christian Heimes li...@cheimes.de wrote: Actually i wrote some scripts in python that are working as gateway controlling scripts iptables/tc/squid-proxy, and i

Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Michael Torrie
On 06/30/2010 03:00 AM, Jorgen Grahn wrote: On Wed, 2010-06-30, Michael Torrie wrote: On 06/29/2010 10:17 PM, Michael Torrie wrote: On 06/29/2010 10:05 PM, Michael Torrie wrote: #include stdio.h int main(int argc, char ** argv) { char *buf = malloc(512 * sizeof(char)); const int a =

Re: Why are String Formatted Queries Considered So Magical?

2010-06-30 Thread Jorgen Grahn
On Tue, 2010-06-29, Stephen Hansen wrote: On 6/29/10 5:41 AM, Roy Smith wrote: Nobodynob...@nowhere.com wrote: And what about regular expressions? What about them? As the saying goes: Some people, when confronted with a problem, think I know, I'll use regular expressions.

Re: Find slope of function given empirical data.

2010-06-30 Thread Grant Edwards
On 2010-06-29, Thomas thom1...@gmail.com wrote: Trying to find slope of function using numpy. Getting close, but results are a bit off. Hope someone out here can help. import numpy as np def deriv(y): x = list(range(len(y))) x.reverse() # Change from [0, 1, 2, 3, 4, 5, 6, 7,

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Jorgen Grahn
On Wed, 2010-06-30, Kushal Kumaran wrote: On Wed, Jun 30, 2010 at 2:04 PM, Nico Grubert nicogrub...@yahoo.de wrote: Dear list members I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False},        {'indent': 1, 'title':'Item 2',

Re: Why are String Formatted Queries Considered So Magical?

2010-06-30 Thread Stephen Hansen
On 6/30/10 7:14 AM, Jorgen Grahn wrote: On Tue, 2010-06-29, Stephen Hansen wrote: On 6/29/10 5:41 AM, Roy Smith wrote: Nobodynob...@nowhere.com wrote: And what about regular expressions? What about them? As the saying goes: Some people, when confronted with a problem, think

Re: I strongly dislike Python 3

2010-06-30 Thread Stephen Hansen
On 6/30/10 5:52 AM, Lie Ryan wrote: On 06/27/10 11:24, Steven D'Aprano wrote: Producing print function takes a little bit more effort than producing a print statement. (1) The main use-cases for print are quick (and usually dirty) scripts, interactive use, and as a debugging aid. That is

Re: I strongly dislike Python 3

2010-06-30 Thread Michele Simionato
On Jun 30, 2:52 pm, Lie Ryan lie.1...@gmail.com wrote: On 06/27/10 11:24, Steven D'Aprano wrote: Producing print function takes a little bit more effort than producing a print statement. (1) The main use-cases for print are quick (and usually dirty) scripts, interactive use, and as a

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Daniel Fetchinson
I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False}, {'indent': 1, 'title':'Item 2', 'hassubfolder':False}, {'indent': 1, 'title':'Folder 1', 'hassubfolder':True}, {'indent': 2, 'title':'Sub Item 1.1',

numpy - save many arrays into a file object

2010-06-30 Thread Laszlo Nagy
import numpy data = numpy.array(...) numpy.save(test.np,data) This is very good, but I want to save the data into a file object with a write() method. E.g. not a real file. (My purpose right now is to save many arrays into one binary file, while recording starting positions of the arrays.)

Re: git JSONRPC web service and matching pyjamas front-end

2010-06-30 Thread CM
On Jun 30, 4:27 am, Martin P. Hellwig martin.hell...@dcuktec.org wrote: On 06/30/10 03:29, CM wrote: On Jun 29, 6:54 pm, Luke Kenneth Casson Leightonl...@lkcl.net wrote: as more than just a proof-of-concept but to get pyjamas out of looking like a nice toy, doesn't do much, great demos,

Re: numpy - save many arrays into a file object

2010-06-30 Thread Terry Reedy
On 6/30/2010 11:48 AM, Laszlo Nagy wrote: import numpy data = numpy.array(...) numpy.save(test.np,data) This is very good, but I want to save the data into a file object with a write() method. E.g. not a real file. (My purpose right now is to save many arrays into one binary file, while

Re: I strongly dislike Python 3

2010-06-30 Thread Lie Ryan
On 07/01/10 01:30, Stephen Hansen wrote: On 6/30/10 5:52 AM, Lie Ryan wrote: On 06/27/10 11:24, Steven D'Aprano wrote: Producing print function takes a little bit more effort than producing a print statement. (1) The main use-cases for print are quick (and usually dirty) scripts,

Re: I strongly dislike Python 3

2010-06-30 Thread Lie Ryan
On 07/01/10 01:42, Michele Simionato wrote: On Jun 30, 2:52 pm, Lie Ryan lie.1...@gmail.com wrote: On 06/27/10 11:24, Steven D'Aprano wrote: Producing print function takes a little bit more effort than producing a print statement. (1) The main use-cases for print are quick (and usually

Re: dynamically modify help text

2010-06-30 Thread Aahz
In article mailman.2338.1277812368.32709.python-l...@python.org, Thomas Jollans tho...@jollans.com wrote: % python2.6 Python 2.6.5+ (release26-maint, Jun 28 2010, 19:46:36) [GCC 4.4.4] on linux2 Type help, copyright, credits or license for more information. class OLD: pass ... class

Re: A question about the posibility of raise-yield in Python

2010-06-30 Thread John Nagle
On 6/30/2010 12:13 AM, Дамјан Георгиевски wrote: A 'raise-yield' expression would break the flow of a program just like an exception, going up the call stack until it would be handled, but also like yield it would be possible to continue the flow of the program from where it was raise-yield-ed.

Re: numpy - save many arrays into a file object

2010-06-30 Thread Peter Otten
Laszlo Nagy wrote: import numpy data = numpy.array(...) numpy.save(test.np,data) This is very good, but I want to save the data into a file object with a write() method. E.g. not a real file. (My purpose right now is to save many arrays into one binary file, while recording starting

Re: Why are String Formatted Queries Considered So Magical?

2010-06-30 Thread Terry Reedy
On 6/30/2010 8:22 AM, Nobody wrote: I've noticed over the years a significant anti-RE sentiment in the Python community. IMHO, the sentiment isn't so much against REs per se, but against excessive or inappropriate use. Apart from making it easy to write illegible code, they also make it easy

Re: Why are String Formatted Queries Considered So Magical?

2010-06-30 Thread Ethan Furman
Terry Reedy wrote: On 6/30/2010 8:22 AM, Nobody wrote: I've noticed over the years a significant anti-RE sentiment in the Python community. IMHO, the sentiment isn't so much against REs per se, but against excessive or inappropriate use. Apart from making it easy to write illegible code,

Re: I strongly dislike Python 3

2010-06-30 Thread Stephen Hansen
On 6/30/10 9:22 AM, Lie Ryan wrote: On 07/01/10 01:30, Stephen Hansen wrote: On 6/30/10 5:52 AM, Lie Ryan wrote: On 06/27/10 11:24, Steven D'Aprano wrote: Producing print function takes a little bit more effort than producing a print statement. (1) The main use-cases for print are quick

Using Python for web applications

2010-06-30 Thread Wyatt Schwartz
Dear Python-List members, Sorry for asking such a simple (or possibly complicated) question, as I am new to Python programming. Anyways, I have read online that many popular websites use Python for some of their web-based applications (for example, Reddit), and that lead me to wonder how

Hwy doesn't len(None) return zero ?

2010-06-30 Thread Stef Mientki
hello, I've lot of functions that returns their result in some kind of tuple / list / array, and if there is no result, these functions return None. Now I'm often what to do something if I've more than 1 element in the result. So I test: if len ( Result ) 1 : But to prevent exceptions,

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Stephen Hansen
On 6/30/10 11:39 AM, Stef Mientki wrote: hello, I've lot of functions that returns their result in some kind of tuple / list / array, and if there is no result, these functions return None. Now I'm often what to do something if I've more than 1 element in the result. So I test: if len (

Re: Using Python for web applications

2010-06-30 Thread Daniel Fetchinson
Sorry for asking such a simple (or possibly complicated) question, as I am new to Python programming. Anyways, I have read online that many popular websites use Python for some of their web-based applications (for example, Reddit), and that lead me to wonder how is this done? There are

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Zubin Mithra
On Thu, Jul 1, 2010 at 12:09 AM, Stef Mientki stef.mien...@gmail.comwrote: hello, I've lot of functions that returns their result in some kind of tuple / list / array, and if there is no result, these functions return None. Now I'm often what to do something if I've more than 1 element in

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Gary Herron
On 06/30/2010 11:39 AM, Stef Mientki wrote: hello, I've lot of functions that returns their result in some kind of tuple / list / array, and if there is no result, these functions return None. Now I'm often what to do something if I've more than 1 element in the result. So I test: if

Re: Using Python for web applications

2010-06-30 Thread Zubin Mithra
On Wed, Jun 30, 2010 at 11:34 PM, Wyatt Schwartz wyattj...@gmail.comwrote: Dear Python-List members, Sorry for asking such a simple (or possibly complicated) question, as I am new to Python programming. Anyways, I have read online that many popular websites use Python for some of their

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Stefan Behnel
Stef Mientki, 30.06.2010 20:39: I've lot of functions that returns their result in some kind of tuple / list / array, and if there is no result, these functions return None. Now I'm often what to do something if I've more than 1 element in the result. So I test: if len ( Result ) 1 : But

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Tim Chase
On 06/30/2010 01:50 PM, Stephen Hansen wrote: On 6/30/10 11:39 AM, Stef Mientki wrote: if len ( Result ) 1 : But to prevent exceptions, i've to write ( I often forget) if Result and ( len ( Result ) 1 ) : Just do: if Result: You don't have to do a length check 1; because if Result

Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Carl Banks
On Jun 30, 2:55 am, Cameron Simpson c...@zip.com.au wrote: On 29Jun2010 21:49, Carl Banks pavlovevide...@gmail.com wrote: | On Jun 28, 2:44 am, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: | Carl Banks wrote: | Indeed, strncpy does not copy that final NUL if it's at or beyond the |

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Stephen Hansen
On 6/30/10 12:02 PM, Tim Chase wrote: On 06/30/2010 01:50 PM, Stephen Hansen wrote: On 6/30/10 11:39 AM, Stef Mientki wrote: if len ( Result ) 1 : But to prevent exceptions, i've to write ( I often forget) if Result and ( len ( Result ) 1 ) : Just do: if Result: You don't have to do a

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Dave Angel
Stephen Hansen wrote: On 6/30/10 11:39 AM, Stef Mientki wrote: hello, I've lot of functions that returns their result in some kind of tuple / list / array, and if there is no result, these functions return None. Now I'm often what to do something if I've more than 1 element in the result. So

Re: Ancient C string conventions

2010-06-30 Thread Paul Rubin
Jorgen Grahn grahn+n...@snipabacken.se writes: It's somewhat believable. If I handled thousands of student names in a big C array char[30][], I would resent the fact that 1/30 of the memory was wasted on NUL bytes. But you'd be wasting even more of the memory on bytes left unused when the

Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Paul Rubin
Cameron Simpson c...@zip.com.au writes: The original V7 (and probably earlier) UNIX filesystem has 16 byte directory entries: 2 bytes for an inode and 14 bytes for the name. You could use 14 bytes of that name, and strncpy makes it effective to work with that data structure. Why not use

Python/C++ timer intermittent bug

2010-06-30 Thread Paul
I have a problem with threading using the Python/C API. I have an extension that implements a timer, and the C++ timer callback function calls a Python function. The relevant code looks like this: static PyObject *timer_setmodname( PyObject *pSelf, PyObject *pArgs ) { char *b;

Re: Python as a scripting language. Alternative to bash script?

2010-06-30 Thread Mithrandir
Michael Torrie torr...@gmail.com wrote in news:mailman.2313.1277759925.32709.python-l...@python.org: On 06/28/2010 02:06 PM, Mithrandir wrote: I can't see Python as an alt. to bash. (As I recall) Python is much more object-oriented than bash, but also there are many commands (such as apt-

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Ian Kelly
On Wed, Jun 30, 2010 at 12:39 PM, Stef Mientki stef.mien...@gmail.com wrote: So I wonder why len is not allowed on None and if there are objections to extend the len function . For the same reason that (None + 42) doesn't return 42, and that (None.upper()) doesn't return NONE. --

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Emile van Sebille
On 6/30/2010 11:39 AM Stef Mientki said... hello, I've lot of functions that returns their result in some kind of tuple / list / array, and if there is no result, these functions return None. Now I'm often what to do something if I've more than 1 element in the result. So I test: which

Re: Why are String Formatted Queries Considered So Magical?

2010-06-30 Thread Steven D'Aprano
On Wed, 30 Jun 2010 14:14:38 +, Jorgen Grahn wrote: On Tue, 2010-06-29, Stephen Hansen wrote: On 6/29/10 5:41 AM, Roy Smith wrote: Nobodynob...@nowhere.com wrote: And what about regular expressions? What about them? As the saying goes: Some people, when confronted with a problem,

Re: I strongly dislike Python 3

2010-06-30 Thread Steven D'Aprano
On Wed, 30 Jun 2010 22:52:06 +1000, Lie Ryan wrote: On 06/27/10 11:24, Steven D'Aprano wrote: Producing print function takes a little bit more effort than producing a print statement. (1) The main use-cases for print are quick (and usually dirty) scripts, interactive use, and as a

Re: Ignorance and Google Groups (again)

2010-06-30 Thread D'Arcy J.M. Cain
On Wed, 30 Jun 2010 13:10:43 -0700 (PDT) garryTX garry5...@gmail.com wrote: On Jun 29, 5:31 pm, nanothermite911fbibustards [...] you ignorant mf. stfu. You shouldn't be calling people ignorant for what they post if you are just going to repost every word again. Everything that applies to him

Re: Ignorance and Google Groups (again)

2010-06-30 Thread Stephen Hansen
On 6/30/10 1:55 PM, D'Arcy J.M. Cain wrote: I have had it with GG. For the last few months I have been filtering all mail from gmail.com that comes through the news gateway into a separate folder to see where the spam and abuse comes from. Over that time about 99% of all the useless crap has

Re: Ignorance and Google Groups (again)

2010-06-30 Thread D'Arcy J.M. Cain
On Wed, 30 Jun 2010 14:06:05 -0700 Stephen Hansen me+list/pyt...@ixokai.io wrote: Gmail and Google Groups are not one and the same. There's a number of people who subscribe to the list directly, use Gmail, and don't go anywhere near Google Groups. I know that. My filter doesn't catch them.

Re: Ignorance and Google Groups (again)

2010-06-30 Thread Stephen Hansen
On 6/30/10 2:15 PM, D'Arcy J.M. Cain wrote: If anyone is interested in the procmail recipe I will be using, here it is in all it's glory. :0: Hir * ^List-Id:.*python-list.python.org * ^From:@gmail.com * ^Newsgroups: /dev/null As you can see, to be caught in the filter you need to have a

Re: I strongly dislike Python 3

2010-06-30 Thread geremy condra
On Wed, Jun 30, 2010 at 4:34 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Wed, 30 Jun 2010 22:52:06 +1000, Lie Ryan wrote: On 06/27/10 11:24, Steven D'Aprano wrote: Producing print function takes a little bit more effort than producing a print statement. (1) The main

Re: Ignorance and Google Groups (again)

2010-06-30 Thread geremy condra
On Wed, Jun 30, 2010 at 5:15 PM, D'Arcy J.M. Cain da...@druid.net wrote: On Wed, 30 Jun 2010 14:06:05 -0700 Stephen Hansen me+list/pyt...@ixokai.io wrote: Gmail and Google Groups are not one and the same. There's a number of people who subscribe to the list directly, use Gmail, and don't go

Re: Ignorance and Google Groups (again)

2010-06-30 Thread D'Arcy J.M. Cain
On Wed, 30 Jun 2010 17:25:55 -0400 geremy condra debat...@gmail.com wrote: If you get this, you get the gmail-but-not-google-groups stuff. Hello. -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416

Re: Using Python for web applications

2010-06-30 Thread Mithrandir
Wyatt Schwartz wyattj...@gmail.com wrote in news:mailman.33.1277921551.1673.python-l...@python.org: Dear Python-List members, Sorry for asking such a simple (or possibly complicated) question, as I am new to Python programming. Anyways, I have read online that many popular websites use

Re: Ignorance and Google Groups (again)

2010-06-30 Thread rantingrick
On Jun 30, 3:55 pm, D'Arcy J.M. Cain da...@druid.net wrote: I have had it with GG.  For the last few months I have been filtering all mail from gmail.com that comes through the news gateway into a separate folder to see where the spam and abuse comes from.  Over that time about 99% of all the

Re: Ignorance and Google Groups (again)

2010-06-30 Thread D'Arcy J.M. Cain
On Wed, 30 Jun 2010 14:18:55 -0700 Stephen Hansen me+list/pyt...@ixokai.io wrote: Okay, un-Bye :) Nice to be back. :-) -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)

Re: Ignorance and Google Groups (again)

2010-06-30 Thread Philip Semanchuk
On Jun 30, 2010, at 4:55 PM, D'Arcy J.M. Cain wrote: On Wed, 30 Jun 2010 13:10:43 -0700 (PDT) garryTX garry5...@gmail.com wrote: On Jun 29, 5:31 pm, nanothermite911fbibustards [...] you ignorant mf. stfu. You shouldn't be calling people ignorant for what they post if you are just going

Re: Ignorance and Google Groups (again)

2010-06-30 Thread Thomas Jollans
On 06/30/2010 10:55 PM, D'Arcy J.M. Cain wrote: in all it's glory. :0: Hir * ^List-Id:.*python-list.python.org * ^From:@gmail.com * ^Newsgroups: /dev/null * X-Complaints-To: groups-ab...@google.com looks like a nice header to filter on --

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Steven D'Aprano
Please pardon me for breaking threading, but Stef's original post has not come through to me. On 6/30/10 11:39 AM, Stef Mientki wrote: hello, I've lot of functions that returns their result in some kind of tuple / list / array, and if there is no result, these functions return None. Well

Re: I strongly dislike Python 3

2010-06-30 Thread Steven D'Aprano
On Wed, 30 Jun 2010 17:21:32 -0400, geremy condra wrote: On Wed, Jun 30, 2010 at 4:34 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Wed, 30 Jun 2010 22:52:06 +1000, Lie Ryan wrote: On 06/27/10 11:24, Steven D'Aprano wrote: Producing print function takes a little bit

Re: I strongly dislike Python 3

2010-06-30 Thread Brian Blais
On Jun 30, 2010, at 8:52 , Lie Ryan wrote: On 06/27/10 11:24, Steven D'Aprano wrote: Producing print function takes a little bit more effort than producing a print statement. (1) The main use-cases for print are quick (and usually dirty) scripts, interactive use, and as a debugging aid.

Re: Hwy doesn't len(None) return zero ?

2010-06-30 Thread Stef Mientki
On 30-06-2010 20:56, Gary Herron wrote: On 06/30/2010 11:39 AM, Stef Mientki wrote: hello, I've lot of functions that returns their result in some kind of tuple / list / array, and if there is no result, these functions return None. Now I'm often what to do something if I've more than 1

Re: I strongly dislike Python 3

2010-06-30 Thread geremy condra
On Wed, Jun 30, 2010 at 6:30 PM, Steven D'Aprano steve-remove-t...@cybersource.com.au wrote: On Wed, 30 Jun 2010 17:21:32 -0400, geremy condra wrote: On Wed, Jun 30, 2010 at 4:34 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Wed, 30 Jun 2010 22:52:06 +1000, Lie Ryan

Re: I strongly dislike Python 3

2010-06-30 Thread Mark Lawrence
On 30/06/2010 23:30, Steven D'Aprano wrote: [snips] The rule against premature optimization doesn't just apply to *code*. +1QOTW Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Cameron Simpson
On 30Jun2010 12:19, Paul Rubin no.em...@nospam.invalid wrote: | Cameron Simpson c...@zip.com.au writes: | The original V7 (and probably earlier) UNIX filesystem has 16 byte directory | entries: 2 bytes for an inode and 14 bytes for the name. You could use 14 | bytes of that name, and strncpy

Re: A question about the posibility of raise-yield in Python

2010-06-30 Thread ru...@yahoo.com
On Jun 30, 10:48 am, John Nagle na...@animats.com wrote: On 6/30/2010 12:13 AM, Дамјан Георгиевски wrote: A 'raise-yield' expression would break the flow of a program just like an exception, going up the call stack until it would be handled, but also like yield it would be possible to

automate minesweeper with python

2010-06-30 Thread Jay
I would like to create a python script that plays the Windows game minesweeper. The python code logic and running minesweeper are not problems. However, seeing the 1-8 in the minesweeper map and clicking on squares is. I have no idea how to proceed. --

Re: Need instruction on how to use isinstance

2010-06-30 Thread Hans Mulder
alex23 wrote: Stephen Hansen me+list/pyt...@ixokai.io wrote: P.S. The removal of callable is something I don't understand in Python 3: while generally speaking I do really believe and use duck typing, I too have on occassion wanted to dispatch based on 'is callable? do x'. Sometimes its not

Re: I strongly dislike Python 3

2010-06-30 Thread ru...@yahoo.com
On Jun 30, 9:42 am, Michele Simionato michele.simion...@gmail.com wrote: Actually when debugging I use pdb which uses p (no parens) for printing, so having print or print() would not make any difference for me. Perhaps you don't use CJK strings much? p u'\u30d1\u30a4\u30c8\u30f3' give quite

Re: I strongly dislike Python 3

2010-06-30 Thread rantingrick
On Jun 30, 4:21 pm, geremy condra debat...@gmail.com wrote: Actually, I agree with this complaint though- it is much easier to type spaces than parens. Oh Geremy please. If you're going to whine about something at least find something worth whining about! Yes a few more key strokes are needed.

  1   2   3   >