[Tutor] Baccarat code check.

2011-12-16 Thread col speed
If anyone has the time, please have a look at the attached text file and let me know any comments on how to improve it. Thanks a lot Col #!usr/bin/env python # title - baccarat2.py import random class Player(object): """simple Player object that keeps tabs on bets and kitty""" def

Re: [Tutor] timeit() help

2011-12-16 Thread Steven D'Aprano
Robert Sjoblom wrote: So, it turns out that my ISP blocked Project Euler, so instead of working on my next problem, I polished Problem 4 a bit: Your ISP blocked Project Euler More likely the site is just temporarily down, but if you're right, what on earth would they block Project Euler f

Re: [Tutor] modify values for object derived from datetime.datetime

2011-12-16 Thread Steven D'Aprano
rail shafigulin wrote: i writing some code to do device testing at my work. testing is related to date and time, so naturally i decided to create a class that inherits from datetime.datetime. main reason is that i need to add, subtract and compare datetime objects and datetime.datetime allows me

Re: [Tutor] Tutor Digest, Vol 94, Issue 58

2011-12-16 Thread Calle
Message: 1 Date: Thu, 15 Dec 2011 23:37:49 +0100 From: "Calle" To: "Robert Sjoblom" Cc: tutor@python.org Subject: Re: [Tutor] [TUTOR]Code Deciphering Message-ID: Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original -Ursprungligt meddelande- From: Robert S

Re: [Tutor] modify values for object derived from datetime.datetime

2011-12-16 Thread rail shafigulin
On Fri, Dec 16, 2011 at 5:26 AM, Steven D'Aprano wrote: > rail shafigulin wrote: > >> i writing some code to do device testing at my work. testing is related to >> date and time, so naturally i decided to create a class that inherits from >> datetime.datetime. main reason is that i need to add, su

Re: [Tutor] Tutor Digest, Vol 94, Issue 58

2011-12-16 Thread Steven D'Aprano
Calle wrote: Message: 1 Date: Thu, 15 Dec 2011 23:37:49 +0100 From: "Calle" [...] I'm sorry, it is too hard for me to work out which parts are your comments, and which are quotations from older emails in the Digest. Please do not reply to multiple messages in a digest at once: each reply t

Re: [Tutor] Baccarat code check.

2011-12-16 Thread Prasad, Ramit
> If anyone has the time, please have a look at the attached text file and let > me know any comments on how to improve it. Not everyone on this list gets attachments. You are usually better off including short code in the email or a pastebin link. Ramit Ramit Prasad | JPMorgan Chase Investme

[Tutor] sqlite3: turning on foreign key support thru python

2011-12-16 Thread Monte Milanuk
I'm setting up an sqlite3 database to use as a base for some programming stuff I want to work on. Currently using python 2.7, which appears to have a new enough version of sqlite (just barely) to support foreign keys. As I understand things, sqlite by default has foreign keys turned off, unless s

Re: [Tutor] sqlite3: turning on foreign key support thru python

2011-12-16 Thread Modulok
>> How do I tell if it succeeded (short of trying an operation that should be >> blocked by foreign keys)? How do I use that cursor object returned by the >> pragma query to tell if its a '1' (on) or a '0' (off) and verify the state? The cursor object contains the result set. It's a python gener

Re: [Tutor] sqlite3: turning on foreign key support thru python

2011-12-16 Thread Monte Milanuk
That helped immensely... I was trying some different things trying to get at the results, but it never occurred to me to try iterating over it. The bit about some objects being iterable and some not is good to know! Thanks, Monte On Fri, Dec 16, 2011 at 11:43 AM, Modulok wrote: > >> How do I

Re: [Tutor] [TUTOR]Code Deciphering(Re-sent)

2011-12-16 Thread Calle
On 15 December 2011 23:37, Calle wrote: I was wondering, how do you use Python to decipher codes? It feels like it should be pretty simple, but I haven't found any tutorials about it yet. What kind of codes? Or do you mean ciphers? Generally speaking, a code represent letters or numbers in

[Tutor] reset password program

2011-12-16 Thread ADRIAN KELLY
Hi guys, i created a program that allows users to login using a password that i set at the top of the program. Among other things users are given the option to change their password. My questions is; Is it possible for me to make this new password stick, in other words when they shut down

Re: [Tutor] reset password program

2011-12-16 Thread Dave Angel
On 12/16/2011 05:02 PM, ADRIAN KELLY wrote: Hi guys, i created a program that allows users to login using a password that i set at the top of the program. Among other things users are given the option to change their password. My questions is; Is it possible for me to make this new password s

Re: [Tutor] reset password program

2011-12-16 Thread ADRIAN KELLY
thanks dave, just tried writing to file for the first time def main(): outfile.write('Hello this is a test') outfile.close() main() error, globalname outfile is not defined, do i need to import function to get this working? > Date: Fri, 16 Dec 2011 17:13:04 -0500 > From: d...@davea.name

Re: [Tutor] reset password program

2011-12-16 Thread Emile van Sebille
On 12/16/2011 2:49 PM ADRIAN KELLY said... thanks dave, just tried writing to file for the first time def main(): outfile.write('Hello this is a test') outfile.close() main() *error, globalname outfile is not defined, do i need to import function to get this working?* No, but you do need to i

Re: [Tutor] reset password program

2011-12-16 Thread Sarma Tangirala
> thanks dave, > just tried writing to file for the first time > > def main(): > outfile.write('Hello this is a test') > outfile.close() > main() > > error, globalname outfile is not defined, do i need to import function to get this working? > > Fyi, you should check the python docs. They have a

Re: [Tutor] reset password program

2011-12-16 Thread Steven D'Aprano
ADRIAN KELLY wrote: Hi guys, i created a program that allows users to login using a password that i set at the top of the program. Among other things users are given the option to change their password. My questions is; Is it possible for me to make this new password stick, in other words wh

Re: [Tutor] reset password program

2011-12-16 Thread Hugo Arts
On Fri, Dec 16, 2011 at 11:49 PM, ADRIAN KELLY wrote: > thanks dave, > just tried writing to file for the first time > > def main(): >  outfile.write('Hello this is a test') >  outfile.close() > main() > > error, globalname outfile is not defined, do i need to import function to > get this working

Re: [Tutor] reset password program

2011-12-16 Thread Robert Sjoblom
> Some improvements to think about, in order of least secure (easiest) to most > secure (hardest). > > (1) "my secret password.txt" is a crappy name. Is there a better name? I'm going to go with "EULA.txt"; the reasons should be obvious. -- best regards, Robert S. ___