Re: I am out of trial and error again Lists

2014-10-22 Thread Terry Reedy
On 10/22/2014 10:58 PM, Larry Hudson wrote: This give you a list not a string, but that's actually what you want here. If you _really_ want a string, use join(): "".join(list(range(10))) Interactive mode makes it really easy to test before posting. >>> "".join(list(range(10))) Traceback (m

Re: (test) ? a:b

2014-10-22 Thread Vito De Tullio
Dennis Lee Bieber wrote: >> x = [f(), g()] [cond] >> >>the latter evaluates both f() and g() instead of just one. Apart from >>being inefficient, it can have unintended side-effects. > > Ah, but what would > > x = [f, g][cond]() > > produce? headache -- By ZeD -- https://mail.python.org/m

Re: (test) ? a:b

2014-10-22 Thread Gregory Ewing
Chris Angelico wrote: I've seen much MUCH worse... where multiple conditional expressions get combined arithmetically, and then the result used somewhere... In the days of old-school BASIC it was common to exploit the fact that boolean expressions evaluated to 0 or 1 (or -1, depending on your d

Re: I am out of trial and error again Lists

2014-10-22 Thread Rustom Mody
On Thursday, October 23, 2014 8:28:39 AM UTC+5:30, Larry Hudson wrote: > -- Also, from another post: --- > > Thanks a lot for all your suggestions. I haven't learned to use the > > interpreter yet. I do plan on learning to use it. > You are making yourself work several hundred times

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
On Wed, 22 Oct 2014 19:58:24 -0700, Larry Hudson wrote: >On 10/22/2014 05:02 PM, Seymore4Head wrote: >> On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence >> wrote: > > (This is in reference to the line: if y in str(range(10)):) > >>> I suggest you try str(range(10)) from the interactive prompt

Re: I am out of trial and error again Lists

2014-10-22 Thread Larry Hudson
On 10/22/2014 05:02 PM, Seymore4Head wrote: On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence wrote: (This is in reference to the line: if y in str(range(10)):) I suggest you try str(range(10)) from the interactive prompt and see exactly what you get, as it's nothing like what you expect

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
On Wed, 22 Oct 2014 21:35:19 -0400, Seymore4Head wrote: >On Thu, 23 Oct 2014 02:31:57 +0100, MRAB >wrote: > >>On 2014-10-23 01:10, Seymore4Head wrote: >>> On Thu, 23 Oct 2014 11:05:08 +1100, Steven D'Aprano >>> wrote: >>> Seymore4Head wrote: > Those string errors were desperate att

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
On Thu, 23 Oct 2014 11:37:27 +1000, alex23 wrote: >On 23/10/2014 10:02 AM, Seymore4Head wrote: >> On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence >> wrote: >> One more question. >> if y in str(range(10) >> Why doesn't that work. >>> I suggest you try str(range(10)) from the interac

Re: I am out of trial and error again Lists

2014-10-22 Thread alex23
On 23/10/2014 10:02 AM, Seymore4Head wrote: On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence wrote: One more question. if y in str(range(10) Why doesn't that work. I suggest you try str(range(10)) from the interactive prompt and see exactly what you get, as it's nothing like what you expect :

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
On Thu, 23 Oct 2014 02:31:57 +0100, MRAB wrote: >On 2014-10-23 01:10, Seymore4Head wrote: >> On Thu, 23 Oct 2014 11:05:08 +1100, Steven D'Aprano >> wrote: >> >>>Seymore4Head wrote: >>> Those string errors were desperate attempts to fix the "append" error I didn't understand. >>> >>>Ah,

Re: I am out of trial and error again Lists

2014-10-22 Thread MRAB
On 2014-10-23 01:10, Seymore4Head wrote: On Thu, 23 Oct 2014 11:05:08 +1100, Steven D'Aprano wrote: Seymore4Head wrote: Those string errors were desperate attempts to fix the "append" error I didn't understand. Ah, the good ol' "make random changes to the code until the error goes away" te

Re: I am out of trial and error again Lists

2014-10-22 Thread MRAB
On 2014-10-23 01:02, Seymore4Head wrote: On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence wrote: On 23/10/2014 00:26, Seymore4Head wrote: On Wed, 22 Oct 2014 23:55:57 +0100, Mark Lawrence wrote: On 22/10/2014 23:30, Seymore4Head wrote: On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wr

Re: (test) ? a:b

2014-10-22 Thread Steven D'Aprano
Michael Torrie wrote: > On 10/22/2014 05:45 AM, Mark Lawrence wrote: without not: j = [j+1, 3][j>=10] with not: j = [3, j+1][not (j>=10)] >>> >>> Oh it's a trick ! >>> thx >> >> IMHO it's just dreadful. Why people insist on messing around like this >> I really don't know

the ressurection of ZOPE for web domination? bluebream and caveman the answer?

2014-10-22 Thread johannes falcone
i loved the rant about how zope would have all these features, and then some other python framework would come on with like 1 and act like its the bomb, and zope was like we been doing that and more for X years those who dont study zope are doomed to repeat it!!! is zope scoffing at drupal? bot

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
On Thu, 23 Oct 2014 11:05:08 +1100, Steven D'Aprano wrote: >Seymore4Head wrote: > >> Those string errors were desperate attempts to fix the "append" error >> I didn't understand. > >Ah, the good ol' "make random changes to the code until the error goes away" >technique. You know that it never wor

Re: I am out of trial and error again Lists

2014-10-22 Thread Steven D'Aprano
Seymore4Head wrote: > Those string errors were desperate attempts to fix the "append" error > I didn't understand. Ah, the good ol' "make random changes to the code until the error goes away" technique. You know that it never works, right? Start by *reading the error message*, assuming you're ge

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence wrote: >On 23/10/2014 00:26, Seymore4Head wrote: >> On Wed, 22 Oct 2014 23:55:57 +0100, Mark Lawrence >> wrote: >> >>> On 22/10/2014 23:30, Seymore4Head wrote: On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: One more

The “trials” in “trial and error” should be as simple as possible (was: I am out of trial and error again Lists)

2014-10-22 Thread Ben Finney
Seymore4Head writes: > Those string errors were desperate attempts to fix the "append" error > I didn't understand. It's normal when learning to get one's code into a mess. But, when trying to trouble-shoot, please adopt the habit of *simplifying* the examples, to better understand them. At th

Re: I am out of trial and error again Lists

2014-10-22 Thread Mark Lawrence
On 23/10/2014 00:26, Seymore4Head wrote: On Wed, 22 Oct 2014 23:55:57 +0100, Mark Lawrence wrote: On 22/10/2014 23:30, Seymore4Head wrote: On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: One more question. if y in str(range(10) Why doesn't that work. Invalid syntax, it should obvi

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
On Wed, 22 Oct 2014 23:55:57 +0100, Mark Lawrence wrote: >On 22/10/2014 23:30, Seymore4Head wrote: >> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head >> wrote: >> >> One more question. >> if y in str(range(10) >> Why doesn't that work. > >Invalid syntax, it should obviously be:- > >if y in str(

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
On Wed, 22 Oct 2014 22:43:14 + (UTC), Denis McMahon wrote: >On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: > >> def nametonumber(name): >> lst=[""] >> for x,y in enumerate (name): >> lst=lst.append(y) >> print (lst) >> return (lst) >> a=["1-800-getcharter"] >>

Re: Problem with Android Build [SOLVED]

2014-10-22 Thread Cyd Haselton
On Tue, Oct 21, 2014 at 1:57 PM, Chris Angelico wrote: > On Wed, Oct 22, 2014 at 5:53 AM, Cyd Haselton wrote: > > I forgot to add...I also removed and/or commented out lines referencing > > Modules/pwdmodule.o. > > Sounds like the normal sort of work involved in porting to a new > platform. I've

Re: I am out of trial and error again Lists

2014-10-22 Thread MRAB
On 2014-10-22 23:30, Seymore4Head wrote: On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: One more question. if y in str(range(10) Why doesn't that work. In what way doesn't it work? If you want to know what it returns, print it out. I commented it out and just did it "long hand" d

Re: I am out of trial and error again Lists

2014-10-22 Thread Mark Lawrence
On 22/10/2014 23:30, Seymore4Head wrote: On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: One more question. if y in str(range(10) Why doesn't that work. Invalid syntax, it should obviously be:- if y in str(range(10)): OTOH if you've simply mistyped above what did you expect to happe

Re: I am out of trial and error again Lists

2014-10-22 Thread Denis McMahon
On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: > def nametonumber(name): > lst=[""] > for x,y in enumerate (name): > lst=lst.append(y) > print (lst) > return (lst) > a=["1-800-getcharter"] > print (nametonumber(a))#18004382427837 > > > The syntax for when

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
BTW I know I didn't check for Caps yet. On Wed, 22 Oct 2014 18:30:17 -0400, Seymore4Head wrote: >On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head > wrote: > >One more question. >if y in str(range(10) >Why doesn't that work. >I commented it out and just did it "long hand" > >def nametonumber(name

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head wrote: One more question. if y in str(range(10) Why doesn't that work. I commented it out and just did it "long hand" def nametonumber(name): lst=[] nx=[] for x in (name): lst.append(x) for y in (lst): #if y in str(

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
On Wed, 22 Oct 2014 14:35:18 -0700 (PDT), sohcahto...@gmail.com wrote: >On Wednesday, October 22, 2014 2:06:35 PM UTC-7, Seymore4Head wrote: >> On Wed, 22 Oct 2014 16:57:00 -0400, Joel Goldstick >> wrote: >> >> >On Wed, Oct 22, 2014 at 4:30 PM, Seymore4Head >> > wrote: >> >> def nametonumber(nam

Re: I am out of trial and error again Lists

2014-10-22 Thread sohcahtoa82
On Wednesday, October 22, 2014 2:06:35 PM UTC-7, Seymore4Head wrote: > On Wed, 22 Oct 2014 16:57:00 -0400, Joel Goldstick > wrote: > > >On Wed, Oct 22, 2014 at 4:30 PM, Seymore4Head > > wrote: > >> def nametonumber(name): > >> lst=[""] > >> for x,y in enumerate (name): > >> lst=ls

Re: I am out of trial and error again Lists

2014-10-22 Thread Mark Lawrence
On 22/10/2014 21:57, Joel Goldstick wrote: On Wed, Oct 22, 2014 at 4:30 PM, Seymore4Head wrote: def nametonumber(name): lst=[""] for x,y in enumerate (name): lst=lst.append(y) print (lst) return (lst) a=["1-800-getcharter"] print (nametonumber(a))#18004382427837 T

Re: I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
On Wed, 22 Oct 2014 16:57:00 -0400, Joel Goldstick wrote: >On Wed, Oct 22, 2014 at 4:30 PM, Seymore4Head > wrote: >> def nametonumber(name): >> lst=[""] >> for x,y in enumerate (name): >> lst=lst.append(y) >> print (lst) >> return (lst) >> a=["1-800-getcharter"] >> print (

Re: I am out of trial and error again Lists

2014-10-22 Thread Joel Goldstick
On Wed, Oct 22, 2014 at 4:30 PM, Seymore4Head wrote: > def nametonumber(name): > lst=[""] > for x,y in enumerate (name): > lst=lst.append(y) > print (lst) > return (lst) > a=["1-800-getcharter"] > print (nametonumber(a))#18004382427837 > > > The syntax for when to use a ()

I am out of trial and error again Lists

2014-10-22 Thread Seymore4Head
def nametonumber(name): lst=[""] for x,y in enumerate (name): lst=lst.append(y) print (lst) return (lst) a=["1-800-getcharter"] print (nametonumber(a))#18004382427837 The syntax for when to use a () and when to use [] still throws me a curve. For now, I am trying to

Re: (test) ? a:b

2014-10-22 Thread Ned Batchelder
On 10/22/14 12:28 PM, Steven D'Aprano wrote: Ned Batchelder wrote: On 10/22/14 5:05 AM, busca...@gmail.com wrote: without not: j = [j+1, 3][j>=10] with not: j = [3, j+1][not (j>=10)] Why on earth would you recommend this outdated hack, when there's a true conditional operator? j =

setuptools + data_files = 2

2014-10-22 Thread luc2
hello, would you know how to make data_files work in setuptools ? i can't figure out how to put datas in the generated .tar.gz $ find . ./hello ./hello/__init__.py ./share ./share/test_file.txt ./setup.py $ cat ./hello/__init__.py def hello(): print( 'hello' ) $ cat ./share/test_file.txt thi

Re: (test) ? a:b

2014-10-22 Thread Chris Angelico
On Thu, Oct 23, 2014 at 5:27 AM, Matthew Ruffalo wrote: > On 10/22/2014 12:40 PM, Chris Angelico wrote: >> That's true when it's fundamentally arithmetic. But part of that >> readability difference is the redundancy in the second one. What if it >> weren't so redundant? >> >> 'Negative' if x < 0 e

Re: (test) ? a:b

2014-10-22 Thread Matthew Ruffalo
On 10/22/2014 12:40 PM, Chris Angelico wrote: > That's true when it's fundamentally arithmetic. But part of that > readability difference is the redundancy in the second one. What if it > weren't so redundant? > > 'Negative' if x < 0 else 'Low' if x < 10 else 'Mid' if x < 20 else 'High' > > You can

Re: (test) ? a:b

2014-10-22 Thread BartC
"Rustom Mody" wrote in message news:7d2ea3c1-504e-4f5c-8338-501b1483d...@googlegroups.com... On Wednesday, October 22, 2014 5:01:08 PM UTC+5:30, Ned Batchelder wrote: On 10/22/14 5:05 AM, buscacio wrote: > Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast > escreveu: >> Hello >

Re: (test) ? a:b

2014-10-22 Thread alister
On Thu, 23 Oct 2014 03:28:48 +1100, Steven D'Aprano wrote: >> Why on earth would you recommend this outdated hack, when there's a >> true conditional operator? >> >> j = 3 if j >= 10 else j+1 > > I think that's a bit harsh. Especially since this appears to have been > Buscacio's first post

Re: (test) ? a:b

2014-10-22 Thread Michael Torrie
On 10/22/2014 05:45 AM, Mark Lawrence wrote: >>> without not: >>> j = [j+1, 3][j>=10] >>> with not: >>> j = [3, j+1][not (j>=10)] >>> >> >> Oh it's a trick ! >> thx > > IMHO it's just dreadful. Why people insist on messing around like this > I really don't know, it just drives me nuts. This act

Re: (-1)**1000

2014-10-22 Thread Terry Reedy
On 10/22/2014 4:27 AM, ast wrote: Hello If i am writing (-1)**1000 on a python program, will the interpreter do (-1)*(-1)*...*(-1) or something clever ? The answer depends on the implementation. In fact i have (-1)**N with N an integer potentially big. I do some tests that suggest that Pyth

Re: Python 3.4.1 and blitzdb issue

2014-10-22 Thread Stéphane Wirtel
Maybe ask on the project on github. Andreas is a good guy and will reply asap. On 22 Oct 2014, at 18:34, Juan Christian wrote: Testing code: CODE - #!/usr/bin/env import requests from blitzdb import Document, FileBackend API_URL = 'http://api.themoviedb.org/3' API_KEY

Re: (test) ? a:b

2014-10-22 Thread Chris Angelico
On Thu, Oct 23, 2014 at 3:28 AM, Steven D'Aprano wrote: > It's also a technique easily extensible to more than two > values: > > '01TX'[n % 4] > > is in my opinion more readable than: > > i = n % 4 > '0' if i == 0 else '1' if i == 1 else 'T' if i == 3 else 'X' That's true when it's fu

Python 3.4.1 and blitzdb issue

2014-10-22 Thread Juan Christian
Testing code: CODE - #!/usr/bin/env import requests from blitzdb import Document, FileBackend API_URL = 'http://api.themoviedb.org/3' API_KEY = 'ddf30289' class Actor(Document): pass def get_actor(_id): r = requests.get('{}/person/{}?api_key={}'.format(A

Re: Matplotlib: getting a figure to show without plt.show()

2014-10-22 Thread Peter Pearson
On Wed, 22 Oct 2014 12:38:02 +0200, Peter Otten wrote: > Peter Pearson wrote: [snip] >> def callback(event): >> global n, first >> fig = plt.figure(2) >> fig.clear() >> plt.plot([0,1],[0,n]) >> n += 1 # (Pretending something changes from one plot to the next.) >> if first:

Re: Python 3.4.1 and blitzdb issue

2014-10-22 Thread Juan Christian
Oh yes, and here is what the call to the API returns: {"adult":false,"also_known_as":["George Walton Lucas Jr. "],"biography":"Arguably the most important film innovator in the history of the medium, George Lucas continually \"pushed the envelope\" of filmmaking technology since his early days as

Re: (test) ? a:b

2014-10-22 Thread Steven D'Aprano
Ned Batchelder wrote: > On 10/22/14 5:05 AM, busca...@gmail.com wrote: >> without not: >> j = [j+1, 3][j>=10] >> with not: >> j = [3, j+1][not (j>=10)] >> > > Why on earth would you recommend this outdated hack, when there's a true > conditional operator? > > j = 3 if j >= 10 else j+1 I t

Re: When to use assert

2014-10-22 Thread Dan Stromberg
On Wed, Oct 22, 2014 at 9:01 AM, Chris Angelico wrote: > On Thu, Oct 23, 2014 at 2:49 AM, Steven D'Aprano > wrote: >> Chris Angelico wrote: > I agree that the assert is preferable to the comment. But maybe my > level of paranoia is just lower than most people's, as I wouldn't > bother checking th

Re: (test) ? a:b

2014-10-22 Thread Dan Stromberg
On Wed, Oct 22, 2014 at 2:05 AM, wrote: > Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast escreveu: >> Hello >> >> >> >> Is there in Python something like: >> >> >> >> j = (j >= 10) ? 3 : j+1; >> >> >> >> as in C language ? >> >> >> >> thx > > without not: > j = [j+1, 3][j>=10] > w

Re: When to use assert

2014-10-22 Thread Chris Angelico
On Thu, Oct 23, 2014 at 2:49 AM, Steven D'Aprano wrote: > Chris Angelico wrote: > >> And at that point, the assertion is redundant, on par with: >> >> a = len(seq) >> assert isinstance(a, int) >> >> because you shouldn't have to assert what's part of a function's >> guarantee. > > That depends on

Re: Permissions on files installed by pip?

2014-10-22 Thread Adam Funk
On 2014-10-17, Jean-Michel Pichavant wrote: > - Original Message - >> From: "Adam Funk" >> To: python-list@python.org >> Sent: Thursday, 16 October, 2014 9:29:46 PM >> Subject: Permissions on files installed by pip? >> >> I've been using the python-nltk package on Ubuntu, but I need ntlk

Re: When to use assert

2014-10-22 Thread Steven D'Aprano
Chris Angelico wrote: > On Wed, Oct 22, 2014 at 12:44 PM, Steven D'Aprano > wrote: >> def do_something(instance_or_id): >> instance = Model.get(instance_or_id) >> assert isinstance(instance, Model) >> # Code that assumes that instance is an object of type Model >> >> >> That means tha

Re: Flush stdin

2014-10-22 Thread Marko Rauhamaa
random...@fastmail.us: > Yes, and 90% of the time, when someone says they want to "flush > stdin", what they really want to do is go to the next line after > they've sloppily read part of the line they're on (and the behavior > they are seeing that they object to is that their next read function >

Re: (test) ? a:b

2014-10-22 Thread alister
On Thu, 23 Oct 2014 02:18:42 +1100, Chris Angelico wrote: > On Thu, Oct 23, 2014 at 2:12 AM, alister > wrote: >>> Perhaps you're correct. Is there anything worse than looking at a >>> dreadful piece of code that makes no sense at all and knowing that >>> you'd written it six months earlier? >> >

Re: (test) ? a:b

2014-10-22 Thread Chris Angelico
On Thu, Oct 23, 2014 at 2:12 AM, alister wrote: >> Perhaps you're correct. Is there anything worse than looking at a >> dreadful piece of code that makes no sense at all and knowing that you'd >> written it six months earlier? > > looking a a dreadful piece of unreadable & unfathomable code & kno

Re: (test) ? a:b

2014-10-22 Thread alister
On Wed, 22 Oct 2014 12:41:49 +0100, Mark Lawrence wrote: > On 22/10/2014 10:27, Chris Angelico wrote: >> On Wed, Oct 22, 2014 at 8:16 PM, Mark Lawrence >> wrote: without not: j = [j+1, 3][j>=10] with not: j = [3, j+1][not (j>=10)] >>> The death penalty should be rein

Re: (-1)**1000

2014-10-22 Thread Ned Batchelder
On 10/22/14 5:27 AM, ast wrote: "Chris Angelico" a écrit dans le message de news:mailman.15058.1413968065.18130.python-l...@python.org... On Wed, Oct 22, 2014 at 7:27 PM, ast wrote: If i am writing (-1)**1000 on a python program, will the interpreter do (-1)*(-1)*...*(-1) or something clever

Re: Flush stdin

2014-10-22 Thread random832
On Tue, Oct 21, 2014, at 19:16, Dan Stromberg wrote: > Actually, doesn't line buffering sometimes exist inside an OS kernel? > stty/termios/termio/sgtty relate here, for *ix examples. Supporting > code: http://stromberg.dnsalias.org/~strombrg/ttype/ It turns on > character-at-a-time I/O in the tt

Re: (-1)**1000

2014-10-22 Thread Ian Kelly
On Wed, Oct 22, 2014 at 4:43 AM, Tim Chase wrote: > On 2014-10-22 12:29, Peter Otten wrote: >> That looks like log(a) while a parity check takes constant time: >> >> $ python3 -m timeit -s 'a = 10**10' 'a & 1' >> 1000 loops, best of 3: 0.124 usec per loop >> $ python3 -m timeit -s 'a = 10**100

Re: (-1)**1000

2014-10-22 Thread Ian Kelly
On Wed, Oct 22, 2014 at 5:02 AM, Peter Otten <__pete...@web.de> wrote: > Michiel Overtoom wrote: > >> >> On Oct 22, 2014, at 12:29, Peter Otten wrote: >> >>> That looks like log(a) while a parity check takes constant time: >>> $ python3 -m timeit -s 'a = 10**10' 'a & 1' >> >> >> Do you mean 'parity

Re: (test) ? a:b

2014-10-22 Thread Rustom Mody
On Wednesday, October 22, 2014 5:01:08 PM UTC+5:30, Ned Batchelder wrote: > On 10/22/14 5:05 AM, buscacio wrote: > > Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast escreveu: > >> Hello > >> Is there in Python something like: > >> j = (j >= 10) ? 3 : j+1; > >> as in C language ? > >>

Re: 403 forbidden error

2014-10-22 Thread Chris Angelico
On Wed, Oct 22, 2014 at 10:36 PM, wrote: > Could anyone please help me to resolve 403 forbidden error while logging > into an application. That comes down tot he server you're talking to. Maybe your username/password is wrong, or maybe you need to send back a cookie, or something. If you do s

Problems with selenium 2 and python 3.4.1

2014-10-22 Thread novozhiloffvadim
Hi all, i have a little problem. I have a simple automation to fill login form fields. Actually, it passes good, but there's the problem. I need to see actual output in my console after the script filled fields, like "Logged in successfully" or "Username not found". I tried many stuff, but nothi

Re: (test) ? a:b

2014-10-22 Thread Mark Lawrence
On 22/10/2014 10:14, ast wrote: a écrit dans le message de news:7839376e-fc27-4299-ae63-4ddf17ef9...@googlegroups.com... Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast escreveu: Hello Is there in Python something like: j = (j >= 10) ? 3 : j+1; as in C language ? th

Re: (test) ? a:b

2014-10-22 Thread Marko Rauhamaa
Ned Batchelder : > Why on earth would you recommend this outdated hack, when there's a > true conditional operator? [...] if someone asks for a conditional > operator, at least show them one! No good deed goes unpunished. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: (test) ? a:b

2014-10-22 Thread Mark Lawrence
On 22/10/2014 10:27, Chris Angelico wrote: On Wed, Oct 22, 2014 at 8:16 PM, Mark Lawrence wrote: without not: j = [j+1, 3][j>=10] with not: j = [3, j+1][not (j>=10)] The death penalty should be reintroduced into the UK for two crimes, writing code like the above and using google groups. No

403 forbidden error

2014-10-22 Thread diyaraik
Hai, Could anyone please help me to resolve 403 forbidden error while logging into an application. Following is the error details: Traceback (most recent call last): File "./example6.py", line 18, in response = urllib2.urlopen(req) File "/usr/lib/python2.7/urllib2.py", line 126, in u

Re: (test) ? a:b

2014-10-22 Thread Ned Batchelder
On 10/22/14 5:05 AM, busca...@gmail.com wrote: Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast escreveu: Hello Is there in Python something like: j = (j >= 10) ? 3 : j+1; as in C language ? thx without not: j = [j+1, 3][j>=10] with not: j = [3, j+1][not (j>=10)] W

Re: (-1)**1000

2014-10-22 Thread Peter Otten
Michiel Overtoom wrote: > > On Oct 22, 2014, at 12:29, Peter Otten wrote: > >> That looks like log(a) while a parity check takes constant time: >> $ python3 -m timeit -s 'a = 10**10' 'a & 1' > > > Do you mean 'parity' as in http://en.wikipedia.org/wiki/Parity_bit ? > Because a parity bit deno

Re: Flush stdin

2014-10-22 Thread Marko Rauhamaa
Dan Stromberg : > On Mon, Oct 20, 2014 at 9:41 PM, Marko Rauhamaa wrote: >> Terminal devices support line buffering on write. > Yes, though that's not the only place it's useful. > >> Line buffering on read is an illusion created by higher-level libraries. >> The low-level read function reads in

Re: (-1)**1000

2014-10-22 Thread Tim Chase
On 2014-10-22 12:29, Peter Otten wrote: > That looks like log(a) while a parity check takes constant time: > > $ python3 -m timeit -s 'a = 10**10' 'a & 1' > 1000 loops, best of 3: 0.124 usec per loop > $ python3 -m timeit -s 'a = 10**100' 'a & 1' > 1000 loops, best of 3: 0.124 usec per loo

Re: (-1)**1000

2014-10-22 Thread Michiel Overtoom
On Oct 22, 2014, at 12:29, Peter Otten wrote: > That looks like log(a) while a parity check takes constant time: > $ python3 -m timeit -s 'a = 10**10' 'a & 1' Do you mean 'parity' as in http://en.wikipedia.org/wiki/Parity_bit ? Because a parity bit denotes whether the *number* of '1' bits is

Re: Matplotlib: getting a figure to show without plt.show()

2014-10-22 Thread Peter Otten
Peter Pearson wrote: > I'm using Matplotlib to present a "control" window with clickable > buttons, and to plot things in another window when you click buttons, > in the style of the code below. I'm ashamed of the stinky way I > use "first" to call plt.show the first time data are plotted but the

Re: (-1)**1000

2014-10-22 Thread Peter Otten
ast wrote: > > "Chris Angelico" a écrit dans le message de > news:mailman.15058.1413968065.18130.python-l...@python.org... >> On Wed, Oct 22, 2014 at 7:27 PM, ast wrote: >>> If i am writing (-1)**1000 on a python program, will the >>> interpreter do (-1)*(-1)*...*(-1) or something clever ? >>>

Re: (test) ? a:b

2014-10-22 Thread Chris Angelico
On Wed, Oct 22, 2014 at 8:16 PM, Mark Lawrence wrote: >> without not: >> j = [j+1, 3][j>=10] >> with not: >> j = [3, j+1][not (j>=10)] >> > > The death penalty should be reintroduced into the UK for two crimes, writing > code like the above and using google groups. No no no. Code like that doesn'

Re: (-1)**1000

2014-10-22 Thread ast
"Chris Angelico" a écrit dans le message de news:mailman.15058.1413968065.18130.python-l...@python.org... On Wed, Oct 22, 2014 at 7:27 PM, ast wrote: If i am writing (-1)**1000 on a python program, will the interpreter do (-1)*(-1)*...*(-1) or something clever ? In fact i have (-1)**N with

Re: (test) ? a:b

2014-10-22 Thread ast
a écrit dans le message de news:7839376e-fc27-4299-ae63-4ddf17ef9...@googlegroups.com... Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast escreveu: Hello Is there in Python something like: j = (j >= 10) ? 3 : j+1; as in C language ? thx without not: j = [j+1, 3][j>

Re: (test) ? a:b

2014-10-22 Thread Mark Lawrence
On 22/10/2014 10:05, busca...@gmail.com wrote: Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast escreveu: Hello Is there in Python something like: j = (j >= 10) ? 3 : j+1; as in C language ? thx without not: j = [j+1, 3][j>=10] with not: j = [3, j+1][not (j>=10)] T

Re: (test) ? a:b

2014-10-22 Thread Chris Angelico
On Wed, Oct 22, 2014 at 8:05 PM, wrote: > Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast escreveu: >> Hello >> >> >> >> Is there in Python something like: >> >> >> >> j = (j >= 10) ? 3 : j+1; >> >> >> >> as in C language ? >> >> >> >> thx > > without not: > j = [j+1, 3][j>=10] > w

Re: (-1)**1000

2014-10-22 Thread Peter Otten
ast wrote: > If i am writing (-1)**1000 on a python program, will the > interpreter do (-1)*(-1)*...*(-1) or something clever ? > > In fact i have (-1)**N with N an integer potentially big. > > I do some tests that suggest that Python is clever Let's see: $ python3 Python 3.4.0 (default, Apr 1

Re: (test) ? a:b

2014-10-22 Thread buscacio
Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast escreveu: > Hello > > > > Is there in Python something like: > > > > j = (j >= 10) ? 3 : j+1; > > > > as in C language ? > > > > thx without not: j = [j+1, 3][j>=10] with not: j = [3, j+1][not (j>=10)] -- https://mail.pyt

Re: (-1)**1000

2014-10-22 Thread Chris Angelico
On Wed, Oct 22, 2014 at 7:27 PM, ast wrote: > If i am writing (-1)**1000 on a python program, will the > interpreter do (-1)*(-1)*...*(-1) or something clever ? > > In fact i have (-1)**N with N an integer potentially big. Exponentiation is far more efficient than the naive implementation of iter

Re: (-1)**1000

2014-10-22 Thread Jean-Michel Pichavant
- Original Message - > From: "ast" > To: python-list@python.org > Sent: Wednesday, 22 October, 2014 10:27:34 AM > Subject: (-1)**1000 > > Hello > > If i am writing (-1)**1000 on a python program, will the > interpreter do (-1)*(-1)*...*(-1) or something clever ? > > In fact i have (-1)*

Re: (test) ? a:b

2014-10-22 Thread Jean-Michel Pichavant
- Original Message - > From: "ast" > To: python-list@python.org > Sent: Wednesday, 22 October, 2014 10:29:43 AM > Subject: (test) ? a:b > > Hello > > Is there in Python something like: > > j = (j >= 10) ? 3 : j+1; > > as in C language ? > > thx j = 3 if j >=10 else j+1 Cheers JM

(-1)**1000

2014-10-22 Thread ast
Hello If i am writing (-1)**1000 on a python program, will the interpreter do (-1)*(-1)*...*(-1) or something clever ? In fact i have (-1)**N with N an integer potentially big. I do some tests that suggest that Python is clever thx -- https://mail.python.org/mailman/listinfo/python-list

(test) ? a:b

2014-10-22 Thread ast
Hello Is there in Python something like: j = (j >= 10) ? 3 : j+1; as in C language ? thx -- https://mail.python.org/mailman/listinfo/python-list