Re: Referrer key missing form os.environ dictionary?

2013-09-26 Thread Chris Angelico
On Fri, Sep 27, 2013 at 9:27 AM, Grant Edwards wrote: > I probably should have said "stdin", but in theory you can pass data > in via multiple file descriptors. Nobody does that except people > cooking up obscure examples for advanced shell scripting guides... Yep. With that variant, I agree tha

Re: Nosetests

2013-09-26 Thread Steven D'Aprano
On Thu, 26 Sep 2013 21:20:52 -0700, melwin9 wrote: > I modified the guess.py file but am unable to run it, What does that mean? How do you try to run it? What happens when you do? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Nosetests

2013-09-26 Thread melwin9
I modified the guess.py file but am unable to run it, how do I go about writing tests for this. import random guessesTaken = 0 number = random.randint(1, 10) intro = 'I have chosen a number from 1-10' request = 'Guess a number: ' responseHigh = "That's too high." responseLow = "That's too lo

Re: Nosetests

2013-09-26 Thread melwin9
The question was more like what tests should I be writing, fine if I remove the pexpect test I tried the test_guess & test_guesstoolow and still unable to get it to work. So if i Want to ask for a number and typed a number which is at random indicated by the top of the code, how do I proceed on

Re: Nosetests

2013-09-26 Thread Roy Smith
In article , melw...@gmail.com wrote: > Initially I was shown pexpect, leaving that there, Can i make up 5 tests? I > tried tests two different ways and no luck. What am I supposed to be writing > up when I do a test and is there a particular way I can/should be referencing > it back to its ma

Re: Nosetests

2013-09-26 Thread melwin9
Initially I was shown pexpect, leaving that there, Can i make up 5 tests? I tried tests two different ways and no luck. What am I supposed to be writing up when I do a test and is there a particular way I can/should be referencing it back to its main file? THis is what I have for the test_guess

Re: work develope matrix of difusive concentration

2013-09-26 Thread rusi
On Friday, September 27, 2013 12:43:51 AM UTC+5:30, D.YAN ESCOLAR RAMBAL wrote: > Good morning all > > thanks for your help. Now I`ve a question, if I need create a matrix, method > of thomas, ghost nodes, etc.. for developed one aplicative for the ecuation > of difusion in 1d, 2d, 3d, 4d. It`s

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

2013-09-26 Thread alex23
On 26/09/2013 6:39 PM, Νίκος wrote: You dont have to be ironic. I dont have the experience you do. This is bulshytt. You only just a few days ago started a thread in which handling lookups in dictionaries with potentially non-existent keys was dealt with. At length. And now you're restructuri

Re: Referrer key missing form os.environ dictionary?

2013-09-26 Thread Grant Edwards
On 2013-09-26, Chris Angelico wrote: > On Fri, Sep 27, 2013 at 12:11 AM, Grant Edwards > wrote: >> On a Unix system when you invoke a program, you "pass" it four things: >> >> 1) A dictionary where keys/values are both strings [enviornment variables] >> 2) A list of strings [command line args]

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

2013-09-26 Thread Dave Angel
On 26/9/2013 18:14, Νίκος wrote: > Στις 26/9/2013 11:16 μμ, ο/η Denis McMahon έγραψε: >> On Thu, 26 Sep 2013 19:58:02 +0300, Νίκος wrote: >> >>> except socket.gaierror as e: >>> city = host = "UnKnown Origin" >>> >>> But then what if in case of an error i needed different string set to be >>>

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 11:16 μμ, ο/η Denis McMahon έγραψε: On Thu, 26 Sep 2013 19:58:02 +0300, Νίκος wrote: except socket.gaierror as e: city = host = "UnKnown Origin" But then what if in case of an error i needed different string set to be assigned on city and host respectively? Oh FFS Are

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

2013-09-26 Thread Dave Angel
On 26/9/2013 12:58, Νίκος wrote: > But actually i have 2 variables that relay on a proper ip address. > > ipval = ( os.environ.get('HTTP_CF_CONNECTING_IP') or > os.environ.get('REMOTE_ADDR', "UnKnown Origin") ) > try: > gi = pygeoip.GeoIP('/usr/local/share/GeoIPCity.dat') > city

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

2013-09-26 Thread Denis McMahon
On Thu, 26 Sep 2013 19:58:02 +0300, Νίκος wrote: > except socket.gaierror as e: > city = host = "UnKnown Origin" > > But then what if in case of an error i needed different string set to be > assigned on city and host respectively? Oh FFS Are you serious when you ask this? Simply change:

work develope matrix of difusive concentration

2013-09-26 Thread D.YAN ESCOLAR RAMBAL
Good morning all thanks for your help. Now I`ve a question, if I need create a matrix, method of thomas, ghost nodes, etc.. for developed one aplicative for the ecuation of difusion in 1d, 2d, 3d, 4d. It`s better use phyton 3.3 or 2.7?, if the answer is phyton 3.3 that interpreter is similar to ap

Re: Convert namedtuple to dictionary

2013-09-26 Thread Virendra Tripathi
Thanks guys! BTW, please ignore the follow-up question there. I had written a script earlier which had a dict like: {'a':[x=10, y=23,..], 'b': [x=10, y=23,…],…..} I was thinking about that and therefore the error. Apologies. -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert namedtuple to dictionary

2013-09-26 Thread Ned Batchelder
On 9/26/13 1:42 PM, Ned Batchelder wrote: On 9/26/13 1:17 PM, Virendra Tripathi wrote: Hi Ned, Thanks. Wouldn't I have to first create a function to pull out the 'dictdict' from the data? I assume 'dictdict' refers to the 'brucelee' named tuple in the example. That's where I was getting stuc

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-26 Thread Piet van Oostrum
Nils Bunger writes: > Hi Neil, > > Thanks for looking at this. > > I'm trying to create a multipart MIME for an HTTP POST request, not an > email. This is for a third-party API that requires a multipart POST > with a binary file, so I don't have the option to just use a different > encoding. >

Re: Download all youtube favorites with youtube-dl script

2013-09-26 Thread MRAB
On 26/09/2013 19:14, Bill wrote: Joel Goldstick wrote: On Thu, Sep 26, 2013 at 11:13 AM, Bill mailto:b...@bill.com>> wrote: I have been using the script youtube-dl http://rg3.github.io/youtube-__dl/ And I was wondering if there is a way to down

Re: Download all youtube favorites with youtube-dl script

2013-09-26 Thread Bill
Joel Goldstick wrote: On Thu, Sep 26, 2013 at 11:13 AM, Bill mailto:b...@bill.com>> wrote: I have been using the script youtube-dl http://rg3.github.io/youtube-__dl/ And I was wondering if there is a way to download all of a user's favorites

Re: Convert namedtuple to dictionary

2013-09-26 Thread Ned Batchelder
On 9/26/13 1:17 PM, Virendra Tripathi wrote: Hi Ned, Thanks. Wouldn't I have to first create a function to pull out the 'dictdict' from the data? I assume 'dictdict' refers to the 'brucelee' named tuple in the example. That's where I was getting stuck-trying to pull out the named tuples from

Re: Convert namedtuple to dictionary

2013-09-26 Thread Tim Chase
On 2013-09-26 16:42, Virendra Tripathi wrote: > Thx Tim. Your solution works. After Steven's reply, I recommend dict((k,v._asdict()) for k,v in d.iteritems()) which simplifies matters. -tkc -- https://mail.python.org/mailman/listinfo/python-list

Re: Convert namedtuple to dictionary

2013-09-26 Thread Virendra Tripathi
Hi Ned, Thanks. Wouldn't I have to first create a function to pull out the 'dictdict' from the data? I assume 'dictdict' refers to the 'brucelee' named tuple in the example. That's where I was getting stuck-trying to pull out the named tuples from the dict and operate on it. Thanks, Virendra

Re: Convert namedtuple to dictionary

2013-09-26 Thread Virendra Tripathi
Hi MRAB, Thanks. Learning a lot thanks to you guys. I should have mentioned that the data is dynamic, in the sense that 'brucelee' could be 'jackiechan' , the number of named tuples - i.e., 'brucelee(…)', could change as well, the next time data is pulled in. The format of the data would howev

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 5:22 μμ, ο/η Dave Angel έγραψε: On 26/9/2013 09:34, Νίκος wrote: Στις 26/9/2013 3:53 μμ, ο/η Antoon Pardon έγραψε: Op 26-09-13 14:39, Νίκος schreef: Yes, you are right, in my shell it fails too givign the same error message as yours, while on the other had in the websste is wor

Re: Convert namedtuple to dictionary

2013-09-26 Thread Virendra Tripathi
Thx Tim. Your solution works. I am, as you can probably tell, a newbie at Python. -- https://mail.python.org/mailman/listinfo/python-list

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-26 Thread Nils Bunger
Hi all, I was able to workaround this problem by encoding a unique 'marker' in the binary part, then replacing the marker with the actual binary content after generating the MIME message. See my answer on Stack Overflow http://stackoverflow.com/a/19033750/526098 for the code. Thanks, your s

Re: Download all youtube favorites with youtube-dl script

2013-09-26 Thread Philipp Hagemeister
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hi Bill, the best way to ask for features or file bugs on youtube-dl is asking us at http://github.com/rg3/youtube-dl/issues . Luckily, I this list from time to time ;) Simply use youtube-dl --username u...@gmail.com --password secret :ytfav Best

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-26 Thread Nils Bunger
Hi Neil, Thanks for looking at this. I'm trying to create a multipart MIME for an HTTP POST request, not an email. This is for a third-party API that requires a multipart POST with a binary file, so I don't have the option to just use a different encoding. Multipart HTTP is standardized in

Upload Windows binaries on pypi from Linux

2013-09-26 Thread Giampaolo Rodola'
I have a Python extension module (psutil) written in C which I compile for different Python versions (from 2.4 to 3.3) and want to upload them on pypi. The Windows machine is not connected to internet so after I generate the Windows binaries (via setup.py bdist_wininst) I move the .exe files from

Re: Download all youtube favorites with youtube-dl script

2013-09-26 Thread Joel Goldstick
On Thu, Sep 26, 2013 at 11:13 AM, Bill wrote: > I have been using the script youtube-dl > http://rg3.github.io/youtube-**dl/ > > And I was wondering if there is a way to download all of a user's > favorites or uploads. > > The script has a functionality to downl

Re: Referrer key missing form os.environ dictionary?

2013-09-26 Thread Chris Angelico
On Fri, Sep 27, 2013 at 12:11 AM, Grant Edwards wrote: > On a Unix system when you invoke a program, you "pass" it four things: > > 1) A dictionary where keys/values are both strings [enviornment variables] > 2) A list of strings [command line args] > 3) A set of open file descriptors. > 4) Th

Download all youtube favorites with youtube-dl script

2013-09-26 Thread Bill
I have been using the script youtube-dl http://rg3.github.io/youtube-dl/ And I was wondering if there is a way to download all of a user's favorites or uploads. The script has a functionality to download all videos in a txt file. So if there is a way using the youtube API or JSON (none of whi

Re: Proposal: [... for ... while cond(x)]

2013-09-26 Thread Nick Mellor
On Friday, 27 September 2013 00:39:30 UTC+10, Nick Mellor wrote: [snip] > for x in xs: > if not emit: > if cond(x): > emit = True > else: > yield e(x) > Oops! for x in xs: if not emit: if cond(x): emit = True yield e(x) els

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

2013-09-26 Thread Denis McMahon
On Thu, 26 Sep 2013 12:56:19 +0300, Νίκος wrote: > Its logic is simple and straightforward but too many lines: There is no "too many lines." > this is much better in my opinion and straighforward also and more clear > to read ... it doens't work though: This is just a stupid attitude for a code

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

2013-09-26 Thread Denis McMahon
On Thu, 26 Sep 2013 14:25:55 +0300, Νίκος wrote: > Okey then please tell me, what do you see wrong in it: > > socket.gethostbyaddr( os.environ.get('HTTP_CF_CONNECTING_IP') If os.environ.get('HTTP_CF_CONNECTING_IP') is false > or os.environ.get('REMOTE_ADDR') and os.environ.get('REMOTE_ADDR')

Re: Proposal: [... for ... while cond(x)]

2013-09-26 Thread Nick Mellor
Hi all, It might be a risk that we create some hairy or subtle semantics, but perhaps this idea has legs. The 'pythonic' syntax is very attractive. # skip the silence at the start data = (amp for amp in signal from abs(amp) > 0.05) # drop files that are less than 600 bytes # (already sorted int

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

2013-09-26 Thread Denis McMahon
On Thu, 26 Sep 2013 12:56:19 +0300, Νίκος wrote: > host = socket.gethostbyaddr( os.environ.get('HTTP_CF_CONNECTING_IP') or > os.environ.get('REMOTE_ADDR') or "Άγνωστη Προέλευση" ) Perhaps you need something that looks more like: some_value = some_function_of( some_value ) or some_function_of (

Re: Understanding how is a function evaluated using recursion

2013-09-26 Thread Neil Cerutti
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 a better name. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

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

2013-09-26 Thread Dave Angel
On 26/9/2013 09:34, Νίκος wrote: > Στις 26/9/2013 3:53 μμ, ο/η Antoon Pardon έγραψε: >> Op 26-09-13 14:39, Νίκος schreef: >>> Yes, you are right, in my shell it fails too givign the same error >>> message as yours, while on the other had in the websste is working. >>> >>> Can you explain this plea

Re: Understanding how is a function evaluated using recursion

2013-09-26 Thread Neil Cerutti
On 2013-09-25, Arturo B wrote: > Hi, I'm doing Python exercises and I need to write a function > to flat nested lists as this one: > > [[1,2,3],4,5,[6,[7,8]]] > > To the result: > > [1,2,3,4,5,6,7,8] > > So I searched for example code and I found this one that uses > recursion (that I don't under

Re: Referrer key missing form os.environ dictionary?

2013-09-26 Thread Grant Edwards
On 2013-09-26, Chris Angelico wrote: > On Thu, Sep 26, 2013 at 11:32 AM, Terry Reedy wrote: >> Since CGI uses stdout for the finished product, it could have used stdin for >> the input. > > Haven't used CGI in years, but I thought POST data came on stdin? Yes. The user data is read via stdin.

Re: Referrer key missing form os.environ dictionary?

2013-09-26 Thread Grant Edwards
On 2013-09-26, Steven D'Aprano wrote: > On Wed, 25 Sep 2013 15:18:41 +, Grant Edwards wrote: > >>> The Referer is not an environment variable. >> >> It is when you're writing a CGI app. >> >>> How would your shell know what URL you were just browsing? >> >> Because the HTTP server sets thos

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-26 Thread Neil Cerutti
On 2013-09-26, Chris Angelico wrote: > On Thu, Sep 26, 2013 at 2:23 PM, Nils Bunger wrote: >> Yes, it's email.mime.MIMEApplication. I've pasted a snippet >> with the imports below. >> >> I'm trying to use this to build a multi-part MIME message, >> with this as one part. >> >> I really can't figu

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 3:53 μμ, ο/η Antoon Pardon έγραψε: Op 26-09-13 14:39, Νίκος schreef: Yes, you are right, in my shell it fails too givign the same error message as yours, while on the other had in the websste is working. Can you explain this please? why doesnt it fail to both enviroments? Your

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

2013-09-26 Thread Antoon Pardon
Op 26-09-13 14:39, Νίκος schreef: > Yes, you are right, in my shell it fails too givign the same error > message as yours, while on the other had in the websste is working. > > Can you explain this please? > why doesnt it fail to both enviroments? Your site and your shell are two different enviro

Re: Extracting lines from text files - script with a couple of 'side effects'

2013-09-26 Thread mstagliamonte
Hi, Thanks for the answers! And Dave, thanks for explaining the cause of the problem I will keep that in mind for the future. You're right, I am doing the search backward, it just seemed easier for me to do it in that way. Looks like I need to keep practising... Both your suggestions work, I w

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 2:24 μμ, ο/η Dave Angel έγραψε: On 26/9/2013 06:51, Νίκος wrote: socket.gethostbyaddr( os.environ.get('HTTP_CF_CONNECTING_IP') or os.environ.get('REMOTE_ADDR') or "Άγνωστη Προέλευση" )[0] Traceback (most recent call last): File "", line 1, in socket.gaierror: [Errno -

Problem when installing Boost.Python

2013-09-26 Thread Wenlong Wang
Hi, All I'm not sure if am asking in the right place, but since this is Python related, I'd like to try it out. My setup is Windows7 64-bit, Python 2.7 64bit, Boost 1.54, Visual Studio 2012 Express Version 64bit. I am a beginner of Python, and am trying to bridge Python and C++. Thus I dow

Re: Convert namedtuple to dictionary

2013-09-26 Thread Tim Chase
On 2013-09-26 01:08, Steven D'Aprano wrote: > On Wed, 25 Sep 2013 18:41:25 -0500, Tim Chase wrote about > namedtuple: > > > While it uses the "private" member-variable "_fields", you can do > > It's not actually private! > > namedtuple is documented as an exception to the rule that methods > st

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

2013-09-26 Thread Antoon Pardon
Op 26-09-13 13:25, Νίκος schreef: >> > Okey then please tell me, what do you see wrong in it: > > socket.gethostbyaddr( os.environ.get('HTTP_CF_CONNECTING_IP') or > os.environ.get('REMOTE_ADDR') or "Άγνωστη Προέλευση" )[0] > > the [0] at then end in case the statemnt default to the string? > ple

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 2:07 μμ, ο/η Antoon Pardon έγραψε: Op 26-09-13 12:51, Νίκος schreef: Στις 26/9/2013 1:41 μμ, ο/η Antoon Pardon έγραψε: Op 26-09-13 12:18, Νίκος schreef: Στις 26/9/2013 1:12 μμ, ο/η Antoon Pardon έγραψε: Op 26-09-13 11:56, Νίκος schreef: It is far better than the ifs, even eas

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

2013-09-26 Thread Dave Angel
On 26/9/2013 06:51, Νίκος wrote: > socket.gethostbyaddr( os.environ.get('HTTP_CF_CONNECTING_IP') or >> os.environ.get('REMOTE_ADDR') or "Άγνωστη Προέλευση" )[0] >> Traceback (most recent call last): >>File "", line 1, in >> socket.gaierror: [Errno -2] Name or service not known >> >>

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

2013-09-26 Thread Antoon Pardon
Op 26-09-13 12:51, Νίκος schreef: > Στις 26/9/2013 1:41 μμ, ο/η Antoon Pardon έγραψε: >> Op 26-09-13 12:18, Νίκος schreef: >>> Στις 26/9/2013 1:12 μμ, ο/η Antoon Pardon έγραψε: Op 26-09-13 11:56, Νίκος schreef: >>> >>> It is far better than the ifs, even easier to read, i was just missing a >>

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

2013-09-26 Thread James Harris
"?" wrote in message news:l20utg$278$1...@dont-email.me... > 26/9/2013 12:07 ??, ?/? Antoon Pardon ??: >> Experiment and find out for yourself. That is the only way you will >> acquire the experience and understanding you need. Sure we could >> spoon feed you the line you need, but t

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 1:41 μμ, ο/η Antoon Pardon έγραψε: Op 26-09-13 12:18, Νίκος schreef: Στις 26/9/2013 1:12 μμ, ο/η Antoon Pardon έγραψε: Op 26-09-13 11:56, Νίκος schreef: Στις 26/9/2013 11:55 πμ, ο/η Nobody έγραψε: On Thu, 26 Sep 2013 10:26:48 +0300, Νίκος wrote: How can i wrote the two follow

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

2013-09-26 Thread Antoon Pardon
Op 26-09-13 12:18, Νίκος schreef: > Στις 26/9/2013 1:12 μμ, ο/η Antoon Pardon έγραψε: >> Op 26-09-13 11:56, Νίκος schreef: >>> Στις 26/9/2013 11:55 πμ, ο/η Nobody έγραψε: On Thu, 26 Sep 2013 10:26:48 +0300, Νίκος wrote: > How can i wrote the two following lines so for NOT to throw out

Re: What minimum should a person know before saying "I know Python"

2013-09-26 Thread Schneider
I would say it's a little bit more: You have to know the keywords and (basic) concepts, e.g. you really have to understand what it means, that everything is a class. If you get foreign, you have to be able to understand it. And the other way round, given a problem, you should be able to write a

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 1:12 μμ, ο/η Antoon Pardon έγραψε: Op 26-09-13 11:56, Νίκος schreef: Στις 26/9/2013 11:55 πμ, ο/η Nobody έγραψε: On Thu, 26 Sep 2013 10:26:48 +0300, Νίκος wrote: How can i wrote the two following lines so for NOT to throw out KeyErrors when a key is missing? city = gi.time_zon

Re: Referrer key missing form os.environ dictionary?

2013-09-26 Thread Robert Kern
On 2013-09-26 04:25, Chris Angelico wrote: On Thu, Sep 26, 2013 at 11:32 AM, Terry Reedy wrote: Since CGI uses stdout for the finished product, it could have used stdin for the input. Haven't used CGI in years, but I thought POST data came on stdin? You could just put the whole HTTP request

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

2013-09-26 Thread Antoon Pardon
Op 26-09-13 11:56, Νίκος schreef: > Στις 26/9/2013 11:55 πμ, ο/η Nobody έγραψε: >> On Thu, 26 Sep 2013 10:26:48 +0300, Νίκος wrote: >> >>> How can i wrote the two following lines so for NOT to throw out >>> KeyErrors when a key is missing? >>> >>> city = gi.time_zone_by_addr( os.environ['HTTP_CF_CO

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

2013-09-26 Thread Antoon Pardon
Op 26-09-13 11:31, Νίκος schreef: > Στις 26/9/2013 12:07 μμ, ο/η Antoon Pardon έγραψε: >> Experiment and find out for yourself. That is the only way you will >> acquire the experience and understanding you need. Sure we could >> spoon feed you the line you need, but that will only result in you >>

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 11:55 πμ, ο/η Nobody έγραψε: On Thu, 26 Sep 2013 10:26:48 +0300, Νίκος wrote: How can i wrote the two following lines so for NOT to throw out KeyErrors when a key is missing? city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) or gi.time_zone_by_addr( os.environ['

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

2013-09-26 Thread Maarten
On Thursday, September 26, 2013 11:31:29 AM UTC+2, Ferrous Cranus wrote: > I have tried code and also provided alternative code to solve my problem > which also doesn't solve it. > > So, you cannot accuse me that i'm not trying, that would be the case to > just ask for a line without trying any

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 12:04 μμ, ο/η Jussi Piitulainen έγραψε: Up until now i have this: city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) or gi.time_zone_by_addr( os.environ['REMOTE_ADDR'] ) or "�γν���η Π�λη" can this be written as: city = gi.time_zone_by_addr( os.environ.get('HTTP

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 12:07 μμ, ο/η Antoon Pardon έγραψε: Experiment and find out for yourself. That is the only way you will acquire the experience and understanding you need. Sure we could spoon feed you the line you need, but that will only result in you using that line without any understanding of w

Gamathon By HackerRank

2013-09-26 Thread Hacker Rank
This is HackerRank's second Gamathon. Every month, participants get to code a bot for a new game and get to compete against other bots! The winner takes the title of being the ultimate game programmer. Are you ready for the clash? For more details checkout: https://www.hackerrank.com/contests --

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

2013-09-26 Thread Jussi Piitulainen
Νίκος writes: > > because it raises KeyError exceptions to this: > > > > city = gi.time_zone_by_addr( os.environ.get('HTTP_CF_CONNECTING_IP', > > 'REMOTE_ADDR') )or "�γν���η Π�λη" > > > > host = socket.gethostbyaddr( os.environ.get('HTTP_CF_CONNECTING_IP', > > 'REMOTE_ADDR') )[0] or "�γν���η Π

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

2013-09-26 Thread Antoon Pardon
Op 26-09-13 10:39, Νίκος schreef: > Στις 26/9/2013 11:12 πμ, ο/η Jussi Piitulainen έγραψε: >> Νίκος writes: >> >>> Σ�ις 26/9/2013 10:48 πμ, ο/η Jussi Piitulainen >>> έγ�α�ε: > ί�ος writes: > How can i wrote the two following lines so for NOT to throw out > KeyErrors when a key is missi

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

2013-09-26 Thread Jussi Piitulainen
Νίκος writes: > Σ�ις 26/9/2013 11:12 πμ, ο/η Jussi Piitulainen > έγ�α�ε: > ί�ος writes: > > > >> Σ�ις 26/9/2013 10:48 πμ, ο/η Jussi Piitulainen > >> έγ�α�ε: > ί�ος writes: > >>> > How can i wrote the two following lines so for NOT to throw out > KeyErrors when a key is missing? > >

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 11:39 πμ, ο/η Νίκος έγραψε: Στις 26/9/2013 11:12 πμ, ο/η Jussi Piitulainen έγραψε: Νίκος writes: Σ�ις 26/9/2013 10:48 πμ, ο/η Jussi Piitulainen έγ�α�ε: > ί�ος writes: How can i wrote the two following lines so for NOT to throw out KeyErrors when a key is missing? city = gi.t

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

2013-09-26 Thread Nobody
On Thu, 26 Sep 2013 10:26:48 +0300, Νίκος wrote: > How can i wrote the two following lines so for NOT to throw out > KeyErrors when a key is missing? > > city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) or > gi.time_zone_by_addr( os.environ['REMOTE_ADDR'] ) or > "Άγνωστη

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 11:46 πμ, ο/η Νίκος έγραψε: Στις 26/9/2013 11:39 πμ, ο/η Νίκος έγραψε: Στις 26/9/2013 11:12 πμ, ο/η Jussi Piitulainen έγραψε: Νίκος writes: Σ�ις 26/9/2013 10:48 πμ, ο/η Jussi Piitulainen έγ�α�ε: > ί�ος writes: How can i wrote the two following lines so for NOT to throw out K

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

2013-09-26 Thread Tim Golden
On 26/09/2013 09:41, Chris Angelico wrote: > On Thu, Sep 26, 2013 at 6:12 PM, Jussi Piitulainen > wrote: >> Do you know that you can ask for help({}.get) or help(dict.get) or >> even help(os.environ.get) during such an interactive Python session, >> and Python (unlike Macbeth's spirits from the va

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

2013-09-26 Thread Chris Angelico
On Thu, Sep 26, 2013 at 6:12 PM, Jussi Piitulainen wrote: > Do you know that you can ask for help({}.get) or help(dict.get) or > even help(os.environ.get) during such an interactive Python session, > and Python (unlike Macbeth's spirits from the vasty deep) will answer? Speak, Python, speak! We'r

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 11:12 πμ, ο/η Jussi Piitulainen έγραψε: Νίκος writes: Σ�ις 26/9/2013 10:48 πμ, ο/η Jussi Piitulainen έγ�α�ε: > ί�ος writes: How can i wrote the two following lines so for NOT to throw out KeyErrors when a key is missing? city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNEC

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

2013-09-26 Thread Jussi Piitulainen
Νίκος writes: > Σ�ις 26/9/2013 10:48 πμ, ο/η Jussi Piitulainen > έγ�α�ε: > ί�ος writes: > > > >> How can i wrote the two following lines so for NOT to throw out > >> KeyErrors when a key is missing? > >> > >> city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) or > > ... > >> I was

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

2013-09-26 Thread Νίκος
Στις 26/9/2013 10:48 πμ, ο/η Jussi Piitulainen έγραψε: Νίκος writes: How can i wrote the two following lines so for NOT to throw out KeyErrors when a key is missing? city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) or ... I was under the impression that the 'or' operator wa

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

2013-09-26 Thread Jussi Piitulainen
Νίκος writes: > How can i wrote the two following lines so for NOT to throw out > KeyErrors when a key is missing? > > city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) or ... > I was under the impression that the 'or' operator was handling this > in case one operand was failing

Handling 3 operands in an expression without raising an exception

2013-09-26 Thread Νίκος
Hello, How can i wrote the two following lines so for NOT to throw out KeyErrors when a key is missing? city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) or gi.time_zone_by_addr( os.environ['REMOTE_ADDR'] ) or "Άγνωστη Πόλη" host = socket.gethostbyaddr( os.environ['HTTP_CF_

Re: python IDE and function definition

2013-09-26 Thread Ben Finney
Chris Friesen writes: > I'm running into issues where my current IDE (I'm playing with Komodo) > can't seem to locate the definition, I suspect because it's too > ambiguous. The feature you're looking for – to start from the statement where a function is called, then jump to the statement where