Re: [Tutor] Help me out please

2016-07-20 Thread Danny Yoo
On Tue, Jul 19, 2016 at 4:31 AM, Marc Sànchez Quibus wrote: > Hi, > First of all I'm gonan introduce myself. My name is Marc and I'm a student > and also a python's programmer begginer. I've been studying/learning python > and now I need some help to finish my project. > I have two scripts, one of

Re: [Tutor] python programmin problem

2016-07-20 Thread Danny Yoo
On Wed, Jul 20, 2016 at 2:11 PM, monik...@netzero.net wrote: > Hi: > Can somebody please provide answer to following python programming question? > I have spent days on it and cannot come up with any code that would make any > sense for it so I cannot provide you any code. But I would appreciate

Re: [Tutor] python programmin problem

2016-07-20 Thread monik...@netzero.net
IM not able to figure out algorithm to find the runs. Here is the code I have: def ProgressCalc(items): counts = [items[0]] for i in range(1, len(items)-1): print "for loop", items[i], items[i + 1] if counts[- 1] < items[i]: counts += [items[i]] prin

[Tutor] python programmin problem

2016-07-20 Thread monik...@netzero.net
Hi: Can somebody please provide answer to following python programming question? I have spent days on it and cannot come up with any code that would make any sense for it so I cannot provide you any code. But I would appreciate the answer very much, if not in python, then in pseudo code. Thank y

Re: [Tutor] python programmin problem

2016-07-20 Thread Alan Gauld via Tutor
On 21/07/16 00:14, monik...@netzero.net wrote: > IM not able to figure out algorithm to find the runs. > Here is the code I have: OK, Forget about code for now. just focus on what is being asked. > > The first question to ask is can you do it without a computer? > > In other words given > > > > i

Re: [Tutor] python programmin problem

2016-07-20 Thread Alan Gauld via Tutor
On 20/07/16 22:11, monik...@netzero.net wrote: > ... if not in python, then in pseudo code. The first question to ask is can you do it without a computer? In other words given input [1,7,2,3,5,4,6] Can you first of all produce a list of all valid runs? [1,2,3,5,6] and [1,2,3,4,6] both have leng

Re: [Tutor] Writing decorators?

2016-07-20 Thread Steven D'Aprano
On Wed, Jul 20, 2016 at 03:30:43PM +0200, Michael Welle wrote: > > It [a decorator] > > can modify the function and return it, > > Now it gets interesting ;). Can you give me a hint on how to modify the > code of the function in a decorator or even give a small example, > please? Would I take the

Re: [Tutor] Writing decorators?

2016-07-20 Thread Alan Gauld via Tutor
On 20/07/16 14:30, Michael Welle wrote: > Now it gets interesting ;). Can you give me a hint on how to modify the > code of the function in a decorator or even give a small example, > please? Would I take the route with the bytecode attribute __code__ > (IIRC)? Or use the inspect module? Steven

Re: [Tutor] strange behavior of matrix**matrix

2016-07-20 Thread Steven D'Aprano
On Wed, Jul 20, 2016 at 10:27:50AM +0200, AB wrote: > Hello > > W dniu 2016-07-17 o 17:23, Steven D'Aprano pisze: > >[...] > >What result did you expect? 2**-1 as an int32 cannot be 0.5, as that's a > >float. > > I expected 0.5: as 2^(-1) is in fact 1/2, and as in Python 3 division of > two inte

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread nitin chandra
Me a little embarrassed :P ... but now when I retyped the code ... it seems to be working Alan, Peter .. .Thank you. On 20 July 2016 at 17:24, Peter Otten <__pete...@web.de> wrote: > nitin chandra wrote: > >> Ran both the method > > So everything seems to be working as expected. When you go

Re: [Tutor] Writing decorators?

2016-07-20 Thread Steven D'Aprano
On Wed, Jul 20, 2016 at 09:33:19AM +0200, Michael Welle wrote: > Somewhere in this thread (or the one talking about decorators after this > thread) it was said that a decorator 'changes a function'. I not a > native English speaker, so it could just be a language problem. But to > me it seems the

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread Peter Otten
nitin chandra wrote: > Ran both the method So everything seems to be working as expected. When you go back to your original script you can enable tracebacks rendered as html with #!/usr/bin/env python import cgitb cgitb.enable() ... # your code Provided there are no syntax errors in the scrip

Re: [Tutor] Writing decorators?

2016-07-20 Thread Ben Finney
Michael Welle writes: > so 'the function has changed' really means 'the reference has > changed'? Strange. Humans think in strage ways :-) Really, though, it shouldn't be too surprising. The *perception* is that the reference (a name, or an index in a sequence, or whatever) remains unchanged; a

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread nitin chandra
Ran both the method #!/usr/bin/env python import cgi import psycopg2 import sys print """Content-type:text/html\r\n\r\n""" print """ Hello Word - First CGI Program Hello Word! This is my first CGI program {version} First name: """.format(version=sys.version) and its output (below) nitin@n

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread Peter Otten
nitin chandra wrote: > On inserting the line ... > > print " + "sys.version + "" > > required slight correction > > print "" + sys.version + "" > > and the following script and its output are below :- > > #!/usr/bin/env python > > import sys > import c

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread nitin chandra
On inserting the line ... print " + "sys.version + "" required slight correction print "" + sys.version + "" and the following script and its output are below :- #!/usr/bin/env python import sys import cgi import psycopg2 print "Content-type:text/html\

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread Alan Gauld via Tutor
On 20/07/16 09:23, nitin chandra wrote: > vimal@Ubuntu-1404-trusty-64-minimal:~$ python > Python 2.7.6 (default, Jun 22 2015, 17:58:13) > [GCC 4.8.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import sys print sys.version > 2.7.6 (default, Jun 22 2

Re: [Tutor] Writing decorators?

2016-07-20 Thread Alan Gauld via Tutor
On 20/07/16 09:08, Michael Welle wrote: >> Don't be surprised, though, if the concept “replace the object >> referenced by ‘foo’ with a different object and discard the prior object >> at that reference“ is glossed to “change ‘foo’” in casual usage :-) > I'm a bit surprised to see that kind of slo

Re: [Tutor] python cgi single double quotes

2016-07-20 Thread nitin chandra
Hi Alan, vimal@Ubuntu-1404-trusty-64-minimal:~$ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.version 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] >>> Should I t

Re: [Tutor] Need Your help

2016-07-20 Thread Joaquin Alzola
>I'm creating a mobile application [ http://e-aadhaarcard.in ] and I'm using >python for a desktop server. However, I don't have access to a static IP on >the desktop, but do have a website. Is it possible to connect from mobile http >website -> desktop server >and back? Try using a LAN so all

Re: [Tutor] Writing decorators?

2016-07-20 Thread Ben Finney
Michael Welle writes: > Somewhere in this thread (or the one talking about decorators after > this thread) it was said that a decorator 'changes a function'. I not > a native English speaker, so it could just be a language problem. But > to me it seems the function is replaced, not changed? That