Re: [Tutor] path to use for setting the environment variable PYTHONDOCS?

2007-03-06 Thread Dick Moores
At 02:41 PM 3/6/2007, Alan Gauld wrote: >"Dick Moores" <[EMAIL PROTECTED]> wrote > > > Sorry, topic and keyword documentation is not available because the > > Python > > HTML documentation files could not be found. If you have installed > > them, > > please set the environment variable PYTHONDOCS

Re: [Tutor] Yet another list comprehension question

2007-03-06 Thread Kent Johnson
Kent Johnson wrote: > This is a popular question. It comes up frequently on comp.lang.python > and there are many recipes in the online cookbook. Here is a good starting point if you want to see a variety of ways to uniquify (?) sequences: http://tinyurl.com/3cqnj5 Make sure you look at the ref

Re: [Tutor] sorting question

2007-03-06 Thread Kent Johnson
Rob Andrews wrote: > I'm trying to think of the best way to go about this one, as the files > I have to sort are *big*. > > They're ASCII files with each row consisting of a series of > fixed-length fields, each of which has a corresponding format file. > (To be specific, these files are FirstLogi

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread Bob Gailer
David Perlman wrote: > On Mar 6, 2007, at 4:28 PM, wesley chun wrote: > > >>> >>> x=('i' in 'i') >>> >>> x >>> True >>> >>> y='i' >>> >>> x==y >>> False >>> >> you're right when you talk about "casting" altho that's not what >> python does. it merely performs an object value comparis

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread Kent Johnson
David Perlman wrote: > This helps convince me that I still don't understand why the original > code snippet worked at all. :) > > These code examples make perfect sense. This one doesn't, and > appears to be an inconsistency: > > >>> word2 = 'hello' > >>> item = 'e' > >>> item in word2 >

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread David Perlman
I think it's a little strange and possibly problematic that type(1) is 'int' and type(True) is 'bool' but 1 == True specifically evaluates to True even though anything else, even if it evaluates to True when cast as a boolean, is not == True. >>> 1 == True True >>> 2 == True False >>> 0 ==

Re: [Tutor] sorting question

2007-03-06 Thread John Fouhy
On 07/03/07, Rob Andrews <[EMAIL PROTECTED]> wrote: > I'm trying to think of the best way to go about this one, as the files > I have to sort are *big*. [...] > I haven't yet figured out a way to apply sort() to this problem, > although I'm certain the failing is my own. To use sort(), you'll have

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread John Fouhy
On 07/03/07, David Perlman <[EMAIL PROTECTED]> wrote: > On Mar 6, 2007, at 11:03 AM, Alan Gauld wrote: > > It's doing the latter and since anything that's not 'empty' in > > Python evaluates to true we wind up checking whether > > true == (item in word) > > > > So if the item is in word we get true

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread David Perlman
On Mar 6, 2007, at 4:28 PM, wesley chun wrote: >> >>> x=('i' in 'i') >> >>> x >> True >> >>> y='i' >> >>> x==y >> False > > you're right when you talk about "casting" altho that's not what > python does. it merely performs an object value comparison when you > use '=='. for example, change

Re: [Tutor] path to use for setting the environment variable PYTHONDOCS?

2007-03-06 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > Sorry, topic and keyword documentation is not available because the > Python > HTML documentation files could not be found. If you have installed > them, > please set the environment variable PYTHONDOCS to indicate their > location. >

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread Alan Gauld
"David Perlman" <[EMAIL PROTECTED]> wrote > Sorry, but this still doesn't make sense to me. > >>> x=('i' in 'i') >>> x True >>> y='i' >>> x==y False > But the == operator doesn't cast its operands as Booleans; Good catch! I don't understand it now either. But I've been up since 4:30am and

[Tutor] sorting question

2007-03-06 Thread Rob Andrews
I'm trying to think of the best way to go about this one, as the files I have to sort are *big*. They're ASCII files with each row consisting of a series of fixed-length fields, each of which has a corresponding format file. (To be specific, these files are FirstLogic compatible.) I'm looking to

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread wesley chun
> >>> x=('i' in 'i') > >>> x > True > >>> y='i' > >>> x==y > False you're right when you talk about "casting" altho that's not what python does. it merely performs an object value comparison when you use '=='. for example, change your code above to: >>> True == 'i'# because this is what

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread David Perlman
On Mar 6, 2007, at 11:03 AM, Alan Gauld wrote: > It's doing the latter and since anything that's not 'empty' in > Python evaluates to true we wind up checking whether > true == (item in word) > > So if the item is in word we get true == true which is true. > > HTH, Sorry, but this still doesn't ma

[Tutor] path to use for setting the environment variable PYTHONDOCS?

2007-03-06 Thread Dick Moores
=== >>>help('assert') Sorry, topic and keyword documentation is not available because the Python HTML documentation files could not be found. If you have installed them, please set the environment variable PYTHONDOCS to indicate their location. ===

Re: [Tutor] What/Why this Cookbook recipe?

2007-03-06 Thread Luke Paireepinart
Andrei wrote: > Dick Moores wrote: > >> I've been trying to learn new things from the Cookbook, but here's a >> recipe the utility of which I don't understand at all. Why interpolation >> (whether the ruby way or not)? Maybe a better example than the couple >> given would help me? >> >

Re: [Tutor] executing a string representing python code

2007-03-06 Thread Cecilia Alm
Thanks, Alan. I really appreciate the discussion. --C 2007/3/6, ALAN GAULD <[EMAIL PROTECTED]>: > Hm, I'm not sure I see your point. Could an evil hacker not just > as easily change the dictionary in the python code > (or somewhere else in the code) to perform such evil operations? If they ha

Re: [Tutor] executing a string representing python code

2007-03-06 Thread ALAN GAULD
> Hm, I'm not sure I see your point. Could an evil hacker not just > as easily change the dictionary in the python code > (or somewhere else in the code) to perform such evil operations? If they have access to the source code you are right of course. But typically the source will be in a secure

Re: [Tutor] What/Why this Cookbook recipe?

2007-03-06 Thread Andrei
Dick Moores wrote: > I've been trying to learn new things from the Cookbook, but here's a > recipe the utility of which I don't understand at all. Why interpolation > (whether the ruby way or not)? Maybe a better example than the couple > given would help me? Normal string formatting in Pytho

Re: [Tutor] executing a string representing python code

2007-03-06 Thread Luke Paireepinart
Cecilia Alm wrote: > Hm, I'm not sure I see your point. Could an evil hacker not just as > easily change the dictionary in the python code (or somewhere else in > the code) to perform such evil operations? Not too easily, if the code were distributed as .pycs. However, running code you read in

Re: [Tutor] executing a string representing python code

2007-03-06 Thread Cecilia Alm
Hm, I'm not sure I see your point. Could an evil hacker not just as easily change the dictionary in the python code (or somewhere else in the code) to perform such evil operations? --C 2007/3/5, ALAN GAULD <[EMAIL PROTECTED]>: > That's neat. When just the function call is the string, > eval()

[Tutor] What/Why this Cookbook recipe?

2007-03-06 Thread Dick Moores
I've been trying to learn new things from the Cookbook, but here's a recipe the utility of which I don't understand at all. Why interpolation (whether the ruby way or not)? Maybe a better example than the couple given would help me?  The description is "Interpolate variables and expressions in s

Re: [Tutor] PYTHON MOBILE WEB DEVELOPMENT

2007-03-06 Thread Alan Gauld
"OkaMthembo" <[EMAIL PROTECTED]> wrote > I am keen to find out if there are any frameworks > for Python mobile web development out there. If you mean WAP applications then so far as I'm aware there is nothing different at the server end except they serve up some specific XML style documents

Re: [Tutor] trouble with function-- trying to check differencesbtwn 2 strings

2007-03-06 Thread Alan Gauld
"zannah marsh" <[EMAIL PROTECTED]> wrote > rikart pointed out that you need to use a range to get to the > indicies of > the items in the string. > > for item in range(len(string))... > if word1[item] == word2[item] > There is another way which is to use enumerate which returns both the item

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread Luke Paireepinart
zannah marsh wrote: > what I was trying to do with that loop is check each character in the > string against the corresponding character at the same position in the > second string. rikart pointed out that my loop was actually checking > if that character exists anywhere in the second string. [s

[Tutor] Python Mobile Web Development

2007-03-06 Thread OkaMthembo
Hello All, I am keen to find out if there are any frameworks for Python mobile web development out there. Does anyone know of a major/popular mobile web app written in python? Moreover, if i wrote a mobile web app with standard HTML for presentation and Python as a server-side language, would the

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread zannah marsh
what I was trying to do with that loop is check each character in the string against the corresponding character at the same position in the second string. rikart pointed out that my loop was actually checking if that character exists anywhere in the second string. basically, in pseudocode: for t

Re: [Tutor] installers and more

2007-03-06 Thread Kirk Bailey
OK, so now I need to pick a freeware installer to bundle it all up and install it real easy for the non technical minded, and fire off the python self installer I include with it. So let's refine this tread to INSTALLER discussion. Recomendations, comments, criticisms, links to webpages, etc.

[Tutor] PYTHON MOBILE WEB DEVELOPMENT

2007-03-06 Thread OkaMthembo
Hello All, I am keen to find out if there are any frameworks for Python mobile web development out there. Does anyone know of a major/popular mobile web app written in python? Moreover, if i wrote a mobile web app with standard HTML for presentation and Python as a server-side language, would the

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread Alan Gauld
"David Perlman" <[EMAIL PROTECTED]> wrote > I can't figure out how this would ever work at all. It seems like > it's either checking to see whether boolean TRUE is in word2, or > else > it's checking to see whether item is equal to boolean TRUE or FALSE, > and neither of those should ever be tr

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread Luke Paireepinart
David Perlman wrote: > OK, I'm new to python too so I don't assume I know what I'm talking > about yet, but this looks like a mess to me. What exactly does "item > == item in word2" evaluate to? Does "in" or "==" have higher > precedence? > > I can't figure out how this would ever work at a

Re: [Tutor] trouble with function-- trying to check differences btwn 2 strings

2007-03-06 Thread David Perlman
OK, I'm new to python too so I don't assume I know what I'm talking about yet, but this looks like a mess to me. What exactly does "item == item in word2" evaluate to? Does "in" or "==" have higher precedence? I can't figure out how this would ever work at all. It seems like it's either

Re: [Tutor] installers and more

2007-03-06 Thread Kent Johnson
Kirk Bailey wrote: > 2. It takes python being in the laptop so it can be used. As I do not > own it, I hesitate to bundle it in. What's the legal aspect of providing > the language the app needs so it will run? This is not a problem, you can distribute a package that includes Python. http://www.