Re: [Tutor] problem with reading dns query

2011-07-02 Thread Steven D'Aprano
preetam shivaram wrote: I have got a very simple idea in mind that i want to try out. Say i have a browser, chrome for instance, and i want to search for the ip of the domain name, say `www.google.com`. I use windows 7 and i have set the dns lookup properties to manual and have given the address

Re: [Tutor] Blackjack Betting

2011-07-02 Thread Marc Tompkins
On Sat, Jul 2, 2011 at 4:47 PM, David Merrick wrote: > Each player needs to be able to bet > Traceback (most recent call last): > File "I:/Python/Python Source Code/chapter09/blackjackBetting.py", line > 204, in > main() > File "I:/Python/Python Source Code/chapter09/blackjackBetting.py

Re: [Tutor] Algorithm for sequence matching

2011-07-02 Thread Steven D'Aprano
ANKUR AGGARWAL wrote: Hey I am looking for an algo for the largest sequence search in the two list. Example : list a accepts some say 'm' numbers. list b accept says 'n' numbers. I want to look for the largest same sequence between the two list and then display it. I tried out but failed to do s

Re: [Tutor] problem reading script

2011-07-02 Thread R. Alan Monroe
> Suggestions for "a programmers font" gratefully received. DejaVu Sans Mono ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Blackjack Betting

2011-07-02 Thread David Merrick
Each player needs to be able to bet # Blackjack # From 1 to 7 players compete against a dealer import cards, games class BJ_Card(cards.Card): """ A Blackjack Card. """ ACE_VALUE = 1 @property def value(self): if self.is_face_up: v = BJ_Card.RANKS.index(self.r

Re: [Tutor] Algorithm for sequence matching

2011-07-02 Thread Walter Prins
Just to clarify further: On 2 July 2011 23:46, Walter Prins wrote: > On 2 July 2011 21:30, ANKUR AGGARWAL wrote: > >> Example : list a accepts some say 'm' numbers. list b accept says 'n' >> numbers. I want to look for the largest same sequence between the two list >> and then display it. I tri

Re: [Tutor] Algorithm for sequence matching

2011-07-02 Thread Walter Prins
Hi Ankur, On 2 July 2011 21:30, ANKUR AGGARWAL wrote: > Hey > I am looking for an algo for the largest sequence search in the two list. > > Example : list a accepts some say 'm' numbers. list b accept says 'n' > numbers. I want to look for the largest same sequence between the two list > and the

Re: [Tutor] Algorithm for sequence matching

2011-07-02 Thread Peter Otten
ANKUR AGGARWAL wrote: > Hey > I am looking for an algo for the largest sequence search in the two list. > > Example : list a accepts some say 'm' numbers. list b accept says 'n' > numbers. I want to look for the largest same sequence between the two list > and then display it. I tried out but fai

Re: [Tutor] Algorithm for sequence matching

2011-07-02 Thread Walter Prins
Forwarding back to list. -- Forwarded message -- From: ANKUR AGGARWAL Date: 2 July 2011 22:23 Subject: Re: [Tutor] Algorithm for sequence matching To: Walter Prins ya sorry I forgot to include 11 . i want the answer to be [11,23,45,21] On Sun, Jul 3, 2011 at 2:46 AM, Walter Prins

Re: [Tutor] Algorithm for sequence matching

2011-07-02 Thread Walter Prins
Hi Ankur, On 2 July 2011 21:30, ANKUR AGGARWAL wrote: > Hey > I am looking for an algo for the largest sequence search in the two list. > > Example : list a accepts some say 'm' numbers. list b accept says 'n' > numbers. I want to look for the largest same sequence between the two list > and the

Re: [Tutor] Algorithm for sequence matching

2011-07-02 Thread bob gailer
On 7/2/2011 4:30 PM, ANKUR AGGARWAL wrote: Hey I am looking for an algo for the largest sequence search in the two list. Example : list a accepts some say 'm' numbers. list b accept says 'n' numbers. I want to look for the largest same sequence between the two list and then display it. I tried

[Tutor] Algorithm for sequence matching

2011-07-02 Thread ANKUR AGGARWAL
Hey I am looking for an algo for the largest sequence search in the two list. Example : list a accepts some say 'm' numbers. list b accept says 'n' numbers. I want to look for the largest same sequence between the two list and then display it. I tried out but failed to do so. Say A=[11,23,45,21,63

Re: [Tutor] Cython question

2011-07-02 Thread Stefan Behnel
Alan Gauld, 02.07.2011 15:28: "Albert-Jan Roskam" wrote I used cProfile to find the bottlenecks, the two Python functions getValueChar and getValueNum. These two Python functions simply call two equivalent C functions in a .dll (using ctypes). The code is currently declared as Windows-only and

Re: [Tutor] problem with reading dns query

2011-07-02 Thread Alan Gauld
"preetam shivaram" wrote browser, chrome for instance, and i want to search for the ip of the domain name, say `www.google.com`. I'm curious why you would want to? Given the volatility of IP addresses in the modern network I'm not sure what good it would do you? (as opposed to doing it ma

Re: [Tutor] Cython question

2011-07-02 Thread Alan Gauld
"Albert-Jan Roskam" wrote I used cProfile to find the bottlenecks, the two Python functions getValueChar and getValueNum. These two Python functions simply call two equivalent C functions in a .dll (using ctypes). In that case cythin will speed up the calling loops but it can't do anythin

[Tutor] problem with reading dns query

2011-07-02 Thread preetam shivaram
I have got a very simple idea in mind that i want to try out. Say i have a browser, chrome for instance, and i want to search for the ip of the domain name, say `www.google.com`. I use windows 7 and i have set the dns lookup properties to manual and have given the address `127.0.0.1` where my serve

Re: [Tutor] Cython question

2011-07-02 Thread Albert-Jan Roskam
Hi Stefan, Alan, Matt, Thanks for your replies. I used cProfile to find the bottlenecks, the two Python functions getValueChar and getValueNum. These two Python functions simply call two equivalent C functions in a .dll (using ctypes). The problem is that these functions are called as many ti

Re: [Tutor] Blackjack problem

2011-07-02 Thread Walter Prins
Hi David (and Vincent, as I think you may be interested in this as well), On 2 July 2011 03:11, David Merrick wrote: > # Blackjack > # From 1 to 7 players compete against a dealer > I came accross this book ( http://homepage.mac.com/s_lott/books/oodesign/build-python/html/index.html ) on the in

Re: [Tutor] Cython question

2011-07-02 Thread Alan Gauld
"Albert-Jan Roskam" wrote As far as I understood it requires the functions to be re-written in a Python-like langauge, 'minus the memory manager'. Thats what I understand too, but I've only read the web docs :-) converted to C and subsequently compiled to a .dll or .so file. The original p

Re: [Tutor] Cython question

2011-07-02 Thread Stefan Behnel
Albert-Jan Roskam, 02.07.2011 11:49: Some time ago I finished a sav reader for Spss .sav data files (also with the help of some of you!): http://code.activestate.com/recipes/577650-python-reader-for-spss-sav-files/ It works fine, but it is not fast with big files. I am thinking of implementing t

[Tutor] Cython question

2011-07-02 Thread Albert-Jan Roskam
Hi, Some time ago I finished a sav reader for Spss .sav data files (also with the help of some of you!): http://code.activestate.com/recipes/577650-python-reader-for-spss-sav-files/ It works fine, but it is not fast with big files. I am thinking of implementing two of the functions in cython (g

[Tutor] Blackjack 2 - was Re: (no subject)

2011-07-02 Thread Alan Gauld
Please provide a meaningful subject! "David Merrick" wrote ># Blackjack class BJ_Game(object): """ A Blackjack Game. """ def __init__(self, names): self.players = [] for name in names: player = BJ_Player(name) self.players.append(player) self.d

Re: [Tutor] (no subject)

2011-07-02 Thread Marc Tompkins
On Fri, Jul 1, 2011 at 7:11 PM, David Merrick wrote: > NameError: global name 'stash' is not defined > > There are a _lot_ of missing pieces here; I think you started writing code without a plan of how your game would actually run. The current error is only the first you're going to run into her

Re: [Tutor] Limit raw_input to hundredth decimal point

2011-07-02 Thread Ryan Kirk
Thanks all! This helps a lot. On Jul 1, 2011, at 6:13 AM, Steven D'Aprano wrote: > Ryan Kirk wrote: >> Is there a way to limit raw_input to the hundredth decimal point? > > No. raw_input is a tool that does one thing: it collects input from the user. > It doesn't understand numbers, check for d