Re: String substitution VS proper mysql escaping

2010-08-19 Thread Νίκος
I would expect that: "nikos" is a string, while, ("nikos") is a single element tuple. ["nikos"] is a single element list. That way we wouldn't be needing comma seperators. I just don't like it when "nikos" and ("nikos") is the same thing exactly. Parentheses are to be used to define a tuple and s

Re: String substitution VS proper mysql escaping

2010-08-19 Thread Νίκος
On 18 Αύγ, 12:50, Cameron Simpson wrote: > > ("nikos",) is a single element tuple. > ["nikos"] is a single element list. > ["nikos",] is also a single element list, just written like the tuple. It makes more sense if i: "nikos" is just a string ("nikos") is a single element tuple ["nikos"] is

Re: How to see intermediate fail results from unittest as tests are running?

2010-08-19 Thread Peter Otten
Margie Roginski wrote: > I am using unittest in a fairly basic way, where I have a single file > that simply defines a class that inherits from unittest.TestCase and > then within that class I have a bunch of methods that start with > "test". Within that file, at the bottom I have: > > if __name

Re: OpenCV_Problem

2010-08-19 Thread arihant nahata
> There is no file named _cv.dll file in the directory that you mentioned > what to do now.??? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Wed, 18 Aug 2010 21:55:30 -0700, Russ P. wrote: > On Aug 18, 7:58 pm, Steven D'Aprano t...@cybersource.com.au> wrote: >> On Wed, 18 Aug 2010 14:47:08 -0700, Russ P. wrote: >> > Is the top team in the league the number 1 team -- or the number 0 >> > team? I have yet to hear anyone call the best

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-19 Thread Standish P
On Aug 18, 5:38 pm, Keith Thompson wrote: > Standish P writes: > > On Aug 18, 12:30 pm, Elizabeth D Rather wrote: > [...] > >> Mostly it had a "snowball's chance" because it was never picked up by > >> the CS gurus who, AFAIK, never really took a serious look at it. > > > Its quite possible that

comp.lang.python

2010-08-19 Thread roshini begum
www.127760.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for an appropriate encoding standard that supports all languages

2010-08-19 Thread ata.jaf
On Aug 17, 11:55 pm, Thomas Jollans wrote: > On Tuesday 17 August 2010, it occurred to ata.jaf to exclaim: > > > I am developing a little program in Mac with wxPython. > > But I have problems with the characters that are not in ASCII. Like > > some special characters in French or Turkish. > > So I

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-19 Thread John Kelly
On Thu, 19 Aug 2010 00:56:35 -0700 (PDT), Standish P wrote: >On Aug 18, 5:38 pm, Keith Thompson wrote: >> Standish P writes: >> > Show me on what page does it explain how Forth implements dynamic >> > binding or lexical binding and takes care of the scope of definition >> > of the "nouns" ? >

Re: Looking for an appropriate encoding standard that supports all languages

2010-08-19 Thread Steven D'Aprano
On Thu, 19 Aug 2010 01:29:51 -0700, ata.jaf wrote: > On Aug 17, 11:55 pm, Thomas Jollans wrote: >> On Tuesday 17 August 2010, it occurred to ata.jaf to exclaim: >> >> > I am developing a little program in Mac with wxPython. But I have >> > problems with the characters that are not in ASCII. Like

Re: Pop return from stack?

2010-08-19 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : Oh my ... I've seen people writing Java in Python, C++ in Python, Perl in Python, even VB in Python, but this is the first time I've meet some one who wants to write assembler in Python :) +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for an appropriate encoding standard that supports all languages

2010-08-19 Thread Martin v. Loewis
> I write a line of strings in the source code and I want my program to > show that as an output on GUI. And this line of strings includes a > character like "ü". Make sure you use Unicode literals in your source code, i.e. u"ü". HTH, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: when 'myArray * 'myObject' is not equal to 'myObject' * 'myArray'

2010-08-19 Thread Duim
On Aug 18, 10:03 pm, Nobody wrote: > On Wed, 18 Aug 2010 05:56:27 -0700, Duim wrote: > > Although I'm sure somewhere this issue is discussed in this (great) > > group, I didn't know the proper search words for it (although I > > tried). > > > I'm using python (2.6) scientifically mostly, and creat

Unsupported Format Character '&' (0x26)

2010-08-19 Thread Andrew Evans
I get an error message "Unsupported Format Character '&' (0x26)" I narrowed it down to these two variables any idea how to fix it? SEARCH_URL_0 = " http://search.yahoo.com/search;_ylt=A0oGdEf1XGxMJRoAUdml87UF;_ylc=X1MDMjE0MjQ3ODk0OARfcgMyBGZyA3NmcARuX2dwcwMxMARvcmlnaW4Dc3ljBHF1ZXJ5A3Rlc3QEc2FvA

path to data files

2010-08-19 Thread Daniel Fetchinson
If a python module requires a data file to run how would I reference this data file in the source in a way that does not depend on whether the module is installed system-wide, installed in $HOME/.local or is just placed in a directory from where the interpreter is fired up? I'd like to always keep

Re: path to data files

2010-08-19 Thread Daniel Kluev
On Thu, Aug 19, 2010 at 9:25 PM, Daniel Fetchinson < fetchin...@googlemail.com> wrote: > If a python module requires a data file to run how would I reference > this data file in the source in a way that does not depend on whether > the module is installed system-wide, installed in $HOME/.local or

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-19 Thread spinoza1111
On Aug 18, 1:44 am, James Kanze wrote: > On Aug 17, 6:21 pm, Standish P wrote: > > > > Garbage collection doesn't use a stack. It uses a "heap", > > > which is in the abstract a collection of memory blocks of > > > different lengths, divided into two lists, generally > > > represented as linked l

Re: path to data files

2010-08-19 Thread Daniel Fetchinson
>> If a python module requires a data file to run how would I reference >> this data file in the source in a way that does not depend on whether >> the module is installed system-wide, installed in $HOME/.local or is >> just placed in a directory from where the interpreter is fired up? I'd >> like

Re: String substitution VS proper mysql escaping

2010-08-19 Thread Tim Chase
On 08/19/10 02:10, Νίκος wrote: ("nikos",) is a single element tuple. ["nikos"] is a single element list. ["nikos",] is also a single element list, just written like the tuple. It makes more sense if i: "nikos" is just a string ("nikos") is a single element tuple ["nikos"] is also a single ele

Re: Unsupported Format Character '&' (0x26)

2010-08-19 Thread Peter Otten
Andrew Evans wrote: > On Wed, Aug 18, 2010 at 4:35 PM, Andrew Evans wrote: > >> I get an error message "Unsupported Format Character '&' (0x26)" I >> narrowed it down to these two variables >> >> any idea how to fix it? >> >> SEARCH_URL_0 = "http://search.yahoo.com/search...?p=%(query)..." >

Re: String substitution VS proper mysql escaping

2010-08-19 Thread Stefan Schwarzer
Hi Νίκος, On 2010-08-19 09:10, Νίκος wrote: > On 18 Αύγ, 12:50, Cameron Simpson wrote: >> >> ("nikos",) is a single element tuple. >> ["nikos"] is a single element list. >> ["nikos",] is also a single element list, just written like the tuple. > > It makes more sense if i: > > "nikos" is just a

How do I make python test.py work without a syntax error msg?

2010-08-19 Thread Agida Kerimova
I am new to programming/python and have been having some difficulties getting started. I can't seem to run scripts without a syntax error msg. When I drag the file to the IDLE launcher or run the module it works, but when I actually type it I get an error msg. I've been told that the path to pytho

Re: path to data files

2010-08-19 Thread Alain Ketterlin
Daniel Fetchinson writes: > If a python module requires a data file to run how would I reference > this data file in the source in a way that does not depend on whether > the module is installed system-wide, installed in $HOME/.local or is > just placed in a directory from where the interpreter i

Re: [Python] Unsupported Format Character '&' (0x26)

2010-08-19 Thread Chris Gonnerman
On 08/18/2010 06:35 PM, Andrew Evans wrote: I get an error message "Unsupported Format Character '&' (0x26)" I narrowed it down to these two variables any idea how to fix it? SEARCH_URL_0 = "http://search.yahoo.com/search;_ylt=A0oGdEf1XGxMJRoAUdml87UF;_ylc=X1MDMjE0MjQ3ODk0OARfcgMyBGZyA3NmcA

Re: How do I make python test.py work without a syntax error msg?

2010-08-19 Thread Sergey Smirnov
*when I actually * *type it I get an error msg* Did you type python commands in a bash console? In case you did, you should run python interactive console instead. Just type python in terminal window and than you'll be able interactively run statements. If you have your script saved in a file, f

Re: How do I make python test.py work without a syntax error msg?

2010-08-19 Thread Benjamin Kaplan
On Thu, Aug 19, 2010 at 8:22 AM, Agida Kerimova wrote: > I am new to programming/python and have been having some difficulties > getting started. I can't seem to run scripts without a syntax error msg. > When I drag the file to the IDLE launcher or run the module it works, but > when I actually ty

Re: How do I make python test.py work without a syntax error msg?

2010-08-19 Thread Sergey Smirnov
I see. Your script begins with a string: $ python test.py It's not a valid python code. Maybe you just copied this text to your script accidentally. Try to delete the first string. Can you send a few first strings of your script? On Thu, Aug 19, 2010 at 17:05, Agida Kerimova wrote: > this is

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-19 Thread Anton Ertl
John Nagle writes: >In the superscalar era, there's not much of an advantage to avoiding >stack accesses. Apart from 4stack, I am not aware of a superscalar stack machine (and 4stack is more of an LIW than a superscalar). OTOH, if by stack accesses you mean memory accesses through the stack

Contains/equals

2010-08-19 Thread Karsten Wutzke
Hello, I have an object which has a list of other complex objects. How do I best achieve a complex "contains" comparison based on the object's class? In Java terms, I'm looking for an equivalent to equals(Object) in Python. Does a similar thing exist? Directions appreciated. Karsten -- http://ma

Creating a PYD file

2010-08-19 Thread Rony
Is a PYD file created from Pyrex faster in execution then a PYD file created from python source ? Tia Rony -- http://mail.python.org/mailman/listinfo/python-list

Re: 79 chars or more?

2010-08-19 Thread Roald de Vries
Dear Jean-Michel, On Aug 18, 2010, at 10:57 AM, Jean-Michel Pichavant wrote: At least, if you still want to stick with 79 chars, do something like text = find(response, 'MPNExpirationDate', ).text self.expiration_date = translate_date(text,'%Y-%m-%d', '%m%d%Y') I don't necessarily like this e

Re: Python "why" questions

2010-08-19 Thread Grant Edwards
On 2010-08-19, Russ P. wrote: > And I'd still like to know if the "1st" element of aList is aList[0] > or aList[1]. aList[0] -- Grant Edwards grant.b.edwardsYow! I'm definitely not at in Omaha!

Re: Contains/equals

2010-08-19 Thread Peter Otten
Karsten Wutzke wrote: > I have an object which has a list of other complex objects. How do I > best achieve a complex "contains" comparison based on the object's > class? In Java terms, I'm looking for an equivalent to equals(Object) > in Python. Does a similar thing exist? Directions appreciated.

Re: Contains/equals

2010-08-19 Thread Karsten Wutzke
On Aug 19, 4:47 pm, Peter Otten <__pete...@web.de> wrote: > Karsten Wutzke wrote: > > I have an object which has a list of other complex objects. How do I > > best achieve a complex "contains" comparison based on the object's > > class? In Java terms, I'm looking for an equivalent to equals(Object)

Re: Contains/equals

2010-08-19 Thread Alex Hall
On 8/19/10, Peter Otten <__pete...@web.de> wrote: > Karsten Wutzke wrote: > >> I have an object which has a list of other complex objects. How do I >> best achieve a complex "contains" comparison based on the object's >> class? In Java terms, I'm looking for an equivalent to equals(Object) >> in Py

Re: Contains/equals

2010-08-19 Thread Christian Heimes
Am 19.08.2010 17:00, schrieb Alex Hall: > In Python, as I understand it, you can define this behavior. > > class c(object): > def __init__(self, a=1, b=2): > self.a=a; self.b=b > > def __eq__(self, obj): > if self.a==obj.a and self.b==obj.b: return True > return False Yes, but you have t

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-19 Thread Richard Harter
On Wed, 18 Aug 2010 01:39:09 -0700 (PDT), Nick Keighley wrote: >On 17 Aug, 18:34, Standish P wrote: >> How are these heaps being implemented ? Is there some illustrative >> code or a book showing how to implement these heaps in C for example ? > >any book of algorithms I'd have thought > >http:

Re: String substitution VS proper mysql escaping

2010-08-19 Thread Nik Gr
Στις 19/8/2010 2:32 μμ, ο/η Tim Chase έγραψε: So Python needs a way to express that you *explicitly* mean "this is one of those rare one-element tuples, not an order of operations prioritization": (1,) + (2,) to return "(1,2)" Yes i can see the difference now!! I just had to look at the big

Re: String substitution VS proper mysql escaping

2010-08-19 Thread Nik Gr
Στις 19/8/2010 2:32 μμ, ο/η Tim Chase έγραψε: (1,) + (2,) to return "(1,2)" This is actually joining two single element tuples (1,) and (2, ) to a new bigger tuple of two elements, correct? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to see intermediate fail results from unittest as tests are running?

2010-08-19 Thread Margie Roginski
On Aug 19, 12:41 am, Peter Otten <__pete...@web.de> wrote: > Margie Roginski wrote: > > I am using unittest in a fairly basic way, where I have a single file > > that simply defines a class that inherits from unittest.TestCase and > > then within that class I have a bunch of methods that start with

Re: String substitution VS proper mysql escaping

2010-08-19 Thread Tim Chase
On 08/19/10 10:42, Nik Gr wrote: You can also prefix any of them with "r" such as file_path = r"c:\path\to\file.txt" file_path = r'c:\path\to\file.txt file_path = r"""c:\path\to\file.txt""" file_path = r'''c:\path\to\file.txt''' 'r' is to avoid escaping backslashes only or other sp

bug? context managers vs ImportErrors

2010-08-19 Thread Chris Withers
Hi All, Am I right in thinking this is a bug: class MyContextManager: def __enter__(self): pass def __exit__(self,t,e,tb): print type(t),t print type(e),e with MyContextManager(): import foo.bar.baz ...when executed, gives me: No module named foo.bar.b

Reading the access attributes of directories in Windows

2010-08-19 Thread vsoler
Hello everyone! I need to read, for each of the directories in a shared file server unit, who has access to the directories and what type of access privileges. This is something that I can easily do interactively in my Windows Document Explorer by right clicking a single directory, clicking on Pr

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-19 Thread Keith Thompson
Standish P writes: > On Aug 18, 5:38 pm, Keith Thompson wrote: [...] >> Show me how this is relevant to comp.lang.c, comp.lang.c++, comp.theory, >> or comp.lang.python.  Please trim the Newsgroups line. > > provide a rigorous proof that people are more interested in the > nauseating nude pictures

ANN: eGenix mxODBC - Python ODBC Database Interface 3.1.0

2010-08-19 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC - Python ODBC Database Interface Version 3.1.0 mxODBC is our commercially supported Python extension providing ODBC database connectivity to Py

Re: Python "why" questions

2010-08-19 Thread J.B. Brown
2010/8/9 MRAB : > Default User wrote: >> >> Not to prolong a good "food fight", but IIRC, many years ago in QBasic, >> one could choose >> >> OPTION BASE 0 >> >> or >> >> OPTION BASE 1 >> When I wrote my own C++ 2-D matrix class, I wrote a member function which did exactly this - allow you to spec

Python module Code returns empty list any ideas how to fix

2010-08-19 Thread Andrew Evans
Hello I am trying to modify Python xgoogle module to use yahoo I have hit a road block where I receive no error messages the code I use to test just returns an empty list. and I don't know how to trouble shoot it the module code is here http://pastebin.com/iTibRs1R and the code I am using to t

Re: Python "why" questions

2010-08-19 Thread Neil Cerutti
On 2010-08-19, J.B. Brown wrote: > When I wrote my own C++ 2-D matrix class, I wrote a member > function which did exactly this - allow you to specify the > initial index value. Then users of my class (mainly my research > lab coworkers) could specify whichever behavior they wanted. I did somethi

Re: bug? context managers vs ImportErrors

2010-08-19 Thread Steven D'Aprano
On Thu, 19 Aug 2010 16:58:30 +0100, Chris Withers wrote: > Hi All, > > Am I right in thinking this is a bug: > > class MyContextManager: > > def __enter__(self): > pass > > def __exit__(self,t,e,tb): > print type(t),t > print type(e),e > > > with MyContex

Re: Contains/equals

2010-08-19 Thread Steven D'Aprano
On Thu, 19 Aug 2010 11:00:03 -0400, Alex Hall wrote: > def __eq__(self, obj): > if self.a==obj.a and self.b==obj.b: return True > return False That would be the same as: def __eq__(self, obj): return self.a==obj.a and self.b==obj.b -- Steven -- http://mail.python.org/mailman/l

Re: bug? context managers vs ImportErrors

2010-08-19 Thread Ethan Furman
Chris Withers wrote: Hi All, Am I right in thinking this is a bug: class MyContextManager: def __enter__(self): pass def __exit__(self,t,e,tb): print type(t),t print type(e),e with MyContextManager(): import foo.bar.baz ...when executed, gives me: No

Re: Python "why" questions

2010-08-19 Thread Russ P.
On Aug 19, 9:07 am, "J.B. Brown" wrote: > 2010/8/9 MRAB : > > > Default User wrote: > > >> Not to prolong a good "food fight", but IIRC, many years ago in QBasic, > >> one could choose > > >> OPTION BASE 0 > > >> or > > >> OPTION BASE 1 > > When I wrote my own C++ 2-D matrix class, I wrote a membe

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Tue, 17 Aug 2010 19:15:54 -0700, Russ P. wrote: > The convention of starting with zero may have had some slight > performance advantage in the early days of computing, but the huge > potential for error that it introduced made it a poor choice in the long > run, at least for high-level language

Re: bug? context managers vs ImportErrors

2010-08-19 Thread Peter Otten
Ethan Furman wrote: > Chris Withers wrote: >> Hi All, >> >> Am I right in thinking this is a bug: >> >> class MyContextManager: >> >> def __enter__(self): >> pass >> >> def __exit__(self,t,e,tb): >> print type(t),t >> print type(e),e >> >> >> with MyContextMan

Django 1.2.1 - stuck with CSRF verification

2010-08-19 Thread Dodo
Hi all, I followed the tutorial but at page 4 I can't get rid of CSRF errors, even though I followed everything in this page : http://docs.djangoproject.com/en/dev/ref/contrib/csrf/ Any idea? Dorian -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-19 Thread Russ P.
On Aug 19, 11:04 am, Steven D'Aprano wrote: > On Tue, 17 Aug 2010 19:15:54 -0700, Russ P. wrote: > > The convention of starting with zero may have had some slight > > performance advantage in the early days of computing, but the huge > > potential for error that it introduced made it a poor choice

Re: bug? context managers vs ImportErrors

2010-08-19 Thread Ethan Furman
Peter Otten wrote: Ethan Furman wrote: As an aside, does anyone know why the 2.x versions are printing the [0] as the first line? 3.1 does not. If reading the error messages carefully doesn't help scroll down for a hint;) . > . > . Look into foo.py AH hahahahahahah. That's what I get f

Re: Python "why" questions

2010-08-19 Thread Russ P.
I just checked, and Mathematica uses one-based indexing. Apparently they want their notation to look mathematical. -- http://mail.python.org/mailman/listinfo/python-list

Re: Django 1.2.1 - stuck with CSRF verification

2010-08-19 Thread Thomas Jollans
On Thursday 19 August 2010, it occurred to Dodo to exclaim: > Hi all, > I followed the tutorial but at page 4 I can't get rid of CSRF errors, > even though I followed everything in this page : > http://docs.djangoproject.com/en/dev/ref/contrib/csrf/ > what kind of errors? Any exception tracebacks

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Thu, 19 Aug 2010 11:03:53 -0700, Russ P. wrote: > For those who insist that zero-based indexing is a good idea, why you > suppose mathematical vector/matrix notation has never used that > convention? I have studied and used linear algebra extensively, and I > have yet to see a single case of ve

Re: Creating a PYD file

2010-08-19 Thread Thomas Jollans
On Thursday 19 August 2010, it occurred to Rony to exclaim: > Is a PYD file created from Pyrex faster in execution then a PYD file > created from python source ? How do you plan to create an extension module (*.so, *.pyd on Windows) from Python source then? -- http://mail.python.org/mailman/list

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Thu, 19 Aug 2010 11:39:05 -0700, Russ P. wrote: > I just checked, and Mathematica uses one-based indexing. Apparently they > want their notation to look mathematical. Well duh. It's called MATHematica, not PROGematica. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: String substitution VS proper mysql escaping

2010-08-19 Thread Nik Gr
Στις 19/8/2010 6:58 μμ, ο/η Tim Chase έγραψε: It can be written as a non-3-quote string, you just have to escape the inner quotes (single & double) and the backslash to be seen: name = 'My name is "Nikos" and I\'m from Thessaloniki\\Greece' name = "My name is \"Nikos\" and I'm from Thessal

Re: Contains/equals

2010-08-19 Thread Tim Chase
On 08/19/10 12:42, Steven D'Aprano wrote: On Thu, 19 Aug 2010 11:00:03 -0400, Alex Hall wrote: def __eq__(self, obj): if self.a==obj.a and self.b==obj.b: return True return False That would be the same as: def __eq__(self, obj): return self.a==obj.a and self.b==obj.b Or,

Re: Reading the access attributes of directories in Windows

2010-08-19 Thread Tim Golden
On 19/08/2010 4:55 PM, vsoler wrote: I need to read, for each of the directories in a shared file server unit, who has access to the directories and what type of access privileges. This is something that I can easily do interactively in my Windows Document Explorer by right clicking a single dir

Re: Python "why" questions

2010-08-19 Thread Russ P.
On Aug 19, 11:42 am, Steven D'Aprano wrote: > On Thu, 19 Aug 2010 11:03:53 -0700, Russ P. wrote: > > For those who insist that zero-based indexing is a good idea, why you > > suppose mathematical vector/matrix notation has never used that > > convention? I have studied and used linear algebra exte

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Thu, 19 Aug 2010 11:27:18 -0700, Russ P. wrote: [...] >> Zero-based counting doesn't entirely eliminate off-by-one errors, but >> the combination of that plus half-open on the right intervals reduces >> them as much as possible. >> >> The intuitive one-based closed interval notation used in man

Re: Python "why" questions

2010-08-19 Thread Russ P.
Yes, apparently Basic uses one-based indexing too. As for Ada, apparently, the programmer needs to explicitly define the index range for every array. Weird. But I get the impression that one- based indexing is used much more than zero-based indexing. -- http://mail.python.org/mailman/listinfo/pyt

Re: Python "why" questions

2010-08-19 Thread AK
On 08/19/2010 02:04 PM, Steven D'Aprano wrote: On Tue, 17 Aug 2010 19:15:54 -0700, Russ P. wrote: The convention of starting with zero may have had some slight performance advantage in the early days of computing, but the huge potential for error that it introduced made it a poor choice in the

Re: Contains/equals

2010-08-19 Thread Christian Heimes
Am 19.08.2010 20:53, schrieb Tim Chase: > On 08/19/10 12:42, Steven D'Aprano wrote: >> On Thu, 19 Aug 2010 11:00:03 -0400, Alex Hall wrote: >> >>> def __eq__(self, obj): >>>if self.a==obj.a and self.b==obj.b: return True >>>return False >> >> That would be the same as: >> >> def __eq_

Re: Python "why" questions

2010-08-19 Thread Russ P.
On Aug 19, 12:13 pm, Steven D'Aprano While businesses are conservative in which languages they choose, > language designers are not conservative in the design features they come > up with. That there has been a gradual (although as yet incomplete) > convergence towards zero-based indexing in langu

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Thu, 19 Aug 2010 11:57:53 -0700, Russ P. wrote: > I don't > know where zero-based indexing started, but I know that C used it very > early, probably for some minuscule performance advantage. In C, zero based indexing was used because it made pointer arithmetic elegant and reduced bugs. > Wh

Re: Python "why" questions

2010-08-19 Thread MRAB
Russ P. wrote: On Aug 19, 11:42 am, Steven D'Aprano wrote: On Thu, 19 Aug 2010 11:03:53 -0700, Russ P. wrote: For those who insist that zero-based indexing is a good idea, why you suppose mathematical vector/matrix notation has never used that convention? I have studied and used linear algebra

Re: Creating a PYD file

2010-08-19 Thread Rony
Sorry that was a typo... The question actually is, is a PYD file created from C faster then a PYD file from Pyrex ? I know it will depend on how it is written, but let's imagine a tiny example, like (Pseudo code) result = arg1 + arg2 return result Tia Rony On 19 août, 20:47, Thomas Jollans

Re: String substitution VS proper mysql escaping

2010-08-19 Thread MRAB
Nik Gr wrote: [snip] Why does the page variable which is actually a string needs to be a tuple or a list and not just as a string which is what it actually is? I have a strong desire to use it like this: cursor.execute( '''SELECT hits FROM counters WHERE page = %s''' , page ) opposed to tuple.

Re: bug? context managers vs ImportErrors

2010-08-19 Thread Christian Heimes
> Why is 'e' ending up as a string rather than the ImportError object? > > This is with Python 2.6.5 if that makes a difference... It's a known bug in Python 2.6 and earlier. See http://docs.python.org/whatsnew/2.7.html#porting-to-python-2-7 Due to a bug in Python 2.6, the exc_value parameter to

Wing IDE 3.2.10 released

2010-08-19 Thread Wingware
Hi, Wingware has released version 3.2.10 of Wing IDE, an integrated development environment designed specifically for the Python programming language. This release includes the following improvements: * Several vi mode fixes and other key binding enhancements * Copy from selected text in Except

Re: Python "why" questions

2010-08-19 Thread MRAB
Russ P. wrote: Yes, apparently Basic uses one-based indexing too. For arrays, yes and no. Traditionally, DIM A(10) has 11 elements, starting at 0, although it might depend on the version of Basic. For strings, yes. As for Ada, apparently, the programmer needs to explicitly define the index r

tkinter

2010-08-19 Thread Eric J. Van der Velden
Hello, I have python2.7 .I have compiled tcl en tk and installed them in my home directory, say /home/eric/tcl and /home/eric/tk . I have edited $ vi Modules/Setup ... _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ -L/home/eric/tcl/lib \ -L/home/eric/tk/lib \ -I/home/eric/tcl/include \ -I/home/

Re: Python "why" questions

2010-08-19 Thread geremy condra
On Thu, Aug 19, 2010 at 12:32 PM, Steven D'Aprano wrote: > On Thu, 19 Aug 2010 11:57:53 -0700, Russ P. wrote: > >> I don't >> know where zero-based indexing started, but I know that C used it very >> early, probably for some minuscule performance advantage. > > In C, zero based indexing was used b

Re: Reading the access attributes of directories in Windows

2010-08-19 Thread vsoler
On Aug 19, 8:55 pm, Tim Golden wrote: > On 19/08/2010 4:55 PM, vsoler wrote: > > > I need to read, for each of the directories in a shared file server > > unit, who has access to the directories and what type of access > > privileges. > > > This is something that I can easily do interactively in m

Re: Django 1.2.1 - stuck with CSRF verification

2010-08-19 Thread Dodo
Le 19/08/2010 20:40, Thomas Jollans a écrit : On Thursday 19 August 2010, it occurred to Dodo to exclaim: Hi all, I followed the tutorial but at page 4 I can't get rid of CSRF errors, even though I followed everything in this page : http://docs.djangoproject.com/en/dev/ref/contrib/csrf/ what

Re: String substitution VS proper mysql escaping

2010-08-19 Thread John Nagle
On 8/18/2010 2:50 AM, Cameron Simpson wrote: On 18Aug2010 12:07, Nik Gr wrote: | Στις 18/8/2010 7:31 πμ, ο/η Cameron Simpson έγραψε: |>On 17Aug2010 20:15, Νίκος wrote: |>| === |>| cursor.execute( ''' SELECT host, hits, date FROM visitors WHERE page = |>| '%s' ORDER

Re: Creating a PYD file

2010-08-19 Thread Terry Reedy
On 8/19/2010 3:41 PM, Rony wrote: is a PYD file created from C faster then a PYD file from Pyrex ? Since a .pyd file from Pyrex is also from C, the question is ill-posed. It is equivalent to "Does the C code generated by Pyrex compile to faster or slower machine code than the C code generated

Re: Reading the access attributes of directories in Windows

2010-08-19 Thread Tim Golden
On 19/08/2010 9:17 PM, vsoler wrote: On Aug 19, 8:55 pm, Tim Golden wrote: On 19/08/2010 4:55 PM, vsoler wrote: I need to read, for each of the directories in a shared file server unit, who has access to the directories and what type of access privileges. This is something that I can easil

Iterative vs. Recursive coding

2010-08-19 Thread Baba
Level: Beginner exercise source: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset3.pdf I am looking at the first problem in the above assignment. The assignemnt deals, amongst others, with the i

Re: Reading the access attributes of directories in Windows

2010-08-19 Thread vsoler
On Aug 19, 10:59 pm, Tim Golden wrote: > On 19/08/2010 9:17 PM, vsoler wrote: > > > > > On Aug 19, 8:55 pm, Tim Golden  wrote: > >> On 19/08/2010 4:55 PM, vsoler wrote: > > >>> I need to read, for each of the directories in a shared file server > >>> unit, who has access to the directories and wha

Re: bug? context managers vs ImportErrors

2010-08-19 Thread Chris Withers
Christian Heimes wrote: Why is 'e' ending up as a string rather than the ImportError object? This is with Python 2.6.5 if that makes a difference... It's a known bug in Python 2.6 and earlier. See http://docs.python.org/whatsnew/2.7.html#porting-to-python-2-7 When was it introduced? I've be

Re: Reading the access attributes of directories in Windows

2010-08-19 Thread Emile van Sebille
On 8/19/2010 2:17 PM vsoler said... On Aug 19, 10:59 pm, Tim Golden wrote: I have a subversion branch for Python 3. If you have subversion access, try: http://winsys.googlecode.com/svn/branches/py3k and do the python setup.py install dance. If you can't get that working, let me know an

Re: bug? context managers vs ImportErrors

2010-08-19 Thread Benjamin Peterson
Chris Withers simplistix.co.uk> writes: > When was it introduced? It depends on how the exception was raised. -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterative vs. Recursive coding

2010-08-19 Thread Thomas Jollans
On Thursday 19 August 2010, it occurred to Baba to exclaim: > def countSubStringMatchRecursive(target,key): > counter=0 > fsi=0 #fsi=find string index > if len(key)==len(target): #base case > if key==target: >counter+=1 > elif len(key) while fsi

Re: Iterative vs. Recursive coding

2010-08-19 Thread MRAB
Baba wrote: Level: Beginner exercise source: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset3.pdf I am looking at the first problem in the above assignment. The assignemnt deals, amongst othe

Re: Iterative vs. Recursive coding

2010-08-19 Thread Daniel Kluev
On Fri, Aug 20, 2010 at 8:12 AM, Baba wrote: > Level: Beginner > > exercise source: > > http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset3.pdf > > I am looking at the first problem in the above a

Re: Creating a PYD file

2010-08-19 Thread Martin v. Loewis
> (Pseudo code) > > result = arg1 + arg2 > return result For this code, the manually-written version will most likely be faster than the Pyrex-generated one. This is, most likely, because the manually-written version will assume a specific data type for the arguments (e.g. int), which Pyrex will

Re: Iterative vs. Recursive coding

2010-08-19 Thread Martin Gregorie
On Thu, 19 Aug 2010 14:12:44 -0700, Baba wrote: > Level: Beginner > > exercise source: > http://ocw.mit.edu/courses/electrical-engineering-and-computer- science/6-00-introduction-to-computer-science-and-programming-fall-2008/ assignments/pset3.pdf > > I am looking at the first problem in the abo

Re: Reading the access attributes of directories in Windows

2010-08-19 Thread Thomas Jollans
On Thursday 19 August 2010, it occurred to Tim Golden to exclaim: > On 19/08/2010 4:55 PM, vsoler wrote: > > I've been looking in the "os" library, and found the "os.chmod" method > > but I am not sure that it is going to give me what I need. Should I > > also used library "stat"? > > No. Both of

Re: Iterative vs. Recursive coding

2010-08-19 Thread Dave Angel
Baba wrote: Level: Beginner exercise source: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset3.pdf I am looking at the first problem in the above assignment. The assignemnt deals, amongst oth

Re: path to data files

2010-08-19 Thread Nobody
On Thu, 19 Aug 2010 14:30:34 +0200, Alain Ketterlin wrote: >> If a python module requires a data file to run how would I reference >> this data file in the source in a way that does not depend on whether >> the module is installed system-wide, installed in $HOME/.local or is >> just placed in a di

Re: Iterative vs. Recursive coding

2010-08-19 Thread MRAB
Thomas Jollans wrote: [snip] "iterate": use a loop. and again. and again. and again. and again. and aga "recurse": consider. recurse. This is another good one: http://mytechquest.com/blog/wp-content/uploads/2010/05/From-a-Programming-Book.jpg The definition for recursion looks a lot li

Re: Reading the access attributes of directories in Windows

2010-08-19 Thread Nobody
On Fri, 20 Aug 2010 00:04:29 +0200, Thomas Jollans wrote: > This brings up an interesting, but probably quite complicated question: is it > reasonable to try to express Windows permissions using full POSIX ACLs > Do Windows NT permissions do anything more? Or, apart from the > "executable" bit,

  1   2   >