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

2013-10-29 Thread Victor Hooi
Hi, Hmm, this post on SO seems to suggest that importing from another sibling directory in a package ins't actually possibly in Python without some ugly hacks? http://stackoverflow.com/questions/6323860/sibling-package-imports Did I read the above correctly? Is there another way I can structu

Re: how to avoid checking the same condition repeatedly ?

2013-10-29 Thread Chris Angelico
On Tue, Oct 29, 2013 at 5:53 PM, Peter Cacioppi wrote: > But this sort of bottleneck refactoring can be done in a careful way that > minimizes the damage to readability. And a strength of py is it tends to > encourage this "as pretty as possible" approach to bottleneck refactoring. > > This is w

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

2013-10-29 Thread Peter Otten
Victor Hooi wrote: > Hi, > > Hmm, this post on SO seems to suggest that importing from another sibling > directory in a package ins't actually possibly in Python without some ugly > hacks? > > http://stackoverflow.com/questions/6323860/sibling-package-imports > > Did I read the above correctly?

Re: Curdling: Concurrent package installer for python

2013-10-29 Thread Mark Lawrence
On 29/10/2013 02:11, Blaine LaFreniere wrote: Sounds nice. I'll see about checking it out later. Good luck with the project. Since when is making a drink a project? As it happens I don't particularly like tea, so I'll have coffee please, black, no sugar. Or have I made a wrong assumption a

Re: Slicing with negative strides

2013-10-29 Thread Duncan Booth
Steven D'Aprano wrote: > Does anyone here use slices (or range/xrange) with negative strides > other than -1? > > E.g. sequence[2:15:-3] With any negative stride your example is just the empty sequence. > > > If so, there is a discussion (long, long, looong discussion) on > the python-id

Re: Slicing with negative strides

2013-10-29 Thread Mark Lawrence
On 29/10/2013 05:22, Steven D'Aprano wrote: Does anyone here use slices (or range/xrange) with negative strides other than -1? E.g. sequence[2:15:-3] In 10 ish years I don't recall ever considering it, let alone doing it. -- Python is the second best programming language in the world. But th

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

2013-10-29 Thread Jean-Michel Pichavant
- Original Message - > Hi, > > If I try to use: > > from .common.common_foo import setup_foo_logging > > I get: > > ValueError: Attempted relative import in non-package If you're using python 3, forget what I said about not using relative imports. I think they've implemented t

Re: Slicing with negative strides

2013-10-29 Thread Mark Lawrence
On 29/10/2013 08:53, Duncan Booth wrote: Steven D'Aprano wrote: Does anyone here use slices (or range/xrange) with negative strides other than -1? E.g. sequence[2:15:-3] With any negative stride your example is just the empty sequence. If so, there is a discussion (long, long, looon

problem importing

2013-10-29 Thread C. Ng
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" unless my current working directory is in xyz. Appreciate your help. Thanks. -- https://mail.p

Re: Slicing with negative strides

2013-10-29 Thread Terry Reedy
On 10/29/2013 4:53 AM, Duncan Booth wrote: Steven D'Aprano wrote: Does anyone here use slices (or range/xrange) with negative strides other than -1? E.g. sequence[2:15:-3] With any negative stride your example is just the empty sequence. The idea is that one would not have to reverse 2 an

Re: problem importing

2013-10-29 Thread Peter Otten
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" > unless my current working directory is in xyz. Appreciate your help. > Tha

[OT] Re: Python Front-end to GCC

2013-10-29 Thread Antoine Pitrou
Steven D'Aprano pearwood.info> writes: > > On Fri, 25 Oct 2013 21:36:42 +0100, Mark Lawrence wrote: > > > Mind you, the thought of a bot with a Ph.D. is mind boggling. > > You can buy degrees on the Internet quite cheaply: > > http://en.wikipedia.org/wiki/List_of_animals_with_fraudulent_diplom

Re: Slicing with negative strides

2013-10-29 Thread Steven D'Aprano
On Tue, 29 Oct 2013 08:53:08 +, Duncan Booth wrote: > Steven D'Aprano wrote: > >> Does anyone here use slices (or range/xrange) with negative strides >> other than -1? >> >> E.g. sequence[2:15:-3] > > With any negative stride your example is just the empty sequence. Gah, sorry about that,

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

2013-10-29 Thread Skybuck Flying
Because it's logical. " What is logical? " 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. Example: Loop NextCode ^ Placing the exit ondition near next code makes more sense at lea

Help with guessing game :D

2013-10-29 Thread Robert Gonda
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 user to input their name N = raw_input() #What the user

Re: Help with guessing game :D

2013-10-29 Thread Chris Angelico
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 that it's thinking of a number betweeen 1 > to 1000 > guess = input() > gue

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

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: 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 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: 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 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 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 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: 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 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 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: 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: 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: 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: 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: 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: 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: 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 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: 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: 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. >> >> >> >> >> >> --

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 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

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 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: 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 (

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: 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

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: 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 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 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 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: 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)

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: 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

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: 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)))

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: 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 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: 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: 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: 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: 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: 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: 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: 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 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: 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 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 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: 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: 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: 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: 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: 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: 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: 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: 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 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: 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 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

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: 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

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: 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=

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: 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

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, ...

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

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

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

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: 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

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: 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

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: 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: 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

  1   2   >