random number

2012-03-26 Thread Nikhil Verma
Hi All How can we generate a 6 digit random number from a given number ? eg:- def number_generator(id): random.randint(id,99) When i am using this it is sometimes giving me five digit and sometimes 6 . I want to avoid encryption . Can i have alphanumeric 6 digit random number from this

Re: random number

2012-03-26 Thread Daniel da Silva
If you want it as an int: random.randint(10, 99) Or as a string: s = '%06d' % random.randint(0, 99) On Mon, Mar 26, 2012 at 2:08 AM, Nikhil Verma varma.nikhi...@gmail.comwrote: Hi All How can we generate a 6 digit random number from a given number ? eg:- def

Re: random number

2012-03-26 Thread Chris Angelico
On Mon, Mar 26, 2012 at 5:08 PM, Nikhil Verma varma.nikhi...@gmail.com wrote: Hi All How can we generate a 6 digit random number from a given number ? eg:- def number_generator(id):     random.randint(id,99) When i am using this it is sometimes giving me five digit and sometimes 6 .

Re: random number

2012-03-26 Thread Michael Poeltl
* Nikhil Verma varma.nikhi...@gmail.com [2012-03-26 08:09]: Hi All How can we generate a 6 digit random number from a given number ? what about this? given_number=123456 def rand_given_number(x): ... s = list(str(x)) ... random.shuffle(s) ... return int(''.join(s)) ... print

Re: random number

2012-03-26 Thread Nikhil Verma
Hi I want something to achieve like this :- def random_number(id): # I am passing it from request # do something return random_number Output random_number(5) AXR670 One input that is a number in return you are getting 6 digit alphanumeric string. I tried this s = '%06d' %

Problem with NAT Traversal

2012-03-26 Thread hz hanks
Hi, All I'm working with a small program to realize P2P file transfer. Therefore, I have to accomplish the function of NAT traversal. From the searching result, I know that it always requires a public server to initialize the transfer, but I don't have one. Now, my idea is that, we already have

Re: random number

2012-03-26 Thread Grzegorz Staniak
On 26.03.2012, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wroted: How can we generate a 6 digit random number from a given number ? what about this? given_number=123456 def rand_given_number(x): ... s = list(str(x)) ... random.shuffle(s) ... return int(''.join(s))

Re: random number

2012-03-26 Thread Peter Otten
Nikhil Verma wrote: I want something to achieve like this :- def random_number(id): # I am passing it from request # do something return random_number Output random_number(5) AXR670 That's normally not called a number (though it could be base 36 or similar). One input

Re: bdb.Bdb (Debugger Base Class) / unittest Interaction (MRAB)

2012-03-26 Thread Ami Tavory
From: MRAB pyt...@mrabarnett.plus.com To: python-list@python.org Cc: Date: Sun, 25 Mar 2012 22:14:28 +0100 Subject: Re: bdb.Bdb (Debugger Base Class) / unittest Interaction On 25/03/2012 21:42, Ami Tavory wrote: Hello, I'm having some difficulties with the interaction between bdb.Bdb and

Re: Documentation, assignment in expression.

2012-03-26 Thread Devin Jeanpierre
On Sun, Mar 25, 2012 at 11:16 AM, Kiuhnm kiuhnm03.4t.yahoo...@mail.python.org wrote: On 3/25/2012 15:48, Tim Chase wrote: The old curmudgeon in me likes the Pascal method of using = for equality-testing, and := for assignment which feels a little closer to mathematical use of =.

Re: random number

2012-03-26 Thread Michael Poeltl
* Nikhil Verma varma.nikhi...@gmail.com [2012-03-26 08:49]: Hi I want something to achieve like this :- def random_number(id): # I am passing it from request # do something return random_number Output random_number(5) AXR670 One input that is a number in return you are

Re: Stream programming

2012-03-26 Thread Jean-Michel Pichavant
Kiuhnm wrote: [snip] numbers - push - avrg - 'med' - pop - filter(lt('med'), ge('med'))\ - ['same', 'same'] - streams(cat) - 'same' It reads as take a list of numbers - save it - compute the average and named it 'med' - restore the flow - create two streams which have, respect., the

Re: random number

2012-03-26 Thread Robert Kern
On 3/26/12 8:50 AM, Grzegorz Staniak wrote: On 26.03.2012, Steven D'Apranosteve+comp.lang.pyt...@pearwood.info wroted: How can we generate a 6 digit random number from a given number ? what about this? given_number=123456 def rand_given_number(x): ... s = list(str(x)) ...

Re: How to decide if a object is instancemethod?

2012-03-26 Thread Jean-Michel Pichavant
Jon Clements wrote: On Wednesday, 14 March 2012 13:28:58 UTC, Cosmia Luna wrote: class Foo(object): def bar(self): return 'Something' func = Foo().bar if type(func) == type 'instancemethod': # This should be always true pass # do something here What should type at type

Re: random number

2012-03-26 Thread Nikhil Verma
Hi Thanks Michael I want exactly wanted this. Great def random_number(id) ...characters = list(string.ascii_lowercase +string.ascii_uppercase +string.digits) I used this this earlier and tried then by using choice . This is great. On Mon, Mar 26, 2012 at 2:54 PM, Michael Poeltl

Re: random number

2012-03-26 Thread Robert Kern
On 3/26/12 10:45 AM, Nikhil Verma wrote: Hi Thanks Michael I want exactly wanted this. Great def random_number(id) ...characters = list(string.ascii_lowercase +string.ascii_uppercase +string.digits) I used this this earlier and tried then by using choice . This is great. Note that

Re: Documentation, assignment in expression.

2012-03-26 Thread Tim Chase
On 03/25/12 17:59, Dennis Lee Bieber wrote: On Sun, 25 Mar 2012 08:48:31 -0500, Tim Chase Yeah, it has the same structure internally, but I'm somewhat surprised that the DB connection object doesn't have an __iter__() that does something like this automatically under the covers. I

Re: Documentation, assignment in expression.

2012-03-26 Thread Kiuhnm
On 3/26/2012 10:52, Devin Jeanpierre wrote: On Sun, Mar 25, 2012 at 11:16 AM, Kiuhnm kiuhnm03.4t.yahoo...@mail.python.org wrote: On 3/25/2012 15:48, Tim Chase wrote: The old curmudgeon in me likes the Pascal method of using = for equality-testing, and := for assignment which feels a little

Re: Documentation, assignment in expression.

2012-03-26 Thread Jussi Piitulainen
Kiuhnm writes: On 3/26/2012 10:52, Devin Jeanpierre wrote: On Sun, Mar 25, 2012 at 11:16 AM, Kiuhnm kiuhnm03.4t.yahoo...@mail.python.org wrote: On 3/25/2012 15:48, Tim Chase wrote: The old curmudgeon in me likes the Pascal method of using = for equality-testing, and := for assignment

Re: Documentation, assignment in expression.

2012-03-26 Thread mwilson
Dennis Lee Bieber wrote: On Sun, 25 Mar 2012 19:09:12 -0400, mwil...@the-wire.com declaimed the following in gmane.comp.python.general: Most of my database programs wind up having the boilerplate (not tested): def rowsof (cursor): names = [x[0] for x in cursor.description] r =

Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread redstone-cold
I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Stream programming

2012-03-26 Thread Kiuhnm
On 3/26/2012 11:27, Jean-Michel Pichavant wrote: Kiuhnm wrote: [snip] numbers - push - avrg - 'med' - pop - filter(lt('med'), ge('med'))\ - ['same', 'same'] - streams(cat) - 'same' It reads as take a list of numbers - save it - compute the average and named it 'med' - restore the flow -

Re: Documentation, assignment in expression.

2012-03-26 Thread Kiuhnm
On 3/26/2012 13:13, Jussi Piitulainen wrote: Kiuhnm writes: On 3/26/2012 10:52, Devin Jeanpierre wrote: On Sun, Mar 25, 2012 at 11:16 AM, Kiuhnm kiuhnm03.4t.yahoo...@mail.python.org wrote: On 3/25/2012 15:48, Tim Chase wrote: The old curmudgeon in me likes the Pascal method of using = for

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread Chris Angelico
On Mon, Mar 26, 2012 at 10:45 PM, redstone-c...@163.com wrote: I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? One of them takes the integer 3,

Puzzled by FiPy's use of ==

2012-03-26 Thread André Roberge
In FiPy (a finite volume PDE solver), equations are magically set up as eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D) and solved via eqX.solve(...) How can eqX be anything than True or False?... This must be via a redefinition of == but I can't see how that is done. I did look at

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread Kiuhnm
On 3/26/2012 13:45, redstone-c...@163.com wrote: I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? The former prints a number while the latter a string.

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread Dave Angel
On 03/26/2012 07:45 AM, redstone-c...@163.com wrote: I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? This is a non-question. The input is the same, the

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread Robert Kern
On 3/26/12 12:45 PM, redstone-c...@163.com wrote: I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? Yes, there is a difference, but not much. [~] |6

Re: Puzzled by FiPy's use of ==

2012-03-26 Thread Robert Kern
On 3/26/12 12:47 PM, André Roberge wrote: In FiPy (a finite volume PDE solver), equations are magically set up as eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D) and solved via eqX.solve(...) How can eqX be anything than True or False?... This must be via a redefinition of == but I

Re: Puzzled by FiPy's use of ==

2012-03-26 Thread André Roberge
On Monday, 26 March 2012 09:16:07 UTC-3, Robert Kern wrote: On 3/26/12 12:47 PM, André Roberge wrote: In FiPy (a finite volume PDE solver), equations are magically set up as eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D) and solved via eqX.solve(...) How can eqX be

Re: verbs in comments [OT]

2012-03-26 Thread Jean-Michel Pichavant
Kiuhnm wrote: Why do you write // Print the number of words... def printNumWords(): ... and not // Prints the number of words... def printNumWords(): ... where it is understood? Is that an imperative or a base form or something else? Kiuhnm http://www.python.org/dev/peps/pep-0257/

help needed to understand an error message.

2012-03-26 Thread Aloke Ghosh
Hi, I am learning Python and do not have programming experience. I was following an exercise from http://learnpythonthehardway.org/book/ex2.html and made a mistake in entry : *PrintI like typing this.* and got the following error message: *In [2]: PrintI like typing this.*

Re: help needed to understand an error message.

2012-03-26 Thread Jean-Michel Pichavant
Aloke Ghosh wrote: Hi, I am learning Python and do not have programming experience. I was following an exercise from http://learnpythonthehardway.org/book/ex2.html and made a mistake in entry : *PrintI like typing this.* and got the following error message: *In [2]: PrintI like typing

Question about collections.defaultdict

2012-03-26 Thread Steven W. Orr
I created a new class called CaseInsensitiveDict (by stealing from code I found on the web, thank you very much). The new class inherits from dict. It makes it so that if the key has a 'lower' method, it will always access the key using lower I'd like to change the place where I previously

Re: Question about collections.defaultdict

2012-03-26 Thread Robert Kern
On 3/26/12 2:33 PM, Steven W. Orr wrote: I created a new class called CaseInsensitiveDict (by stealing from code I found on the web, thank you very much). The new class inherits from dict. It makes it so that if the key has a 'lower' method, it will always access the key using lower I'd like

Re: random number

2012-03-26 Thread ian douglas
On Mar 26, 2012 12:28 AM, Steven Dapos;Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 26 Mar 2012 08:40:00 +0200, Michael Poeltl wrote: * Nikhil Verma varma.nikhi...@gmail.com [2012-03-26 08:09]: A truly random six digit number will include any number between 10 through

Re: Documentation, assignment in expression.

2012-03-26 Thread Thomas Rachel
Am 25.03.2012 15:03 schrieb Tim Chase: Perhaps a DB example works better. With assignment allowed in an evaluation, you'd be able to write while data = conn.fetchmany(): for row in data: process(row) whereas you have to write while True: data = conn.fetchmany() if not

Re: Documentation, assignment in expression.

2012-03-26 Thread Thomas Rachel
Am 26.03.2012 00:59 schrieb Dennis Lee Bieber: If you use the longer form con = db.connect() cur = con.cursor() the cursor object, in all that I've worked with, does function for iteration I use this form regularly with MySQLdb and am now surprised to see that this is optional according to

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread redstone-cold
在 2012年3月26日星期一UTC+8下午8时11分03秒,Dave Angel写道: On 03/26/2012 07:45 AM, redstone-c...@163.com wrote: I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ?

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread Colton Myers
I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? Sure there is. The first converts the integer 3 to a string (3), the second just prints the given

Re: Inconsistency between os.getgroups and os.system('groups') after os.setgroups()

2012-03-26 Thread jeff
On Sunday, March 25, 2012 6:22:10 PM UTC-6, Ben Finney wrote: jeff writes: On Sunday, March 25, 2012 4:04:55 PM UTC-6, Heiko Wundram wrote: Am 25.03.2012 23:32, schrieb jeff: but I have to be able to get back to root privilege so I can't use setgid and setuid. Simply not

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread Stefan Behnel
redstone-c...@163.com, 26.03.2012 16:28: 在 2012年3月26日星期一UTC+8下午8时11分03秒,Dave Angel写道: On 03/26/2012 07:45 AM, redstone-c...@163.com wrote: I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference

Re: Question about collections.defaultdict

2012-03-26 Thread Steven W. Orr
On 3/26/2012 9:44 AM, Robert Kern wrote: On 3/26/12 2:33 PM, Steven W. Orr wrote: I created a new class called CaseInsensitiveDict (by stealing from code I found on the web, thank you very much). The new class inherits from dict. It makes it so that if the key has a 'lower' method, it will

Re: why did GMPY change the names of its functions?

2012-03-26 Thread Terry Reedy
On 3/26/2012 12:59 AM, Mensanator wrote: OK, GMPY is now called GMPY2. No big deal, I can import as GMPY. But why were scan0 and scan1 changed to bit_scan0 and bit_scan1? Guess: Either the functions changed or they want to regularize their names. What's the justification for that? I use

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread Terry Reedy
On 3/26/2012 7:45 AM, redstone-c...@163.com wrote: I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? If you want to see the difference between the number

Re: Question about collections.defaultdict

2012-03-26 Thread Robert Kern
On 3/26/12 4:33 PM, Steven W. Orr wrote: On 3/26/2012 9:44 AM, Robert Kern wrote: On 3/26/12 2:33 PM, Steven W. Orr wrote: I created a new class called CaseInsensitiveDict (by stealing from code I found on the web, thank you very much). The new class inherits from dict. It makes it so that if

Re: Documentation, assignment in expression.

2012-03-26 Thread Terry Reedy
On 3/26/2012 1:36 AM, Steven D'Aprano wrote: (I seem to recall a language that used a single = for both assignment and equality testing, guessing which one you meant from context. BASIC perhaps? Right. In some Basics, such as MS GW-Basic (I still have their book), a = b = c meant a = (b =

A play about the Indian IT industry

2012-03-26 Thread Sathyaish
My name is Sathyaish. I am a software engineer. Last year, i.e. in 2011, I wanted to do some theater. No one took me, so I announced that I would start my own group. I wrote a script. Then, I wrote a screen play from that. Now, I am almost ready to begin the auditions. The play will be a comedy

Re: random number

2012-03-26 Thread Ian Kelly
On Mon, Mar 26, 2012 at 3:24 AM, Michael Poeltl michael.poe...@univie.ac.at wrote: import random, string def random_number(id): ...     characters = list(string.ascii_lowercase + ...                       string.ascii_uppercase + ...                       string.digits) ...     coll_rand =

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread J. Cliff Dyer
As others have pointed out, the output is the same, because the result of converting an integer to a string is the string of that integer. However, other numeric literals might not do what you want, due to the fact that they are converted to an internal numeric representation, then converted back

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread Peter Otten
redstone-c...@163.com wrote: I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? The question you really wanted to ask is: under what circumstances will the

Re: Documentation, assignment in expression.

2012-03-26 Thread Tim Chase
On 03/26/12 08:59, Thomas Rachel wrote: Am 25.03.2012 15:03 schrieb Tim Chase: while True: data = conn.fetchmany() if not data: break for row in data: process(row) Or simpler for data in iter(conn.fetchmany, []): for row in data: process(row) Nice!

Re: why did GMPY change the names of its functions?

2012-03-26 Thread Mensanator
On Mar 26, 10:39 am, Terry Reedy tjre...@udel.edu wrote: On 3/26/2012 12:59 AM, Mensanator wrote: OK, GMPY is now called GMPY2. No big deal, I can import as GMPY. But why were scan0 and scan1 changed to bit_scan0 and bit_scan1? Guess: Either the functions changed or they want to

Re: why did GMPY change the names of its functions?

2012-03-26 Thread casevh
On Sunday, March 25, 2012 9:59:56 PM UTC-7, Mensanator wrote: OK, GMPY is now called GMPY2. No big deal, I can import as GMPY. But why were scan0 and scan1 changed to bit_scan0 and bit_scan1? What's the justification for that? I use those functions extensively in my library of Collatz

RE: help needed to understand an error message.

2012-03-26 Thread Prasad, Ramit
I feel the error is in Capital P in print . However the error indicated with *^* hints at quote at the end of the line. Anyway, the hint indicates the last quote because this is the location where the python interpreter realizes it won't be able to execute the code. You should not worry

perldoc: the key to perl

2012-03-26 Thread Xah Lee
〈Perl Documentation: The Key to Perl〉 http://xahlee.org/perl-python/key_to_perl.html plain text follows - So, i wanted to know what the option perl -C does. So, here's perldoc perlrun. Excerpt: -C [*number/list*] The -C flag controls some

best way to create warning for obsolete functions and call new one

2012-03-26 Thread Gelonida N
Hi, I'm working on a module, which needs rather heavy renaming of functions and methods (naming style, change of functionality, understandability, orthography) As these modules are used by quite some projects and as I do not want to force everybody to rename immediately I just want to warn

Re: best way to create warning for obsolete functions and call new one

2012-03-26 Thread Dan Sommers
On Mon, 26 Mar 2012 22:26:11 +0200 Gelonida N gelon...@gmail.com wrote: As these modules are used by quite some projects and as I do not want to force everybody to rename immediately I just want to warn users, that they call functions, that have been renamed and that will be obsoleted. You

Re: best way to create warning for obsolete functions and call new one

2012-03-26 Thread Chris Angelico
On Tue, Mar 27, 2012 at 7:26 AM, Gelonida N gelon...@gmail.com wrote: One option I though of would be: def obsolete_func(func):    def call_old(*args, **kwargs):        print func is old psl use new one        return func(*args, **kwargs)    return call_old and def get_time(a='high'):  

Advise of programming one of my first programs

2012-03-26 Thread Anatoli Hristov
Hi guys just wanted to share one of my first programs. Could you please tell me, do I use a right logic ? It works fine what I wanted to do, but is it writen in the right way? My next step is to make it write the changes of the dictionary on the file :) ## DB tbook = {'goodie':['Christian','Van

RE: Advise of programming one of my first programs

2012-03-26 Thread Prasad, Ramit
Hi guys just wanted to share one of my first programs. Could you please tell me, do I use a right logic ? It works fine what I wanted to do, but is it writen in the right way? My next step is to make it write the changes of the dictionary on the file :) When you do get that far, you should

concurrent file reading/writing using python

2012-03-26 Thread Abhishek Pratap
Hi Guys I am fwding this question from the python tutor list in the hope of reaching more people experienced in concurrent disk access in python. I am trying to see if there are ways in which I can read a big file concurrently on a multi core server and process data and write the output to a

RE: perldoc: the key to perl

2012-03-26 Thread Prasad, Ramit
〈Perl Documentation: The Key to Perl〉 http://xahlee.org/perl-python/key_to_perl.html plain text follows - So, i wanted to know what the option perl -C does. So, here's perldoc perlrun. Excerpt: [snip] Maybe I missed something, but what does this

[ANNOUNCE] pypiserver 0.5.2 - minimal pypi server

2012-03-26 Thread Ralf Schmitt
Hi, I've just uploaded pypiserver 0.5.2 to the python package index. pypiserver is a minimal PyPI compatible server. It can be used to serve a set of packages and eggs to easy_install or pip. pypiserver is easy to install (i.e. just easy_install pypiserver). It doesn't have any external

Re: Your Regex Brain

2012-03-26 Thread sln
On Sat, 24 Mar 2012 16:30:28 -0700 (PDT), Xah Lee xah...@gmail.com wrote: ?Your Regex Brain? http://xahlee.org/comp/your_regex_brain.html That's more like a brain cell. This is more like a regex brain. ' img (?=\s) (?= (?:[^\']|[^]*|\'[^\']*\')*? (?=\s) width \s*= (?: (? \s* ([\'])

Re: argparse ConfigureAction problem

2012-03-26 Thread Jason Friedman
./plot_stuff2.py --plot stuff1 stuff2 [...] plot_stuff2.py: error: argument --plot/--with-plot/--enable-plot/--no-plot/-- without-plot/--disable-plot: invalid boolean value: 'stuff1' Problem is --plot takes an optional argument, and so the positional arg is assumed to be the arg to --plot.  

Re: concurrent file reading/writing using python

2012-03-26 Thread Steve Howell
On Mar 26, 3:56 pm, Abhishek Pratap abhishek@gmail.com wrote: Hi Guys I am fwding this question from the python tutor list in the hope of reaching more people experienced in concurrent disk access in python. I am trying to see if there are ways in which I can read a big file

Re: Tools for refactoring/obfuscation

2012-03-26 Thread Vladimir Ignatov
Hi, (sorry for replying to the old topic) On Tue, Mar 6, 2012 at 10:29 PM, Javier nos...@nospam.com wrote: I am looking for an automated tool for refactoring/obfuscation. Something that changes names of functions, variables, or which would merge all the functions of various modules in a

OAuth 2.0 implementation

2012-03-26 Thread Demian Brecht
Hi all, I'm getting close to an alpha release of an OAuth 2.0 implementation (https://github.com/demianbrecht/py-sanction). High level features include: * Support for multiple providers (protocol deviations). This didn't seem to be supported by any library. * Actually an OAuth 2.0

Re: OAuth 2.0 implementation

2012-03-26 Thread Ben Finney
Demian Brecht demianbre...@gmail.com writes: I'm getting close to an alpha release of an OAuth 2.0 implementation (https://github.com/demianbrecht/py-sanction). Thank you for doing this work. As someone who uses OpenID, what can I read about why OAuth is better? Everything I read is targeted

Re: OAuth 2.0 implementation

2012-03-26 Thread Roy Smith
In article 87haxahh51@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: Demian Brecht demianbre...@gmail.com writes: I'm getting close to an alpha release of an OAuth 2.0 implementation (https://github.com/demianbrecht/py-sanction). Thank you for doing this work. As

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread Steven D'Aprano
On Mon, 26 Mar 2012 08:11:03 -0400, Dave Angel wrote: On 03/26/2012 07:45 AM, redstone-c...@163.com wrote: I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python

Re: OAuth 2.0 implementation

2012-03-26 Thread Ben Finney
Roy Smith r...@panix.com writes: In article 87haxahh51@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: As someone who uses OpenID, what can I read about why OAuth is better? OpenID is for people who worry about things like how OpenID is different from OAuth. Oauth is

Re: OAuth 2.0 implementation

2012-03-26 Thread Roy Smith
In article 878vimhfdp@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: Roy Smith r...@panix.com writes: In article 87haxahh51@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: As someone who uses OpenID, what can I read about why OAuth is better?

Re: OAuth 2.0 implementation

2012-03-26 Thread Ben Finney
Roy Smith r...@panix.com writes: In article 878vimhfdp@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: So, if I want to be free to choose an identity provider I trust, and it's not Facebook or Google or Twitter or other privacy-hostile services, how does OAuth help me

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread rusi
On Mar 27, 8:43 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Mon, 26 Mar 2012 08:11:03 -0400, Dave Angel wrote: On 03/26/2012 07:45 AM, redstone-c...@163.com wrote: I know the print statement produces the same result when both of these two instructions are executed ,I

Re: OAuth 2.0 implementation

2012-03-26 Thread Jack Diederich
On Tue, Mar 27, 2012 at 12:24 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Roy Smith r...@panix.com writes: In article 878vimhfdp@benfinney.id.au,  Ben Finney ben+pyt...@benfinney.id.au wrote: So, if I want to be free to choose an identity provider I trust, and it's not Facebook or

Re: OAuth 2.0 implementation

2012-03-26 Thread Demian Brecht
On Monday, 26 March 2012 21:24:35 UTC-7, Ben Finney wrote: Roy Smith r...@panix.com writes: In article 878vimhfdp@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: So, if I want to be free to choose an identity provider I trust, and it's not Facebook or Google or

Re: why did GMPY change the names of its functions?

2012-03-26 Thread Mensanator
On Mar 26, 1:33 pm, cas...@gmail.com wrote: On Sunday, March 25, 2012 9:59:56 PM UTC-7, Mensanator wrote: OK, GMPY is now called GMPY2. No big deal, I can import as GMPY. But why were scan0 and scan1 changed to bit_scan0 and bit_scan1? What's the justification for that? I use those

[issue14395] sftp: downloading files with % in name fails due to logging

2012-03-26 Thread Parand Darugar
Parand Darugar tdaru...@yahoo.com added the comment: You're absolutely right, it's from paramiko. Apologies. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14395 ___

[issue14409] IDLE does not execute any commands (command prompt works fine!)

2012-03-26 Thread Roger Serwy
Roger Serwy roger.se...@gmail.com added the comment: Hi Ankit, It looks like your configuration files for IDLE has a bug. Can you try renaming your .idlerc directory (likely located in your home directory) to something else and then retry using IDLE? Also, can you post your existing

[issue14410] argparse typo

2012-03-26 Thread Tshepang Lekhonkhobe
New submission from Tshepang Lekhonkhobe tshep...@gmail.com: typo fix -- assignee: docs@python components: Documentation files: typo.patch keywords: patch messages: 156801 nosy: docs@python, tshepang priority: normal severity: normal status: open title: argparse typo type: enhancement

[issue14411] outdatedness on rlcompleter docstring

2012-03-26 Thread Tshepang Lekhonkhobe
New submission from Tshepang Lekhonkhobe tshep...@gmail.com: This text appeared in Lib/rlcompleter.py in 1997, so ought to be outdated: This requires the latest extension to the readline module... -- assignee: docs@python components: Documentation, Library (Lib) messages: 156802 nosy:

[issue14373] C implementation of functools.lru_cache

2012-03-26 Thread Raymond Hettinger
Raymond Hettinger raymond.hettin...@gmail.com added the comment: I've just started looking at this. Nice job and good attention to detail on the error checking. Expect to have a few high-level suggestions and a ton of minor edits. Here are a couple of quick thoughts: * The comment style

[issue14399] zipfile and creat/update comment

2012-03-26 Thread Cassaigne
Cassaigne anthony.cassai...@gmail.com added the comment: Tanks à lot. To complete Information about this bug. it up and take a look. The relevant code is in Python, and I'm guessing there is some logic bug when only the comment is set (and nothing is added to the zipfile), but I haven't looked

[issue3367] Uninitialized value read in parsetok.c

2012-03-26 Thread Kristján Valur Jónsson
Kristján Valur Jónsson krist...@ccpgames.com added the comment: I don't quite understand what you're saying about line mismatch Victor. Anyway, if you look at it, it is clear that: 1) sys_update_path() can be called with argc==0 (main.c line 647) 2) 1742 was always setting arg0 to argv[0] that

[issue14408] Support the test_cases protocol in the stdlib tests

2012-03-26 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +michael.foord ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14408 ___ ___ Python-bugs-list

[issue3367] Uninitialized value read in parsetok.c

2012-03-26 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: It's the line argv0 = argv[0] in sys_update_path(). The copies of argv made in python.c aren't NULL terminated. Kristján's patch worked around that (and fixes the problem), but I'd prefer to make a full copy of argv in python.c. Could

[issue14379] Several traceback docs improvements

2012-03-26 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14379 ___ ___

[issue3367] Uninitialized value read in parsetok.c

2012-03-26 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: 3) line 1812 assumes n to be equal to the length of arg0, but depending on conditional compilation, it may not get set at all, and in any case in line line 1805 it gets set only if p is not NULL. n is initialized to 0

[issue14373] C implementation of functools.lru_cache

2012-03-26 Thread Matt Joiner
Matt Joiner anacro...@gmail.com added the comment: I've fixed the commenting, and cache_info use. I've left the element management in pure C as it reduces memory use (56 bytes for 4 element list, vs. 16 for lru_cache_elem), and avoids ref counting overhead (3 refs per link, plus GC). The

[issue14373] C implementation of functools.lru_cache

2012-03-26 Thread Matt Joiner
Changes by Matt Joiner anacro...@gmail.com: Removed file: http://bugs.python.org/file24958/functools.lru_cache-in-c ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14373 ___

[issue14412] Sqlite Integer Fields

2012-03-26 Thread Mendez
New submission from Mendez goatsofmen...@users.sourceforge.net: There appears to be a problem with the handling of integer fields in SQLite in the 32-bit release candidate for 2.7.3. I'm running the 64-bit version of Windows 7. I've attached a script which reproduces the issue. The following

[issue3367] Uninitialized value read in parsetok.c

2012-03-26 Thread STINNER Victor
STINNER Victor victor.stin...@gmail.com added the comment: Kristján's patch is wrong: n should be set to 0 even if argc 0. The patch is also useless with argv-alloc.diff. @Stefan: Your patch is correct and solves the issue. You can commit it to 2.7, 3.2 and 3.3. --

[issue3367] Uninitialized value read in parsetok.c

2012-03-26 Thread Kristján Valur Jónsson
Kristján Valur Jónsson krist...@ccpgames.com added the comment: I'm sure you didn't intend to use words such as wrong and useless Victor. Perhaps n must be 0 even for argc0, but I did that as an afterthought. Which is the reason I asked you to take a look rather than committing this right

[issue14412] Sqlite Integer Fields

2012-03-26 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Can't reproduce under Linux. Can someone test under Windows? -- components: +Library (Lib) nosy: +benjamin.peterson, brian.curtin, pitrou, tim.golden priority: normal - release blocker ___ Python

[issue3367] Uninitialized value read in parsetok.c

2012-03-26 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: I only have the C99 standard. It says [5.1.2.2.1]: - argv[argc] shall be a NULL pointer. Is this different in C89? Also, my patch terminates the *copies* of argv, not argv itself. -- ___

[issue3367] Uninitialized value read in parsetok.c

2012-03-26 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: KR page 115 also says: The standard requires that argv[argc] be a NULL pointer. So it must be in C89 as well. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3367

[issue14386] Expose dictproxy as a public type

2012-03-26 Thread STINNER Victor
STINNER Victor victor.stin...@gmail.com added the comment: New patch replacing dictproxy() builtin type with collections.mappingview() type: - dictproxy() type doesn't need to be a builtin type - it is not specific to dict so replace dict prefix with mapping - view is a better suffix than

[issue3367] Uninitialized value read in parsetok.c

2012-03-26 Thread STINNER Victor
STINNER Victor victor.stin...@gmail.com added the comment: I'm sure you didn't intend to use words such as wrong and useless Victor.  Perhaps n must be 0 even for argc0, but I did that as an afterthought. If n is initialized as wcslen(argv[0]), test_cmd_line_script fails. --

  1   2   3   >