Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Ben Finney
Mark Lawrence writes: > On 28/09/2013 19:38, Zero Piraeus wrote: > > To be clear, Mark, you are calling for Νίκος to be tortured to death > > with a red hot poker, yes? > > Not tortured, simply murdered so we don't have to put up with his > completely unacceptable behaviour Regardless of the beh

Re: card dealer

2013-09-28 Thread Tim Roberts
Antoon Pardon wrote: > >Op 28-09-13 12:31, Ned Batchelder schreef: >> >> I've thought that way about it too: there are so many shuffles any way, >> it won't be a problem. But think about it like this: if you shuffle a >> deck of 52 cards with a default Python random object, then once you have >>

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Chris Angelico
On Sun, Sep 29, 2013 at 4:45 AM, Mark Lawrence wrote: > Not tortured, simply murdered so we don't have to put up with his completely > unacceptable behaviour, which sadly is thriving owing to so many people > ignoring the "do not feed this moron" signs. You miss one important factor in these disc

Re: Weird bahaviour from shlex - line no

2013-09-28 Thread Piet van Oostrum
Peter Otten <__pete...@web.de> writes: > Dave Angel wrote: > >> On 28/9/2013 02:26, Daniel Stojanov wrote: >> >>> Can somebody explain this. The line number reported by shlex depends >>> on the previous token. I want to be able to tell if I have just popped >>> the last token on a line. [...] > T

Re: Understanding how is a function evaluated using recursion

2013-09-28 Thread Peter Cacioppi
On Thursday, September 26, 2013 7:23:47 AM UTC-7, Neil Cerutti wrote: > On 2013-09-26, Neil Cerutti wrote: > > > def flatten(seq): > > > > > > [1] http://en.wiktionary.org/wiki/bikeshed > > > > In that spirit, it occurs to me that given current Python > > nomenclature, 'flattened' would be

Re: Neurolab // "No module named .."

2013-09-28 Thread MRAB
On 28/09/2013 20:06, Mark Lawrence wrote: On 28/09/2013 15:55, FiveHydroxy Tryptamine wrote: Hiya A word of warning, I am a complete beginner. My problem goes like this:: I've been trying to "import neurolab as nl"(a neural network library)and I keep getting the "No module named.." error in my

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Steven D'Aprano
On Sat, 28 Sep 2013 19:45:40 +0100, Mark Lawrence wrote: > Not tortured, simply murdered If your aim was to prove that you're a waste of space than Nikos, you've admirably succeeded. *plonk* -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Neurolab // "No module named .."

2013-09-28 Thread Mark Lawrence
On 28/09/2013 15:55, FiveHydroxy Tryptamine wrote: Hiya A word of warning, I am a complete beginner. My problem goes like this:: I've been trying to "import neurolab as nl"(a neural network library)and I keep getting the "No module named.." error in my Python 2.7.3 shell. There is definitely so

Re: Neurolab // "No module named .."

2013-09-28 Thread Terry Reedy
On 9/28/2013 10:55 AM, FiveHydroxy Tryptamine wrote: Hiya A word of warning, I am a complete beginner. My problem goes like this:: I've been trying to "import neurolab as nl"(a neural network library)and I keep getting the "No module named.." error in my Python 2.7.3 shell. There is definitely so

Re: Python Unit Tests

2013-09-28 Thread Terry Reedy
On 9/28/2013 12:52 AM, melw...@gmail.com wrote: [How can I test...] import random intro = 'I have chosen a number from 1-10' request = 'Guess a number: ' responseHigh = "That's too high." responseLow = "That's too low." responseCorrect = "That's right!" goodbye = 'Goodbye and thanks for playin

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Mark Lawrence
On 28/09/2013 19:38, Zero Piraeus wrote: : On Sat, Sep 28, 2013 at 1:53 PM, Mark Lawrence wrote: You actually need the tool that was used on King Edward II. To be clear, Mark, you are calling for Νίκος to be tortured to death with a red hot poker, yes? I'm going to go out on a limb and sugg

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Zero Piraeus
: > On Sat, Sep 28, 2013 at 1:53 PM, Mark Lawrence wrote: > > You actually need the tool that was used on King Edward II. To be clear, Mark, you are calling for Νίκος to be tortured to death with a red hot poker, yes? I'm going to go out on a limb and suggest that such a suggestion is outside wh

Re: replace only full words

2013-09-28 Thread cerr
On Saturday, September 28, 2013 11:17:19 AM UTC-7, Tim Chase wrote: > [mercy, you could have trimmed down that reply] > > > > On 2013-09-28 10:43, cerr wrote: > > > On Saturday, September 28, 2013 4:54:35 PM UTC, Tim Chase wrote: > > >> import re > > > > > > Great, only I don't have the re

Re: replace only full words

2013-09-28 Thread cerr
On Saturday, September 28, 2013 11:07:11 AM UTC-7, MRAB wrote: > On 28/09/2013 18:43, cerr wrote: > > [snip] > > > Great, only I don't have the re module on my system :( > > > > > Really? It's part of Python's standard distribution. Oh no, sorry, mis-nformation, i DO have module re availab

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Joel Goldstick
On Sat, Sep 28, 2013 at 1:53 PM, Mark Lawrence wrote: > On 28/09/2013 17:14, Νίκος wrote: > > I know what he has said bit this is now what i need. >> > > You actually need the tool that was used on King Edward II. > > > -- > Cheers. > > Mark Lawrence > > -- > https://mail.python.org/**mailman/lis

Re: replace only full words

2013-09-28 Thread Tim Chase
[mercy, you could have trimmed down that reply] On 2013-09-28 10:43, cerr wrote: > On Saturday, September 28, 2013 4:54:35 PM UTC, Tim Chase wrote: >> import re > > Great, only I don't have the re module on my system :( Um, it's a standard Python library. You sure about that? http://docs

Re: replace only full words

2013-09-28 Thread MRAB
On 28/09/2013 18:43, cerr wrote: [snip] Great, only I don't have the re module on my system :( Really? It's part of Python's standard distribution. -- https://mail.python.org/mailman/listinfo/python-list

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Mark Lawrence
On 28/09/2013 17:14, Νίκος wrote: I know what he has said bit this is now what i need. You actually need the tool that was used on King Edward II. -- Cheers. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list

Re: automated unit test generation

2013-09-28 Thread Paul Rubin
skunkwerk writes: > - how difficult/tedious is writing unit tests, and why? The important thing is to write the tests at the same time as the code. If you do that, it's not too bad. It means the code is then organized around the tests and vice versa. Keeping tests in sync with changes to code c

Re: replace only full words

2013-09-28 Thread cerr
On Saturday, September 28, 2013 4:54:35 PM UTC, Tim Chase wrote: > On 2013-09-28 09:11, cerr wrote: > > > I have a list of sentences and a list of words. Every full word > > > that appears within sentence shall be extended by i.e. "I > > > drink in the house." Would become "I in the ." (and >

Re: replace only full words

2013-09-28 Thread Jussi Piitulainen
MRAB writes: > On 28/09/2013 17:11, cerr wrote: > > Hi, > > > > I have a list of sentences and a list of words. Every full word > > that appears within sentence shall be extended by i.e. "I > > drink in the house." Would become "I in the ." (and > > not "I in the .")I have attempted it like thi

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread rusi
On Friday, September 27, 2013 4:13:52 PM UTC+5:30, Dave Angel wrote: > You should study APL. Many functions were written in one line, with > twenty lines of explanation. The function itself was considered > unreadable nonsense. And if a function stopped working, general wisdom > was to throw it o

Re: Help me with Python please (picture)

2013-09-28 Thread Dave Angel
On 28/9/2013 12:17, dvgh...@gmail.com wrote: > On Saturday, September 28, 2013 12:43:42 AM UTC, jae...@gmail.com wrote: >> >> >> >> Can't seem to be getting an output. > Overall I wrote my own version of the code and this is what I got: > > > ** > import string > import

automated unit test generation

2013-09-28 Thread skunkwerk
Hi, I've been working on an open source project to auto-generate unit tests for web apps based on traces collected from the web server and static code analysis. I've got an alpha version online at www.splintera.com, and the source is at https://github.com/splintera/python-django-client. I'd

Re: replace only full words

2013-09-28 Thread MRAB
On 28/09/2013 17:11, cerr wrote: Hi, I have a list of sentences and a list of words. Every full word that appears within sentence shall be extended by i.e. "I drink in the house." Would become "I in the ." (and not "I in the .")I have attempted it like this: for sentence in sentences:

Re: replace only full words

2013-09-28 Thread Tim Chase
On 2013-09-28 09:11, cerr wrote: > I have a list of sentences and a list of words. Every full word > that appears within sentence shall be extended by i.e. "I > drink in the house." Would become "I in the ." (and > not "I in the .") This is a good place to reach for regular expressions. It com

Re: Help me with Python please (picture)

2013-09-28 Thread Joel Goldstick
On Sat, Sep 28, 2013 at 12:17 PM, wrote: > On Saturday, September 28, 2013 12:43:42 AM UTC, jae...@gmail.com wrote: > > http://imgur.com/E6vrNs4 > > > > > > > > > > > > Can't seem to be getting an output. > > All the comments about using an image to ask for help over here is > extremely valid so

Re: Neurolab // "No module named .."

2013-09-28 Thread Dave Angel
On 28/9/2013 10:55, FiveHydroxy Tryptamine wrote: > Hiya > A word of warning, I am a complete beginner. > My problem goes like this:: I've been trying to "import neurolab as nl"(a > neural network library)and I keep getting the "No module named.." error in my > Python 2.7.3 shell. There is defin

Re: Which Python Framework for REST API and Facebook Wrapper?

2013-09-28 Thread Joel Goldstick
On Sat, Sep 28, 2013 at 12:20 PM, wrote: > I will be designing a REST based API for a cross-platform back end that > will serve both desktop Facebook users as well as mobile users. It will > handle operations such as user creation, retrieval of user and other data, > payment verification and in t

Which Python Framework for REST API and Facebook Wrapper?

2013-09-28 Thread harry . andrei
I will be designing a REST based API for a cross-platform back end that will serve both desktop Facebook users as well as mobile users. It will handle operations such as user creation, retrieval of user and other data, payment verification and in the case of the desktop side, handle the html/css

Re: Help me with Python please (picture)

2013-09-28 Thread dvghana
On Saturday, September 28, 2013 12:43:42 AM UTC, jae...@gmail.com wrote: > http://imgur.com/E6vrNs4 > > > > > > Can't seem to be getting an output. All the comments about using an image to ask for help over here is extremely valid so I hope you accept it in good faith. I am a noob like you s

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Νίκος
Στις 28/9/2013 6:02 μμ, ο/η Andreas Perstinger έγραψε: Νίκος wrote: Στις 28/9/2013 1:19 μμ, ο/η Chris Angelico έγραψε: [ROLL] Rosuav rolls his eyes: 1, 1, totalling 2. Then split your try blocks! You've already been told this. No we didn't have said this. if you are referring to this: At

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Joel Goldstick
On Sat, Sep 28, 2013 at 9:53 AM, Antoon Pardon wrote: > Op 28-09-13 00:06, Νίκος schreef: > > Στις 27/9/2013 8:00 μμ, ο/η Grant Edwards έγραψε: >> >>> On 2013-09-27, ?? wrote: >>> >>> Sure your method follows the the logic in a straighforward way step-by-step but i just dont want

replace only full words

2013-09-28 Thread cerr
Hi, I have a list of sentences and a list of words. Every full word that appears within sentence shall be extended by i.e. "I drink in the house." Would become "I in the ." (and not "I in the .")I have attempted it like this: for sentence in sentences: for noun in nouns: if " "+n

Re: Neurolab // "No module named .."

2013-09-28 Thread Joel Goldstick
On Sat, Sep 28, 2013 at 10:55 AM, FiveHydroxy Tryptamine < lilithsol...@gmail.com> wrote: > Hiya > A word of warning, I am a complete beginner. > My problem goes like this:: I've been trying to "import neurolab as nl"(a > neural network library)and I keep getting the "No module named.." error in >

Re: card dealer

2013-09-28 Thread Antoon Pardon
Op 28-09-13 12:31, Ned Batchelder schreef: On 9/28/13 2:01 AM, Steven D'Aprano wrote: On Fri, 27 Sep 2013 17:40:46 -0400, Ned Batchelder wrote: On 9/27/13 12:10 PM, Denis McMahon wrote: On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: i recall writing a shuffle function in C decades ag

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Antoon Pardon
Op 28-09-13 00:06, Νίκος schreef: Στις 27/9/2013 8:00 μμ, ο/η Grant Edwards έγραψε: On 2013-09-27, ?? wrote: Sure your method follows the the logic in a straighforward way step-by-step but i just dont want to spent almost 20 lines of code just to calculate 2 variables(city and host).

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Andreas Perstinger
Νίκος wrote: >Στις 28/9/2013 1:19 μμ, ο/η Chris Angelico έγραψε: >> [ROLL] Rosuav rolls his eyes: 1, 1, totalling 2. >> >> Then split your try blocks! You've already been told this. >> >No we didn't have said this. if you are referring to this: At least Denis told you about 24 hours ago: https:/

Neurolab // "No module named .."

2013-09-28 Thread FiveHydroxy Tryptamine
Hiya A word of warning, I am a complete beginner. My problem goes like this:: I've been trying to "import neurolab as nl"(a neural network library)and I keep getting the "No module named.." error in my Python 2.7.3 shell. There is definitely something wrong with my Python path, although everythi

Re: Weird bahaviour from shlex - line no

2013-09-28 Thread Peter Otten
Dave Angel wrote: > On 28/9/2013 02:26, Daniel Stojanov wrote: > >> Can somebody explain this. The line number reported by shlex depends >> on the previous token. I want to be able to tell if I have just popped >> the last token on a line. >> > > I agree that it seems weird. However, I don't th

Re: Weird bahaviour from shlex - line no

2013-09-28 Thread Dave Angel
On 28/9/2013 02:26, Daniel Stojanov wrote: > Can somebody explain this. The line number reported by shlex depends > on the previous token. I want to be able to tell if I have just popped > the last token on a line. > I agree that it seems weird. However, I don't think you have made clear why it'

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Νίκος
Στις 28/9/2013 1:19 μμ, ο/η Chris Angelico έγραψε: On Sat, Sep 28, 2013 at 7:33 PM, Νίκος wrote: It woould be nice if we could write it as: ipval = ( os.environ.get('HTTP_CF_CONNECTING_IP') or os.environ.get('REMOTE_ADDR', "Cannot Resolve") ) try: gi = pygeoip.GeoIP('/usr/local/share

Re: card dealer

2013-09-28 Thread Dave Angel
On 28/9/2013 06:31, Ned Batchelder wrote: > > I've thought that way about it too: there are so many shuffles any way, > it won't be a problem. But think about it like this: if you shuffle a > deck of 52 cards with a default Python random object, then once you have > dealt out only 28 car

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Robert Kern
On 2013-09-27 11:43, Dave Angel wrote: You should study APL. Many functions were written in one line, with twenty lines of explanation. The function itself was considered unreadable nonsense. And if a function stopped working, general wisdom was to throw it out, and re-implement the explanatio

Re: Weird bahaviour from shlex - line no

2013-09-28 Thread Andreas Perstinger
On 28.09.2013 08:26, Daniel Stojanov wrote: Can somebody explain this. The line number reported by shlex depends on the previous token. I want to be able to tell if I have just popped the last token on a line. [SNIP] second = shlex.shlex("word1 word2,\nword3") Punctuation characters like th

ANN: psutil 1.1.0 released

2013-09-28 Thread Giampaolo Rodola'
Hi there folks, I'm pleased to announce the 1.1.0 release of psutil: http://code.google.com/p/psutil/ === About === psutil is a module providing an interface for retrieving information on all running processes and system utilization (CPU, memory, disks, network, users) in a portable way by using

Re: card dealer

2013-09-28 Thread Ned Batchelder
On 9/28/13 2:01 AM, Steven D'Aprano wrote: On Fri, 27 Sep 2013 17:40:46 -0400, Ned Batchelder wrote: On 9/27/13 12:10 PM, Denis McMahon wrote: On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: i recall writing a shuffle function in C decades ago, which took an array of (52) unique items

Re: What's the best way to extract 2 values from a CSV file from each row systematically?

2013-09-28 Thread Luca Cerone
> I'd really appreciate any suggestions or help, thanks in advance! Hi Alex if you know that you want only columns 3 and 5, you could also use list comprehension to fetch the values: import csv with open('yourfile.csv','rU') as fo: #the rU means read using Universal newlines cr = csv.reader(

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Chris Angelico
On Sat, Sep 28, 2013 at 7:33 PM, Νίκος wrote: > It woould be nice if we could write it as: > > > ipval = ( os.environ.get('HTTP_CF_CONNECTING_IP') or > os.environ.get('REMOTE_ADDR', "Cannot Resolve") ) > try: > gi = pygeoip.GeoIP('/usr/local/share/GeoIPCity.dat') > city = gi.time_z

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Νίκος
Στις 28/9/2013 1:26 πμ, ο/η Dave Angel έγραψε: On 27/9/2013 18:06, Νίκος wrote: city = "Άγνωστη Πόλη" host = "Άγνωστη Προέλευση" If they were to have the same string assigned to them it should be okey but they do not. Or perhaps you can even still think of writing the above into 1-liner wha

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Νίκος
Στις 28/9/2013 4:59 πμ, ο/η Chris Angelico έγραψε: On Sat, Sep 28, 2013 at 8:06 AM, Νίκος wrote: Well to tell the truth no matter what you say to me if something can be written in less lines than another implementation but still retain its simplicity and straightforward logic behind it i would