Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Khamid Nurdiev
I guess i will start out with your tutorial, hope it won't get as difficult as the previous one :-) thanks On 8/14/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > > "Khamid Nurdiev" <[EMAIL PROTECTED]> wrote > > > This book by M. Zelle is getting really difficult shortly > > after that section > >

Re: [Tutor] Python Book Recommendations [Was:[Re: Security]]

2007-08-13 Thread Khamid Nurdiev
I see it now, thanks for the detailed explanation. On 8/14/07, wesley chun <[EMAIL PROTECTED]> wrote: > > > > Having heard > > > the recommendations on books for beginners i have ordered the book > "Core > > > Python Programming" by Wesley Chun, so comparing those two books which > one > > > is mo

Re: [Tutor] Python Book Recommendations [Was:[Re: Security]]

2007-08-13 Thread Khamid Nurdiev
This was really helpful. My message was sent just to find the book exactly like Alan's "Tutor" for the start. And can proceed to other books after it. Programming isn't for everyone! Until you find out whether or not > > it's for you, don't spend hundreds and thousands of dollars on > > computer p

Re: [Tutor] Python Book Recommendations [Was:[Re: Security]]

2007-08-13 Thread Dick Moores
At 01:17 PM 8/13/2007, bhaaluu wrote: >Finally, if you do find a computer programming book that you >think is the Philosopher's Stone, and you can't live without it, >check all the used-book stores that sell online at: > >http://used.addall.com Better, IMO, is BestBookDeal.com

Re: [Tutor] Python Book Recommendations [Was:[Re: Security]]

2007-08-13 Thread wesley chun
> > Having heard > > the recommendations on books for beginners i have ordered the book "Core > > Python Programming" by Wesley Chun, so comparing those two books which one > > is more suitable (recommended) for a beginner to both python and > > programming? if you are new to programming, then pe

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread wesley chun
> > The original poster posted a post with the following function: > > def dec(): > > import string > > message=raw_input("Enter the message to decode: ") > > result='' > > for x in string.split(message): > > result=result+chr(

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Tiger12506
> On Monday 13 August 2007 22:39, Tiger12506 wrote: >> > foo = raw_input(...) >> > x = eval(foo) >> > > ... >> Let your program run on your machine and I'll walk by, type in this >> string, >> and hit enter. We'll see how much of an exception it is when you can't >> boot >> your XP machine anymor

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Michael Sparks
On Monday 13 August 2007 22:39, Tiger12506 wrote: > > foo = raw_input(...) > > x = eval(foo) > > ... > Let your program run on your machine and I'll walk by, type in this string, > and hit enter. We'll see how much of an exception it is when you can't boot > your XP machine anymore. > ;-) Who care

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Alan Gauld
"Khamid Nurdiev" <[EMAIL PROTECTED]> wrote > This book by M. Zelle is getting really difficult shortly > after that section I can't comment on the specific book but unfortunately its a common phenomenon that "beginner" books start of easy then suddenly get much harder. This is partly because it

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Terry Carroll
On Mon, 13 Aug 2007, Alan Gauld wrote: > eval() > exec() > execfile() > input() Two of my favorite things about Python 3000 will be having input() go away and fixing integer division. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mai

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Michael Sparks
On Monday 13 August 2007 21:53, Kent Johnson wrote: > Hmm...could be a remote connection such as ssh, which precludes the > sledgehammer though probably not the sort of mischief you can get into > with eval()...perhaps there are untrusted remote connections where > eval() would still be a significa

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Luke Paireepinart
Khamid Nurdiev wrote: > It is Good that you have the book because i have a few questions > concerning the books again. This book by M. Zelle is getting really > difficult shortly after that section (also as i see the examples are > getting fewer) but it was easy till that part, so the question i

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Kent Johnson
Michael Sparks wrote: >> Anything where user input is executed as code is a security hole and >> should never be opened to untrusted users. > > foo = raw_input(...) > x = eval(foo) > > Is an exception, in almost[*] every scenario I can think of. (and is the > context eval was being used as far a

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Tiger12506
> foo = raw_input(...) > x = eval(foo) > > Is an exception, in almost[*] every scenario I can think of. (and is the > context eval was being used as far as I can see without reading the whole > thread) > > [*] One scenario that seems unlikely but possible is a scenario where a > machine has

[Tutor] Python Book Recommendations [Was:[Re: Security]]

2007-08-13 Thread bhaaluu
Greetings, The only Python Books I have are the ones that are freely available for download from the Internet. Here is the list: Learning to Program (by Alan Gauld - a Tutor on this list.) http://www.freenetpages.co.uk/hp/alan.gauld/index.htm This book is also available for purchase in dead-tree

Re: [Tutor] Finding a row match within a numpy array

2007-08-13 Thread bob gailer
bob gailer wrote: > Andy Cheesman wrote: > >> Dear nice people >> >> I'm trying to match a row (b) within a large numpy array (a). My most >> successful attempt is below >> >> hit = equal(b, a) >> total_hits = add.reduce(hit, 1) >> max_hit = argmax(total_hits, 0) >> answer = a[max_hit] >> >> whe

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Khamid Nurdiev
It is Good that you have the book because i have a few questions concerning the books again. This book by M. Zelle is getting really difficult shortly after that section (also as i see the examples are getting fewer) but it was easy till that part, so the question is: is it to me or is the rest of

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Alan Gauld
"bhaaluu" <[EMAIL PROTECTED]> wrote > Now for MY question: Besides eval(), are there other functions that > should be 'red-flagged' as well? Pretty much anything that can execute user entered code is a potential security problem. The most common are probably: eval() exec() execfile() input()

Re: [Tutor] Finding a row match within a numpy array

2007-08-13 Thread Alan Gauld
"Andy Cheesman" <[EMAIL PROTECTED]> wrote > I'm trying to match a row (b) within a large numpy array (a). My > most > successful attempt is below I'm nonumpy expert but... > hit = equal(b, a) > total_hits = add.reduce(hit, 1) > max_hit = argmax(total_hits, 0) > answer = a[max_hit] Where are a

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Michael Sparks
On Monday 13 August 2007 15:28, Kent Johnson wrote: > > The original poster posted a post with the following function: ... > > message=raw_input("Enter the message to decode: ") > > result='' > > for x in string.split(message): > > result=result+c

Re: [Tutor] Finding a row match within a numpy array

2007-08-13 Thread bob gailer
Andy Cheesman wrote: > Dear nice people > > I'm trying to match a row (b) within a large numpy array (a). My most > successful attempt is below > > hit = equal(b, a) > total_hits = add.reduce(hit, 1) > max_hit = argmax(total_hits, 0) > answer = a[max_hit] > > where ... > a = array([[ 0, 1, 2, 3]

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread Kent Johnson
bhaaluu wrote: > The original poster posted a post with the following function: > def dec(): > import string > message=raw_input("Enter the message to decode: ") > result='' > for x in string.split(message): > result=result+ch

Re: [Tutor] weird socket errors on linux with asyncore

2007-08-13 Thread Kent Johnson
Lawrence Wang wrote: > apologies if this doesn't belong on tutor. > > i have a long-running script that manages a bunch of sockets with > asyncore, opening 600 connections every 30 seconds for short > transactions, and every now and then (like anywhere from twice an hour > to once every few hou

Re: [Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread bhaaluu
Greetings, Although it is considered bad form to answer one's own post, I'm going to do so anyway, anyhow, http://docs.python.org/lib/built-in-funcs.html It turns out that both eval() and int() are Python interpreter built-ins. Now I really wonder why the author of the book used eval() rather th

[Tutor] Security [Was: Re: Decoding]

2007-08-13 Thread bhaaluu
Greetings, On 8/12/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > bhaaluu wrote: > > > print chr(eval('65')) > > A > > There is no need to use eval() here. Since the expected values are > integers, just use int(): > In [6]: chr(int('65')) > Out[6]: 'A' > > This gives a clearer error message wh

[Tutor] Finding a row match within a numpy array

2007-08-13 Thread Andy Cheesman
Dear nice people I'm trying to match a row (b) within a large numpy array (a). My most successful attempt is below hit = equal(b, a) total_hits = add.reduce(hit, 1) max_hit = argmax(total_hits, 0) answer = a[max_hit] where ... a = array([[ 0, 1, 2, 3], [ 4, 5, 6, 7],

Re: [Tutor] LosingtheexpressivenessofC'sfor-statement?/RESENDwithexample

2007-08-13 Thread Stephen McInerney
I didn't suggest embedding C-specific stuff in the documentation; I merely said the current tutorial is deficient on this topic; this is more so important since the language is currently a moving target (as the comments about the increasing power of list comprehensions prove my point. Many Pyt