Re: Correct Way to Write in Python

2013-08-02 Thread Peter Otten
punk.sa...@gmail.com wrote: > Hi All, > > Im new to Python. Im coming from C# background and want to learn Python. > I was used to do following thing in C# in my previous experiences. I want > to know how do I implement below example in Python. How these things are > done in Python. > [code] > pu

Correct Way to Write in Python

2013-08-02 Thread punk . sagar
Hi All, Im new to Python. Im coming from C# background and want to learn Python. I was used to do following thing in C# in my previous experiences. I want to know how do I implement below example in Python. How these things are done in Python. [code] public class Bank { public

Re: web development in python without using any webframework

2013-08-02 Thread dieter
Alok Singh Mahor writes: > Hello everyone, > few months back I started learning python and now I got nice familiarity. > now i want to use python for creating dynamic database driven websites. and > I dont want to use existing web frameworks for my work. I am learning > things so I wont feel lazy

Re: web development in python without using any webframework

2013-08-02 Thread Rodrick Brown
On Aug 3, 2013, at 12:37 AM, Alok Singh Mahor wrote: > Hello everyone, > few months back I started learning python and now I got nice familiarity. now > i want to use python for creating dynamic database driven websites. and I > dont want to use existing web frameworks for my work. I am learnin

Re: Python: Code is ignoring the if and else

2013-08-02 Thread Terry Reedy
On 8/2/2013 10:24 PM, kevin4f...@gmail.com wrote: Looking at this again, I believe you actually had the structure almost right before. You want to look through *all* of the target players cards and if *none* of them match, (ie the search fails), you want to draw 1 card. What you were missing b

web development in python without using any webframework

2013-08-02 Thread Alok Singh Mahor
Hello everyone, few months back I started learning python and now I got nice familiarity. now i want to use python for creating dynamic database driven websites. and I dont want to use existing web frameworks for my work. I am learning things so I wont feel lazy to write all the code myself becaus

Re: Python: Code is ignoring the if and else

2013-08-02 Thread Dave Angel
kevin4f...@gmail.com wrote: > I'm trying to create a game of Go Fish in Python. But I've stumbled onto a > little problem that I can't seem to figure out how to deal with. > Please list the program the way you are actually running it. The present one will not run very long before producing

Re: Python: Code is ignoring the if and else

2013-08-02 Thread kevin4fong
On Friday, August 2, 2013 7:11:37 PM UTC-7, Joshua Landau wrote: > On 3 August 2013 02:44, wrote: > > > > Yeah, I already know about that. But if I try to change it, I'm not even able > to start the program. If I try to change the if statement that it corresponds > with, I get a an error say

Re: PEP8 revised: max line lengths

2013-08-02 Thread Joshua Landau
On 2 August 2013 22:34, Chris Angelico wrote: > On Fri, Aug 2, 2013 at 10:15 PM, wrote: > > Problem #3 > > cm or inch? The only serious unit is an SI unit. > > (In scientific publications, only SI units are accepted) > > The cm is not a primary SI unit either. But it is an SI unit. (As a si

Re: Python: Code is ignoring the if and else

2013-08-02 Thread Joshua Landau
On 3 August 2013 02:44, wrote: > Yeah, I already know about that. But if I try to change it, I'm not even > able to start the program. If I try to change the if statement that it > corresponds with, I get a an error saying "card" is not a global. And if I > try to shift it in, for some reason...t

Re: Python: Code is ignoring the if and else

2013-08-02 Thread Chris Angelico
On Sat, Aug 3, 2013 at 2:44 AM, wrote: > Yeah, I already know about that. But if I try to change it, I'm not even able > to start the program. If I try to change the if statement that it corresponds > with, I get a an error saying "card" is not a global. And if I try to shift > it in, for some

Re: Python: Code is ignoring the if and else

2013-08-02 Thread kevin4fong
On Friday, August 2, 2013 6:42:30 PM UTC-7, Terry Reedy wrote: > Nonsense: they are executed just as you ask, even though what you ask is > > not what you meant. > > > > On 8/2/2013 8:40 PM, kevin4f...@gmail.com wrote: > > > > > def player_0_hitman(hit): > > > for card in pHands[targe

Re: Python: Code is ignoring the if and else

2013-08-02 Thread kevin4fong
On Friday, August 2, 2013 6:39:43 PM UTC-7, John Ladasky wrote: > On Friday, August 2, 2013 5:40:52 PM UTC-7, kevin...@gmail.com wrote: > > > Basically, my code is ignoring the if's and else's. I don't get why. > > > Everything appears to be positioned correctly, but for some odd reason, even

Re: Python: Code is ignoring the if and else

2013-08-02 Thread Terry Reedy
Nonsense: they are executed just as you ask, even though what you ask is not what you meant. On 8/2/2013 8:40 PM, kevin4f...@gmail.com wrote: def player_0_hitman(hit): for card in pHands[target_player]: if target_card[0] == card[0]: count = pHands[target_player].coun

Re: Python: Code is ignoring the if and else

2013-08-02 Thread John Ladasky
On Friday, August 2, 2013 5:40:52 PM UTC-7, kevin...@gmail.com wrote: > Basically, my code is ignoring the if's and else's. I don't get why. > Everything appears to be positioned correctly, but for some odd reason, even > after an if, the program also runs the else as well. Look carefully at y

Re: Python: Code is ignoring the if and else

2013-08-02 Thread MRAB
On 03/08/2013 01:40, kevin4f...@gmail.com wrote: I'm trying to create a game of Go Fish in Python. But I've stumbled onto a little problem that I can't seem to figure out how to deal with. There is a human player (player 0) and three computer players (from 1-3). The human player goes first and

Re: LibreOffice

2013-08-02 Thread Terry Reedy
On 8/2/2013 3:14 AM, Ben Finney wrote: Chris Angelico writes: […] rather than OO/LibreOffice. (I'll not distinguish those two. Far as I'm concerned, they're one product with two names.) That's simply false. LibreOffice has, since the 2010 fork of the code base and especially since the exodus

Re: PEP8 revised: max line lengths

2013-08-02 Thread Terry Reedy
On 8/2/2013 1:19 AM, Dave Angel wrote: Terry Reedy wrote: On 8/1/2013 7:33 PM, Dave Angel wrote: Terry Reedy wrote: The diff with all the changes is here http://hg.python.org/peps/rev/fb24c80e9afb Just out of curiosity, where is "coding cookie" defined? I found enough distant referenc

Dealing with ImportLock deadlock in Import Hooks

2013-08-02 Thread Arnaud Fontaine
Hello, I'm currently working on implementing Import Hooks (PEP302) with Python 2.7 to be able to import modules whose code is in ZODB. However, I have stumbled upon a widely known issue about import deadlock[0][1] (note that this issue is not directly related to ZODB, but a more general question a

Re: Python performance

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 1:00 PM, Schneider wrote: > Hi list, > > I have to write a small SMTP-Relay script (+ some statistic infos) and I'm > wondering, if this > can be done in python (in terms of performance, of course not in terms of > possibility ;) ). > > It has to handle around 2000 mails per

Dealing with ImportLock deadlock in Import Hooks

2013-08-02 Thread Arnaud Fontaine
Hello, I'm currently working on implementing Import Hooks (PEP302) with Python 2.7 to be able to import modules whose code is in ZODB. However, I have stumbled upon a widely known issue about import deadlock[0][1] (note that this issue is not directly related to ZODB, but a more general question a

PyArg_ParseTuple() when the type could be anything?

2013-08-02 Thread David M. Cotter
I'd like to be able to use PyArg_ParseTuple() in a generic way. for example, i'd like to have all commands start with 1 integer parameter, and this "commandID" will inform me of what parameters come next (via LUT). knowing that i can then call ParseTuple again with the proper parameters. like t

Python: Code is ignoring the if and else

2013-08-02 Thread kevin4fong
I'm trying to create a game of Go Fish in Python. But I've stumbled onto a little problem that I can't seem to figure out how to deal with. There is a human player (player 0) and three computer players (from 1-3). The human player goes first and chooses a target player. And then a card rank (for

Re: How to use Python to open Unread message(s) in specific Outlook folder, clicking a hyperlink within the email message to a secure login window, entering password to download .csv file, run Excel m

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 7:18 PM, wrote: > How should I tweak my setup to make it easier to retrieve my email? I hope > I'm doing this reply correctly. The best way is to use email, not the Google Groups interface. Start here: http://mail.python.org/mailman/listinfo/python-list You can use gm

Re: PEP8 revised: max line lengths

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 10:15 PM, wrote: > Le vendredi 2 août 2013 17:19:11 UTC+2, Skip Montanaro a écrit : >> > The solely valid solution, assuming there is some wish, >> > is to define a maximal line width (preferably in SI units ;-) >> >> So, 79 * 8 points == 0.22295696 meters, right? :-) >

Re: PEP8 revised: max line lengths

2013-08-02 Thread wxjmfauth
Le vendredi 2 août 2013 17:19:11 UTC+2, Skip Montanaro a écrit : > > The solely valid solution, assuming there is some wish, > > > is to define a maximal line width (preferably in SI units ;-) > > > > So, 79 * 8 points == 0.22295696 meters, right? :-) > > > > Skip You can correct your m

Re: How to use Python to open Unread message(s) in specific Outlook folder, clicking a hyperlink within the email message to a secure login window, entering password to download .csv file, run Excel m

2013-08-02 Thread Skip Montanaro
> Reading outlook email, I found this: > > http://timgolden.me.uk/python/win32_how_do_i/read-my-outlook-inbox.html > > There is lots to find via google with 'reading outlook email with python' You might also want to look at the source for the SpamBayes Outlook plugin: https://pypi.python.org/pypi

Re: How to use Python to open Unread message(s) in specific Outlook folder, clicking a hyperlink within the email message to a secure login window, entering password to download .csv file, run Excel m

2013-08-02 Thread Joel Goldstick
On Fri, Aug 2, 2013 at 2:18 PM, wrote: > On Thursday, August 1, 2013 2:32:55 PM UTC-4, Chris Angelico wrote: > On Thu, Aug 1, 2013 at 7:08 PM, wrote: > > 1) You receive an email > > 2) That email has two URLs in it ("secure hyperlinks" means they begin > > https:// ?) > > 3) You choose one of t

Re: How to use Python to open Unread message(s) in specific Outlook folder, clicking a hyperlink within the email message to a secure login window, entering password to download .csv file, run Excel m

2013-08-02 Thread hambergcfa
On Thursday, August 1, 2013 2:32:55 PM UTC-4, Chris Angelico wrote: On Thu, Aug 1, 2013 at 7:08 PM, wrote: 1) You receive an email 2) That email has two URLs in it ("secure hyperlinks" means they begin https:// ?) 3) You choose one of them as being "appropriate" - is it always the second? 4

Re: PEP8 revised: max line lengths

2013-08-02 Thread Skip Montanaro
> The solely valid solution, assuming there is some wish, > is to define a maximal line width (preferably in SI units ;-) So, 79 * 8 points == 0.22295696 meters, right? :-) Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Skip Montanaro
> is the third column is only the microsecond? Yes. > how could i get this to write with the rest of the time (the hh:mm:ss) ? It sounds like you really want the time formatted in a particular way, not just the numeric value of one or more fields. Look at the documentation for the strftime meth

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread matt . doolittle33
On Friday, August 2, 2013 8:35:13 AM UTC-4, Steven D'Aprano wrote: > On Fri, 02 Aug 2013 03:54:32 -0700, matt.doolittle33 wrote: > > > > > Hey everybody, > > > > > > I am using 2.7 on Ubuntu 12.10. All I need to do is to print time with > > > the microseconds. I have been looking at the do

Re: PEP8 revised: max line lengths

2013-08-02 Thread wxjmfauth
Le vendredi 2 août 2013 13:07:47 UTC+2, Chris “Kwpolska” Warrick a écrit : > On Fri, Aug 2, 2013 at 2:51 AM, Roy Smith wrote: > > > In article , > > > Terry Reedy wrote: > > > > > >> Newly revised this morning: > > >> http://www.python.org/dev/peps/pep-0008/#maximum-line-length > > >> summ

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread matt . doolittle33
On Friday, August 2, 2013 8:37:45 AM UTC-4, Skip Montanaro wrote: > Perhaps use datetime? > > > > >>> now = datetime.datetime.now() > > >>> now.isoformat() > > '2013-08-02T07:37:08.430131' > > >>> now.strftime("%f") > > '430131' > > > > Skip Thanks Skip, what i currently i have is:

Re: Python performance

2013-08-02 Thread Grant Edwards
On 2013-08-02, Grant Edwards wrote: > On 2013-08-02, Schneider wrote: > >> I have to write a small SMTP-Relay script (+ some statistic infos) >> and I'm wondering, if this can be done in python (in terms of >> performance, of course not in terms of possibility ;) ). >> >> It has to handle around

Re: Python performance

2013-08-02 Thread Grant Edwards
On 2013-08-02, Schneider wrote: > I have to write a small SMTP-Relay script (+ some statistic infos) > and I'm wondering, if this can be done in python (in terms of > performance, of course not in terms of possibility ;) ). > > It has to handle around 2000 mails per hour for at least 8hours a day

Re: LibreOffice (was: Editing tabular data)

2013-08-02 Thread Grant Edwards
On 2013-08-02, Chris Angelico wrote: > On Fri, Aug 2, 2013 at 8:14 AM, Ben Finney wrote: >> Chris Angelico writes: >> >>> [?] rather than OO/LibreOffice. (I'll not distinguish those two. Far >>> as I'm concerned, they're one product with two names.) >> >> That's simply false. ... >> >> Claiming

Re: PEP8 79 char max

2013-08-02 Thread Grant Edwards
On 2013-08-02, Dennis Lee Bieber wrote: > On Thu, 1 Aug 2013 19:29:06 + (UTC), Grant Edwards > declaimed the following: > >> >>I got tired of hand assembling (and disassembling) code for a custom >>microprocessor, so I wrote an assembler and a disassembler. > > Let me know when you recre

Re: Python performance

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 2:16 PM, Schneider wrote: > Queuing the mails for a while is not possible, because the tool should sit > between the client and smtp-server. > It should act as proxy, not as server. I've written an SMTP proxy (primary purpose: check SPF records; secondary purpose: rate-limi

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread matt . doolittle33
so you are saying that self.logfile.write('%s\t'%(str(time( should be: self.logfile.write('%s\t'%(str(time.time( ??? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python performance

2013-08-02 Thread Schneider
On 08/02/2013 03:09 PM, Ray Cote wrote: - Original Message - From: "Schneider" To: python-list@python.org Sent: Friday, August 2, 2013 8:00:09 AM Subject: Python performance Hi list, I have to write a small SMTP-Relay script (+ some statistic infos) and I'm wondering, if this can be d

Re: Python performance

2013-08-02 Thread Ray Cote
- Original Message - > From: "Schneider" > To: python-list@python.org > Sent: Friday, August 2, 2013 8:00:09 AM > Subject: Python performance > > Hi list, > > I have to write a small SMTP-Relay script (+ some statistic infos) > and > I'm wondering, if this > can be done in python (in ter

Re: Python performance

2013-08-02 Thread Schneider
On Fri 02 Aug 2013 02:59:26 PM CEST, Tim Chase wrote: On 2013-08-02 14:00, Schneider wrote: I have to write a small SMTP-Relay script (+ some statistic infos) and I'm wondering, if this can be done in python (in terms of performance, of course not in terms of possibility ;) ). It has to handle

Astroid 1.0 released

2013-08-02 Thread Sylvain Thénault
Astroid_ is the new name of former logilab-astng library. It's an AST library, used as the basis of Pylint_ and including Python 2.5 -> 3.3 compatible tree representation, statical type inference and other features useful for advanced Python code analysis, such as an API to provide extra informatio

RE: Best practice for connections and cursors

2013-08-02 Thread Joseph L. Casale
>Speaking to the OP: personally, I don't like the approach of putting data >access methods at the module level to >begin with. I'd rather use a class. >Just because it makes sense to have a singleton connection now doesn't mean it >>will always make sense as your application grows. >In fact,

Re: Python performance

2013-08-02 Thread Tim Chase
On 2013-08-02 14:00, Schneider wrote: > I have to write a small SMTP-Relay script (+ some statistic infos) > and I'm wondering, if this > can be done in python (in terms of performance, of course not in > terms of possibility ;) ). > > It has to handle around 2000 mails per hour for at least 8hour

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 1:08 PM, Dave Angel wrote: > matt.doolittl...@gmail.com wrote: > >> Hey everybody, >> >> I am using 2.7 on Ubuntu 12.10. > > and what version of Python are you using? I don't know if it matters, > but it's useful to always supply both Python version and OS version. > Looks

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Steven D'Aprano
On Fri, 02 Aug 2013 03:54:32 -0700, matt.doolittle33 wrote: > Hey everybody, > > I am using 2.7 on Ubuntu 12.10. All I need to do is to print time with > the microseconds. I have been looking at the docs and trying things for > about half a day now with no success. Currently my code looks like

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Skip Montanaro
Perhaps use datetime? >>> now = datetime.datetime.now() >>> now.isoformat() '2013-08-02T07:37:08.430131' >>> now.strftime("%f") '430131' Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Ulrich Eckhardt
Am 02.08.2013 12:54, schrieb matt.doolittl...@gmail.com: I am using 2.7 on Ubuntu 12.10. All I need to do is to print time with the microseconds.[...] # write date and time and microseocnds self.logfile.write('%s\t'%(str(strftime("%Y-%m-%d", self.logfile.write(

Re: email 8bit encoding

2013-08-02 Thread Antoon Pardon
Op 01-08-13 17:20, ru...@yahoo.com schreef: > On 07/29/2013 02:52 PM, Antoon Pardon wrote: >> Op 29-07-13 01:41, ru...@yahoo.com schreef: >>> How, using Python-3.3's email module, do I "flatten" (I think >>> that's the right term) a Message object to get utf-8 encoded >>> body with the headers: >>>

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Dave Angel
matt.doolittl...@gmail.com wrote: > Hey everybody, > > I am using 2.7 on Ubuntu 12.10. and what version of Python are you using? I don't know if it matters, but it's useful to always supply both Python version and OS version. > All I need to do is to print time with the microseconds. I have b

Python performance

2013-08-02 Thread Schneider
Hi list, I have to write a small SMTP-Relay script (+ some statistic infos) and I'm wondering, if this can be done in python (in terms of performance, of course not in terms of possibility ;) ). It has to handle around 2000 mails per hour for at least 8hours a day (which does not mean, that

Re: email 8bit encoding

2013-08-02 Thread Antoon Pardon
Op 01-08-13 17:20, ru...@yahoo.com schreef: > On 07/29/2013 02:52 PM, Antoon Pardon wrote: >> Op 29-07-13 01:41, ru...@yahoo.com schreef: >>> How, using Python-3.3's email module, do I "flatten" (I think >>> that's the right term) a Message object to get utf-8 encoded >>> body with the headers: >>>

Re: PEP8 revised: max line lengths

2013-08-02 Thread Chris “Kwpolska” Warrick
On Fri, Aug 2, 2013 at 2:51 AM, Roy Smith wrote: > In article , > Terry Reedy wrote: > >> Newly revised this morning: >> http://www.python.org/dev/peps/pep-0008/#maximum-line-length >> summary: >> 72 for text block (comments, triple-quoted strings) >> 79 for normal code >> 99 for code that is re

outputting time in microseconds or milliseconds

2013-08-02 Thread matt . doolittle33
Hey everybody, I am using 2.7 on Ubuntu 12.10. All I need to do is to print time with the microseconds. I have been looking at the docs and trying things for about half a day now with no success. Currently my code looks like this: # write date and time and microseocnds self.

Re: PyQt5 and virtualenv problem

2013-08-02 Thread Pete Forman
"D. Xenakis" writes: > I tried to install SIP and PyQt5 using the pip install command but it > didnt work on both cases (i was getting errors), so i finally > installed them using the windows installers provided in > riverbankcomputing website. > My problem though here is that whenever i try to c

Re: Python script help

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 10:46 AM, wrote: > I do know some Python programming, I just dont know enough to put together > the various scripts I need...I would really really appreciate if some one can > help me with that... Be aware that you might be paying money for that. If you know "some" carpe

Re: Python script help

2013-08-02 Thread cool1574
I do know some Python programming, I just dont know enough to put together the various scripts I need...I would really really appreciate if some one can help me with that... -- http://mail.python.org/mailman/listinfo/python-list

Re: LibreOffice (was: Editing tabular data)

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 8:14 AM, Ben Finney wrote: > Chris Angelico writes: > >> […] rather than OO/LibreOffice. (I'll not distinguish those two. Far >> as I'm concerned, they're one product with two names.) > > That's simply false. ... > > Claiming they're the same product is ignoring the transfe

Re: Editing tabular data [was: PEP8 79 char max]

2013-08-02 Thread wxjmfauth
Le jeudi 1 août 2013 02:50:13 UTC+2, Chris Angelico a écrit : > ... > rather than OO/LibreOffice. (I'll not distinguish those two. Far as > > I'm concerned, they're one product with two names.) ... Very interesting aspect in LibreOffice. As the "center of gravity of the development" has move

Re: Python script help

2013-08-02 Thread Ulrich Eckhardt
Am 01.08.2013 18:02, schrieb cool1...@gmail.com: I know I should be testing out the script myself but I did, I tried and since I am new in python and I work for a security firm that ask me to scan hundreds of documents a day for unsafe links (by opening them) I thought writing a script will be mu

LibreOffice (was: Editing tabular data)

2013-08-02 Thread Ben Finney
Chris Angelico writes: > […] rather than OO/LibreOffice. (I'll not distinguish those two. Far > as I'm concerned, they're one product with two names.) That's simply false. LibreOffice has, since the 2010 fork of the code base and especially since the exodus of developers to The Document Foundati