RUN ALL TEST

2013-10-29 Thread Chandru Rajendran
Hi all, I am building my script. I want to run all the test scripts. Currently I am running the code "python setup.py test", it is running only the some tests in my directory. I want to run all the tests in my directory. Can you help please. Thanks & Regards, Chandru CAUTION - D

Re: personal library

2013-10-29 Thread Chris Angelico
On Wed, Oct 30, 2013 at 3:33 PM, Ben Finney wrote: > Chris Angelico writes: > >> *Definitely* use source control. > > +1, but prefer to call it a “version control system” which is (a) more > easily searched on the internet, and (b) somewhat more accurate. Right. I've picked up some bad habits, a

Re: personal library

2013-10-29 Thread Ben Finney
Chris Angelico writes: > *Definitely* use source control. +1, but prefer to call it a “version control system” which is (a) more easily searched on the internet, and (b) somewhat more accurate. -- \“This sentence contradicts itself — no actually it doesn't.” | `\

Re: Sharing common code between multiple scripts?

2013-10-29 Thread Ben Finney
Victor Hooi writes: > NB - I'm the original poster here - https://groups.google.com/d/topic/[…] That is not the correct URL to a discussion on this forum. The official archives are at https://mail.python.org/pipermail/python-list/>, so that's the correct place to look for a canonical URL to your

Re: personal library

2013-10-29 Thread Chris Angelico
On Wed, Oct 30, 2013 at 1:00 PM, Dave Angel wrote: > First, I haven't seen any mention of a source control system. Get one, > learn it, and use it. That should always hold your master copy. And > the actual repository should be on a system you can access from any of > the others. > > Then, once

Sharing common code between multiple scripts?

2013-10-29 Thread Victor Hooi
Hi, NB - I'm the original poster here - https://groups.google.com/d/topic/comp.lang.python/WUuRLEXJP4E/discussion - however, that post seems to have diverted, and I suspect my original question was poorly worded. I have several Python scripts that use similar functions. Currently, these funct

Fwd: Using "with open(filename, 'ab'):" and calling code only if the file is new?

2013-10-29 Thread Zachary Ware
On Tue, Oct 29, 2013 at 8:02 PM, Victor Hooi wrote: > Hi, > > I have a CSV file that I will repeatedly appending to. > > I'm using the following to open the file: > > with open(self.full_path, 'r') as input, open(self.output_csv, 'ab') as > output: > fieldnames = (...) > csv_w

Re: Using "with open(filename, 'ab'):" and calling code only if the file is new?

2013-10-29 Thread Victor Hooi
Hi, In theory, it *should* just be our script writing to the output CSV file. However, I wanted it to be robust - e.g. in case somebody spins up two copies of this script running concurrently. I suppose the timing would have to be pretty unlucky to hit a race condition there, right? As in, so

Re: problem importing

2013-10-29 Thread C. Ng
On Tuesday, October 29, 2013 6:40:37 PM UTC+8, Peter Otten wrote: > C. Ng wrote: > Hi all, > So I cloned a package xyz from github. OS is ubuntu > 12.04. > Then install successfully using "sudo python setup.py install" > Now > when I try to import xyz, I get "ImportError: No module named xyz" > u

Re: RELEASED: Python 2.6.9 final

2013-10-29 Thread Miki Tebeka
On Tuesday, October 29, 2013 10:48:58 AM UTC-7, Barry Warsaw wrote: > So too has my latest stint as Python Release Manager. Over the 19 years I > have been involved with Python, Thanks Barry for all the hard work. -- https://mail.python.org/mailman/listinfo/python-list

RE: Using "with open(filename, 'ab'):" and calling code only if the file is new?

2013-10-29 Thread Joseph L. Casale
> Like Victor says, that opens him up to race conditions. Slim chance, it's no more possible than it happening in the time try/except takes to recover an alternative procedure. with open('in_file') as in_file, open('out_file', 'ab') as outfile_file: if os.path.getsize('out_file'): pri

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-29 Thread Chris Angelico
On Wed, Oct 30, 2013 at 2:56 AM, Mark Lawrence wrote: > You've stated above that logically unicode is badly handled by the fsr. You > then provide a trivial timing example. WTF??? His idea of bad handling is "oh how terrible, ASCII and BMP have optimizations". He hates the idea that it could be

RE: Using "with open(filename, 'ab'):" and calling code only if the file is new?

2013-10-29 Thread Dave Angel
On 29/10/2013 21:42, Joseph L. Casale wrote: You forgot the attribution line: "Victor says" >> with open(self.full_path, 'r') as input, open(self.output_csv, 'ab') as >> output: >> fieldnames = (...) >> csv_writer = DictWriter(output, filednames) >> # Call csv_writer.w

Re: personal library

2013-10-29 Thread Dave Angel
On 29/10/2013 17:29, patrick vrijlandt wrote: > Hello list, > > Python has been a hobby for me since version 1.5.2. Over the years I > accumulated quite a lot of reusable code. It is nicely organised in > modules, directories and subdirectories. With every project, the library > grows and is devel

Re: How do I update a virtualenv?

2013-10-29 Thread alex23
On 30/10/2013 12:08 AM, Skip Montanaro wrote: Where specifically are these instructions that tell you to put the virtualenv under VCS control? https://devcenter.heroku.com/articles/getting-started-with-python I believe you may have misread the instructions slightly. You should have a project

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Dave Angel
On 29/10/2013 16:11, jonas.thornv...@gmail.com wrote: > Den tisdagen den 29:e oktober 2013 kl. 21:08:39 UTC+1 skrev > jonas.t...@gmail.com: >> Den tisdagen den 29:e oktober 2013 kl. 20:24:57 UTC+1 skrev Dave Angel: > > They could had used print and prinln from basic? I do not want new line > ev

RE: Using "with open(filename, 'ab'):" and calling code only if the file is new?

2013-10-29 Thread Joseph L. Casale
> with open(self.full_path, 'r') as input, open(self.output_csv, 'ab') as > output: > fieldnames = (...) > csv_writer = DictWriter(output, filednames) > # Call csv_writer.writeheader() if file is new. > csv_writer.writerows(my_dict) > > I'm wondering what's the

Re: how to avoid checking the same condition repeatedly ?

2013-10-29 Thread alex23
On 28/10/2013 7:50 PM, Wolfgang Maier wrote: imagine you have a flag set somewhere earlier in your code, e.g., needs_processing = True then in a for loop you're processing the elements of an iterable, but the kind of processing depends on the flag, e.g.,: for elem in iterable: if needs_pr

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-29 Thread Piet van Oostrum
Mark Lawrence writes: > Please provide hard evidence to support your claims or stop posting this > ridiculous nonsense. Give us real world problems that can be reported > on the bug tracker, investigated and resolved. I think it is much better just to ignore this nonsense instead of asking for

Re: Help with guessing game :D

2013-10-29 Thread Dave Angel
On 29/10/2013 15:15, Robert Gonda wrote: (once again deleting all the double-spaced Googlegroups nonsense) > && >>Hi dave, yes you was right. I had python 2.7 but I upgraded to python 3 now, thanks for help :) by the way, is this showing normally? No, you're still adding a ">" character before t

Using "with open(filename, 'ab'):" and calling code only if the file is new?

2013-10-29 Thread Victor Hooi
Hi, I have a CSV file that I will repeatedly appending to. I'm using the following to open the file: with open(self.full_path, 'r') as input, open(self.output_csv, 'ab') as output: fieldnames = (...) csv_writer = DictWriter(output, filednames) # Call csv_writer.write

Re: Mail client wrapping

2013-10-29 Thread Skip Montanaro
The mail message is encoded. You will have a header like this: Content-Transfer-Encoding: quoted-printable If you are processing email messages you should investigate Python's email module. http://docs.python.org/2/library/email Skip On Tue, Oct 29, 2013 at 7:36 PM, Jason Friedman wrote: > I

Mail client wrapping

2013-10-29 Thread Jason Friedman
I am receiving lines like this: Accordingly, this element has largely given way in modern cases to a less = rigid formulation: that the evidence eliminates, to a sufficient degree, = other responsible causes (including the conduct of the plaintiff and third= parties). For example, in New York Sta

Re: how to avoid checking the same condition repeatedly ?

2013-10-29 Thread Peter Cacioppi
Chris said : "Want some examples of what costs no clarity to reimplement in another language? Check out the Python standard library. Some of that is implemented in C (in CPython) and some in Python, and you can't tell and needn't care which." To ME (a consumer of the CPython library) there is ze

mush 1.0 released! - Type-based dependency injection for scripts

2013-10-29 Thread Chris Withers
Hi All, I'm very happy to announce the first public release of Mush, a light weight dependency injection framework aimed at enabling the easy testing and re-use of chunks of code that make up scripts. For a worked example of how to use Mush to reduce the copy'n'paste in your scripts, please

Looking For Advice

2013-10-29 Thread crclemens73
Hey Guys, A group of guys and myself have been working on a project/business plan to develop a Hotel Concierge application for tablets. We have been working on it for over a year and have hotels here in Chicago that are on board and very interested with our concept. We also are in the works wit

xlutils 1.7.0 released!

2013-10-29 Thread Chris Withers
Hi All, I'm pleased to announce the release of xlutils 1.7.0: http://pypi.python.org/pypi/xlutils/1.7.0 This release features a handy new view module that lets you do things like: >>> def print_data(rows): ... for row in rows: ... for value in row: ... print value, ...

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Gregory Ewing
Neil Cerutti wrote: Get in the habit of not using the semicolon to end lines. Also, you don't need to put parentheses around the conditions of while and if statements. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: stacked decorators and consolidating

2013-10-29 Thread Gregory Ewing
Tim Chase wrote: I'd have figured they would be associative, making the result end up the same either way, but apparently not. They're not associative because function application is not associative: f(g(x)) is not the same thing as f(g)(x). -- Greg -- https://mail.python.org/mailman/listinfo/

Re: Using urlparse.parse_qs() - first element in dict is keyed on URL+key, instead of just key?

2013-10-29 Thread Victor Hooi
Hi, My bad - PEBKAC - didn't read the docs properly. I need to use urlparse.urlparse() to extract the query first. So for anybody searching this, you can use something liek: In [39]: url Out[39]: 'https://www.foo.com/cat/dog-13?utm_source=foo1043c&utm_medium=email&utm_campaign=

Using urlparse.parse_qs() - first element in dict is keyed on URL+key, instead of just key?

2013-10-29 Thread Victor Hooi
Hi, I'm attempting to use urlparse.parse_qs() to parse the following url: https://www.foo.com/cat/dog-13?utm_source=foo1043c&utm_medium=email&utm_campaign=ba^Cn=HC However, when I attempt to parse it, I get: {'https://www.foo.com/cat/dog-13?utm_source': ['foo1043c'], 'utm_campaign': ['ba^

Re: Help with guessing game :D

2013-10-29 Thread rurpy
On Tuesday, October 29, 2013 2:21:08 PM UTC-6, Robert Gonda wrote: > Is it possible to further more specify it? H only shows if the > guess is at most 3 higher then the answer?. But L is only given > if the guess is at most 3 lower the answer? I'm starting to > like this ;D To do that, you'll need

personal library

2013-10-29 Thread patrick vrijlandt
Hello list, Python has been a hobby for me since version 1.5.2. Over the years I accumulated quite a lot of reusable code. It is nicely organised in modules, directories and subdirectories. With every project, the library grows and is developed further. I would like to ask your advice for two prob

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Ned Batchelder
On 10/29/13 4:08 PM, jonas.thornv...@gmail.com wrote: Why did Python not implement end... The end is really not necessary for the programming language it can be excluded, but it is a courtesy to the programmer and could easily be transformed to indents automaticly, that is removed before the c

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Mark Lawrence
On 29/10/2013 20:11, jonas.thornv...@gmail.com wrote: I do not want new line everytime i write out some terms. I wish you'd apply that thinking to your posts. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Neil Cerutti
On 2013-10-29, jonas.thornv...@gmail.com wrote: > Got the script working though :D, good start. It seem though > that Python automaticly add linebreaks after printout. Is there > a way to not have print command change line? Or must i build up > a string/strings for later printout? print takes an

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 19:55:13 UTC, ru...@yahoo.com wrote: > On Tuesday, October 29, 2013 1:03:00 PM UTC-6, Robert Gonda wrote: > > > never mind you was right, for some reason I had version 2.7 :/ , > > > and btw I was wondering, is it also possible to make it more > > > complex? such as

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread jonas . thornvall
Den tisdagen den 29:e oktober 2013 kl. 21:08:39 UTC+1 skrev jonas.t...@gmail.com: > Den tisdagen den 29:e oktober 2013 kl. 20:24:57 UTC+1 skrev Dave Angel: > > > On 29/10/2013 14:35, jonas.thornv...@gmail.com wrote: > > > > > > > > > > > > (Deleting hundreds of quad-spaced garbage. Please

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 19:55:13 UTC, ru...@yahoo.com wrote: > On Tuesday, October 29, 2013 1:03:00 PM UTC-6, Robert Gonda wrote: > > > never mind you was right, for some reason I had version 2.7 :/ , > > > and btw I was wondering, is it also possible to make it more > > > complex? such as

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread jonas . thornvall
Den tisdagen den 29:e oktober 2013 kl. 20:24:57 UTC+1 skrev Dave Angel: > On 29/10/2013 14:35, jonas.thornv...@gmail.com wrote: > > > > (Deleting hundreds of quad-spaced garbage. Please be more considerate > > of others if you choose to use buggy googlegroups, maybe starting by > > studying:

Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.

2013-10-29 Thread rurpy
On Tuesday, October 29, 2013 8:08:16 AM UTC-6, Steven D'Aprano wrote: > On Tue, 29 Oct 2013 12:37:36 +0100, Skybuck Flying wrote: >[...] > Skybuck, please excuse my question, but have you ever done any > programming at all? You don't seem to have any experience with actual > programming languages

Re: Help with guessing game :D

2013-10-29 Thread rurpy
On Tuesday, October 29, 2013 1:03:00 PM UTC-6, Robert Gonda wrote: > never mind you was right, for some reason I had version 2.7 :/ , > and btw I was wondering, is it also possible to make it more > complex? such as if the computer will again show “Y” if a digit > is correct but if a digit is incor

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-29 Thread Mark Lawrence
On 29/10/2013 19:16, wxjmfa...@gmail.com wrote: Le mardi 29 octobre 2013 16:52:49 UTC+1, Tim Chase a écrit : On 2013-10-29 08:38, wxjmfa...@gmail.com wrote: import timeit timeit.timeit("a = 'hundred'; 'x' in a") 0.12621293837694095 timeit.timeit("a = 'hundreij'; 'x' in a") 0.2641155

Re: Organising packages/modules - importing functions from a common.py in a separate directory?

2013-10-29 Thread Victor Hooi
Hi, Wait - err, subpackage != module, right? Do you think you could explain what a sub-package is please? I tried Googling, and couldn't seem to find the term in this context. Also, so you're saying to put the actual script that I want to invoke *outside* the Python package. Do you mean somet

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Dave Angel
On 29/10/2013 14:35, jonas.thornv...@gmail.com wrote: (Deleting hundreds of quad-spaced garbage. Please be more considerate of others if you choose to use buggy googlegroups, maybe starting by studying: ) Please indent by 4 columns, not 1. Since indentation is how scope is specified in Python,

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-29 Thread wxjmfauth
Le mardi 29 octobre 2013 16:52:49 UTC+1, Tim Chase a écrit : > On 2013-10-29 08:38, wxjmfa...@gmail.com wrote: > > > >>> import timeit > > > >>> timeit.timeit("a = 'hundred'; 'x' in a") > > > 0.12621293837694095 > > > >>> timeit.timeit("a = 'hundreij'; 'x' in a") > > > 0.26411553466961735 >

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 19:09:01 UTC, Dave Angel wrote: > On 29/10/2013 14:05, Robert Gonda wrote: > > > > > > & >> Back to question, name is also not working, I currently have > > python 3.3.2 and the only to get that work is the write raw_input, I > > have no idea why, did i do soemt

Re: Help with guessing game :D

2013-10-29 Thread Dave Angel
On 29/10/2013 14:05, Robert Gonda wrote: & >> Back to question, name is also not working, I currently have python 3.3.2 and the only to get that work is the write raw_input, I have no idea why, did i do soemthing wrong? Why did you add those two >> symbols in front of your new text? Each such

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 18:35:56 UTC, Robert Gonda wrote: > On Tuesday, 29 October 2013 18:27:41 UTC, ru...@yahoo.com wrote: > > > On Tuesday, October 29, 2013 11:45:56 AM UTC-6, Robert Gonda wrote: > > > > > > > Thank you very much for your reply, however it gives me an error, > > > >

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 18:27:41 UTC, ru...@yahoo.com wrote: > On Tuesday, October 29, 2013 11:45:56 AM UTC-6, Robert Gonda wrote: > > > Thank you very much for your reply, however it gives me an error, > > > something about the "end", do you know whats wrong with it? > > > (Still not sure

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread jonas . thornvall
Den tisdagen den 29:e oktober 2013 kl. 19:23:28 UTC+1 skrev jonas.t...@gmail.com: > Den tisdagen den 29:e oktober 2013 kl. 19:09:03 UTC+1 skrev Neil Cerutti: > > > On 2013-10-29, jonas.thornv...@gmail.com wrote: > > > > > > > I have a 25 row javascript that i try to convert to python to get i

Re: Help with guessing game :D

2013-10-29 Thread rusi
On Tuesday, October 29, 2013 11:56:28 PM UTC+5:30, ru...@yahoo.com wrote: > On Tuesday, October 29, 2013 11:52:15 AM UTC-6, rusi wrote: > > On Tuesday, October 29, 2013 10:54:08 PM UTC+5:30, ru...@yahoo.com wrote: > > > Also, what Mark and Rusi were trying to say (not very clearly) > > > is that wh

Re: Help with guessing game :D

2013-10-29 Thread rurpy
On Tuesday, October 29, 2013 11:52:15 AM UTC-6, rusi wrote: > On Tuesday, October 29, 2013 10:54:08 PM UTC+5:30, ru...@yahoo.com wrote: > > Also, what Mark and Rusi were trying to say (not very clearly) > > is that when you post from Google Groups, Google Groups insert > > a lot of empty lines in

Re: Help with guessing game :D

2013-10-29 Thread rurpy
On Tuesday, October 29, 2013 11:45:56 AM UTC-6, Robert Gonda wrote: > Thank you very much for your reply, however it gives me an error, > something about the "end", do you know whats wrong with it? > (Still not sure if im posting this right so sorry) "...an error, something about the 'end'" is no

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread jonas . thornvall
Den tisdagen den 29:e oktober 2013 kl. 19:09:03 UTC+1 skrev Neil Cerutti: > On 2013-10-29, jonas.thornv...@gmail.com wrote: > > > I have a 25 row javascript that i try to convert to python to get into the > > language but i run into problem i do not understand howto reach outer loop > > after f

Re: RELEASED: Python 2.6.9 final

2013-10-29 Thread Tim Chase
On 2013-10-29 13:48, Barry Warsaw wrote: > All maintenance of Python 2.6, including for security issues, has > now ended. > > So too has my latest stint as Python Release Manager. I'm sorry to see you step down, but am thankful for your many years of solid work. Wishing you the best, -tkc -

Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.

2013-10-29 Thread wolfgang kern
Bernhard Schornak replied to a "Flying-Bucket-post": Methink we all know about the often not-so-logical ideas from Buck, they merely come from an abstracted view and are far away from todays hardware given opportunities. OTOH, I sometimes got to think about his weird ideas, but mainly figured th

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Neil Cerutti
On 2013-10-29, jonas.thornv...@gmail.com wrote: > I have a 25 row javascript that i try to convert to python to get into the > language but i run into problem i do not understand howto reach outer loop > after finnish inner loop, in fact i do not understand when finished. The > javascript i try

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 11:45:39 UTC, Robert Gonda wrote: > Hey guys, so I figured I will give python a shot. I got to exercise that has > asked me to create a number guessing game which weren't a problem, > > guessesTaken = 0 #This is a "Guesses taken counter" > > print("Hello, what's you

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 17:52:15 UTC, rusi wrote: > On Tuesday, October 29, 2013 10:54:08 PM UTC+5:30, ru...@yahoo.com wrote: > > > Also, what Mark and Rusi were trying to say (not very clearly) > > > is that when you post from Google Groups, Google Groups insert > > > a lot of empty lines

Re: Help with guessing game :D

2013-10-29 Thread rusi
On Tuesday, October 29, 2013 10:54:08 PM UTC+5:30, ru...@yahoo.com wrote: > Also, what Mark and Rusi were trying to say (not very clearly) > is that when you post from Google Groups, Google Groups insert > a lot of empty lines in the ">" the at the top of the message. So from the most recent post

Re: stacked decorators and consolidating

2013-10-29 Thread Tim Chase
On 2013-10-29 17:42, MRAB wrote: > If you apply the stacked decorators you get: > > myfun = dec1(args1)(dec2(args2)(dec3(args3)(myfun))) > > If you apply dec_all you get: > > myfun = dec1(args1)(dec2(args2)(dec3(args3)))(myfun) > > See the difference? You need the lambda to fix that.

Re: stacked decorators and consolidating

2013-10-29 Thread Peter Otten
Tim Chase wrote: > I've got some decorators that work fine as such: > > @dec1(args1) > @dec2(args2) > @dec3(args3) > def myfun(...): > pass > > However, I used that sequence quite a bit, so I figured I could do > something like > > dec_all = dec1(args1)(dec2(args2)(dec3(args3)))

RELEASED: Python 2.6.9 final

2013-10-29 Thread Barry Warsaw
Hello Pythoneers and Pythonistas, Five years ago this month, we released Python 2.6. It was an important version in Python's evolution, as it was developed in tandem with Python 3.0 and had the express intent of starting the transition toward Python 3. Amazingly, here we are five years later, an

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, October 29, 2013 5:24:08 PM UTC, ru...@yahoo.com wrote: > On 10/29/2013 05:45 AM, Robert Gonda wrote: > > > Hey guys, so I figured I will give python a shot. I got to exercise that > > has asked me to create a number guessing game which weren't a problem, > > > guessesTaken = 0 #Thi

First day beginner to python, add to counter after nested loop

2013-10-29 Thread jonas . thornvall
I have a 25 row javascript that i try to convert to python to get into the language but i run into problem i do not understand howto reach outer loop after finnish inner loop, in fact i do not understand when finished. The javascript i try to conver is below. #!/usr/bin/python import math # Fu

Re: stacked decorators and consolidating

2013-10-29 Thread MRAB
On 29/10/2013 16:54, Tim Chase wrote: I've got some decorators that work fine as such: @dec1(args1) @dec2(args2) @dec3(args3) def myfun(...): pass However, I used that sequence quite a bit, so I figured I could do something like dec_all = dec1(args1)(dec2(args2)(dec3(args3)

Re: Help with guessing game :D

2013-10-29 Thread rusi
On Tuesday, October 29, 2013 10:52:04 PM UTC+5:30, Neil Cerutti wrote: > I just want to add that this programming exercise, while pretty > common, stinks. > > A new programmer shouldn't be embroiled in the morass of > interactive programming. Cheers to that! If the 'print' statement were called a

Re: Help with guessing game :D

2013-10-29 Thread rurpy
On 10/29/2013 05:45 AM, Robert Gonda wrote: > Hey guys, so I figured I will give python a shot. I got to exercise that has > asked me to create a number guessing game which weren't a problem, > guessesTaken = 0 #This is a "Guesses taken counter" > print("Hello, what's your name?") #Asking the use

Re: Help with guessing game :D

2013-10-29 Thread Neil Cerutti
On 2013-10-29, Alister wrote: > set the number to be guessed > get the user input > step through each digit in the input > compare to the co-responding digit in the number to be guessed > generate the required output > > actually let me just expand on my earlier teaser code > > does this switch on

Re: Help with guessing game :D

2013-10-29 Thread rusi
On Tuesday, October 29, 2013 10:35:52 PM UTC+5:30, Robert Gonda wrote: > > Is this better then? By a bit. For most here not enough Open the 'show quoted text' in your last post it shows like so [Ive replaced '>' by '&' so GG will show it & On Tuesday, October 29, 2013 10:01:38 PM UTC+5:30, Robert

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 16:40:01 UTC, rusi wrote: > On Tuesday, October 29, 2013 10:01:38 PM UTC+5:30, Robert Gonda wrote: > > > > > > > I honestly don't get it? this any better? ;D > > > > In google groups you will see a small 'show quoted text' > > Click it you will see what a cascadi

Re: Running Python programmes

2013-10-29 Thread darnold
Maybe you're inadvertently running Python with either the '-i' switch or with the PYTHONINSPECT environment variable set? When you do that, your script will launch an interactive prompt after it completes. C:\Python27>echo print "hello" > hello.py C:\Python27>python hello.py hello C:\Python

stacked decorators and consolidating

2013-10-29 Thread Tim Chase
I've got some decorators that work fine as such: @dec1(args1) @dec2(args2) @dec3(args3) def myfun(...): pass However, I used that sequence quite a bit, so I figured I could do something like dec_all = dec1(args1)(dec2(args2)(dec3(args3))) to consolidate the whole mess down to @

Re: Help with guessing game :D

2013-10-29 Thread rusi
On Tuesday, October 29, 2013 10:01:38 PM UTC+5:30, Robert Gonda wrote: > > > I honestly don't get it? this any better? ;D In google groups you will see a small 'show quoted text' Click it you will see what a cascading avalanche of mess is produced. Yes GG is stupid, not you. But if you use it (

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 16:24:57 UTC, rusi wrote: > On Tuesday, October 29, 2013 8:10:20 PM UTC+5:30, Robert Gonda wrote: > > > > > Unfortunately I'm not that sort of person, the way my brain learns is by > > > experimenting, but first I need to know exactly what to write. Then I will >

Re: Pickle virtual machines implemented in other languages?

2013-10-29 Thread Ned Batchelder
On 10/29/13 12:12 PM, Patrick wrote: Hi Everyone I was just wondering if anyone had tried to implement a pickle virtual machine in another language? I was thinking that it might make for a nice little form of cross language IPC within a trusted environment. Pickle can execute class constru

Re: Help with guessing game :D

2013-10-29 Thread rusi
On Tuesday, October 29, 2013 8:10:20 PM UTC+5:30, Robert Gonda wrote: > Unfortunately I'm not that sort of person, the way my brain learns is by > experimenting, but first I need to know exactly what to write. Then I will > play > around with it and customize it to my needs, sorry to be such a

Pickle virtual machines implemented in other languages?

2013-10-29 Thread Patrick
Hi Everyone I was just wondering if anyone had tried to implement a pickle virtual machine in another language? I was thinking that it might make for a nice little form of cross language IPC within a trusted environment. -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with guessing game :D

2013-10-29 Thread Alister
On Tue, 29 Oct 2013 07:40:20 -0700, Robert Gonda wrote: >> >> >> >> remember that strings are a sequence. >> >> they can be used as iterators & sliced in the same way as lists & >> >> >> tuples. >> >> >> >> Let a fool hold his tongue and he will pass for a sage. >> >> >> >> >> >> --

Re: how to avoid checking the same condition repeatedly ?

2013-10-29 Thread rusi
On Tuesday, October 29, 2013 7:14:51 PM UTC+5:30, Neil Cerutti wrote: > On 2013-10-28, Nobody wrote: > > If you're sufficiently concerned about performance that you're > > willing to trade clarity for it, you shouldn't be using Python > > in the first place. > > > When you detect a code small, a

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-29 Thread Mark Lawrence
On 29/10/2013 15:38, wxjmfa...@gmail.com wrote: It's okay folks I'll snip all the double spaced google crap as the poster is clearly too bone idle to follow the instructions that have been repeatedly posted here asking for people not to post double spaced google crap. Le mardi 29 octobre 20

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-29 Thread Tim Chase
On 2013-10-29 08:38, wxjmfa...@gmail.com wrote: > >>> import timeit > >>> timeit.timeit("a = 'hundred'; 'x' in a") > 0.12621293837694095 > >>> timeit.timeit("a = 'hundreij'; 'x' in a") > 0.26411553466961735 That reads to me as "If things were purely UCS4 internally, Python would normally take 0

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-29 Thread wxjmfauth
Le mardi 29 octobre 2013 06:22:27 UTC+1, Steven D'Aprano a écrit : > On Mon, 28 Oct 2013 07:01:16 -0700, wxjmfauth wrote: > > > > > And of course, logically, they are very, very badly handled with the > > > Flexible String Representation. > > > > I'm reminded of Cato the Elder, the Roman sen

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 14:25:10 UTC, Alister wrote: > On Tue, 29 Oct 2013 06:10:30 -0700, Robert Gonda wrote: > > > > > On Tuesday, 29 October 2013 13:07:08 UTC, Alister wrote: > > >> On Tue, 29 Oct 2013 06:03:55 -0700, Robert Gonda wrote: > > >> > > >> > > >> > > >> > On Tuesday,

Re: Function for the path of the script?

2013-10-29 Thread Grant Edwards
On 2013-10-29, Steven D'Aprano wrote: > On Mon, 28 Oct 2013 21:00:39 -0700, rurpy wrote: > >> This was pointed out before but since you said you ignore posts from GG >> you probably missed it, and will probably miss this one too, and thus >> continue to post bad information. >> >> This is a sma

Re: Function for the path of the script?

2013-10-29 Thread Grant Edwards
On 2013-10-28, Ben Finney wrote: > Grant Edwards writes: > >> On 2013-10-27, Ben Finney wrote: >> >> > What workflow requires you to know the filename of the module, within >> > the module? >> >> If you have a utility that can be used to do several related things, >> one way to tell that utility

Re: Help with guessing game :D

2013-10-29 Thread Alister
On Tue, 29 Oct 2013 06:10:30 -0700, Robert Gonda wrote: > On Tuesday, 29 October 2013 13:07:08 UTC, Alister wrote: >> On Tue, 29 Oct 2013 06:03:55 -0700, Robert Gonda wrote: >> >> >> >> > On Tuesday, 29 October 2013 12:58:09 UTC, Alister wrote: >> >> >> On Tue, 29 Oct 2013 05:05:19 -0700, Ro

Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.

2013-10-29 Thread Steven D'Aprano
On Tue, 29 Oct 2013 12:37:36 +0100, Skybuck Flying wrote: > To put the exit condition at the bottom is logical. > > The exit condition glues the loop to the code that will be executed next > which is also at the bottom. Skybuck, please excuse my question, but have you ever done any programming

Re: How do I update a virtualenv?

2013-10-29 Thread Skip Montanaro
> Where specifically are these instructions that tell you to put the > virtualenv under VCS control? https://devcenter.heroku.com/articles/getting-started-with-python > As you are a Heroku customer (I'm not), would you be willing to > suggest they alter them based on advice from this forum? It's

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 13:44:45 UTC, Mark Lawrence wrote: > On 29/10/2013 11:45, Robert Gonda wrote: > > > > As you've already received and responded to advice please could you > > read, digest and action this https://wiki.python.org/moin/GoogleGroupsPython > > > > TIA. > > > > --

Re: how to avoid checking the same condition repeatedly ?

2013-10-29 Thread Neil Cerutti
On 2013-10-28, Nobody wrote: > On Mon, 28 Oct 2013 09:50:19 +, Wolfgang Maier wrote: >> So my question is: is there an agreed-upon generally best way >> of dealing with this? > > Yes. Just leave the test inside the loop. > > If you're sufficiently concerned about performance that you're > will

Re: Help with guessing game :D

2013-10-29 Thread Mark Lawrence
On 29/10/2013 11:45, Robert Gonda wrote: As you've already received and responded to advice please could you read, digest and action this https://wiki.python.org/moin/GoogleGroupsPython TIA. -- Python is the second best programming language in the world. But the best has yet to be invented.

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 13:07:08 UTC, Alister wrote: > On Tue, 29 Oct 2013 06:03:55 -0700, Robert Gonda wrote: > > > > > On Tuesday, 29 October 2013 12:58:09 UTC, Alister wrote: > > >> On Tue, 29 Oct 2013 05:05:19 -0700, Robert Gonda wrote: > > >> > > >> > > >> >> > > >> > > >> >

Re: Help with guessing game :D

2013-10-29 Thread Alister
On Tue, 29 Oct 2013 06:03:55 -0700, Robert Gonda wrote: > On Tuesday, 29 October 2013 12:58:09 UTC, Alister wrote: >> On Tue, 29 Oct 2013 05:05:19 -0700, Robert Gonda wrote: >> >> >> >> >> >> >> > >> >> > converting input()'s result to an integer, both of which suggest >> >> >> >> >> >>

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 12:58:09 UTC, Alister wrote: > On Tue, 29 Oct 2013 05:05:19 -0700, Robert Gonda wrote: > > >> > > >> > > > >> > converting input()'s result to an integer, both of which suggest > > >> > > >> > > > > if you need to be checking individual digits you are probab

Re: Help with guessing game :D

2013-10-29 Thread Alister
On Tue, 29 Oct 2013 05:05:19 -0700, Robert Gonda wrote: >> >> > >> > converting input()'s result to an integer, both of which suggest >> >> if you need to be checking individual digits you are probably best keeping the input & number to be checked as strings. it would then be a trivial task

Re: Cookie fr*cking problem

2013-10-29 Thread Neil Cerutti
On 2013-10-29, Steven D'Aprano wrote: > On Mon, 28 Oct 2013 13:20:17 +, Neil Cerutti wrote: > >> On 2013-10-27, Ben Finney wrote: >>> I have no particular objection to you responding to those >>> instances of bad behaviour that I've omitted. >> >> So you omitted them, eh? >> >> You just omi

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 11:54:49 UTC, Robert Gonda wrote: > On Tuesday, 29 October 2013 11:53:55 UTC, Chris Angelico wrote: > > > On Tue, Oct 29, 2013 at 10:45 PM, Robert Gonda > > > > > > wrote: > > > > > > > N = raw_input() #What the user's name is > > > > > > > print(N + ", I'm

Re: Help with guessing game :D

2013-10-29 Thread Robert Gonda
On Tuesday, 29 October 2013 11:53:55 UTC, Chris Angelico wrote: > On Tue, Oct 29, 2013 at 10:45 PM, Robert Gonda > > wrote: > > > N = raw_input() #What the user's name is > > > print(N + ", I'm thinking of a number between 1-1000") #Not needed but > > tells the user their name and tells them

  1   2   >