Re: [Tutor] Difference between decorator and inheritance

2019-08-02 Thread Cameron Simpson
On 02Aug2019 11:26, bob gailer wrote: And now for something completely different... Decorators are not required to return a function! I use them to create a dictionary that maps function names to the corresponding function object. That is an interesting idea! But I want to counter it, briefly

Re: [Tutor] Difference between decorator and inheritance

2019-08-02 Thread bob gailer
And now for something completely different... Decorators are not required to return a function! I use them to create a dictionary that maps function names to the corresponding function object. This is very useful when associating actions with user-entered commands. Example: def collect(fun

Re: [Tutor] Difference between decorator and inheritance

2019-08-02 Thread Mats Wichmann
On 7/31/19 11:57 AM, Gursimran Maken wrote: > Hi, > > Anyone could please let me know the difference between decorators and > inheritance in python. > > Both are required to add additional functionality to a method then why are > we having 2 separate things in python for doing same kind of work.

Re: [Tutor] Difference between decorator and inheritance

2019-08-01 Thread Alan Gauld via Tutor
On 31/07/2019 18:57, Gursimran Maken wrote: > Anyone could please let me know the difference between decorators and > inheritance in python. > > Both are required to add additional functionality to a method then why are > we having 2 separate things in python for doing same kind of work. Inherit

[Tutor] Difference between decorator and inheritance

2019-08-01 Thread Gursimran Maken
Hi, Anyone could please let me know the difference between decorators and inheritance in python. Both are required to add additional functionality to a method then why are we having 2 separate things in python for doing same kind of work. Thank you, Gursimran

Re: [Tutor] Difference between array( [1, 0, 1] ) and array( [ [1, 0, 1] ] )

2019-06-22 Thread Markos
Thanks Edmondo, Stephen, Mats and Steven you for the tips, I studied linear algebra many years ago and I remember only a few rudiments. But I was trying to visualize (in a geometric way) how the numpy represents arrays, and what the geometrical meaning of the transpose operation made by numpy.

Re: [Tutor] difference between array([1,0,1]) and array([[1,0,1]])

2019-06-21 Thread Steven D'Aprano
On Thu, Jun 20, 2019 at 08:39:35PM -0300, Markos wrote: > Hi, > > I'm studying Numpy and I don't understand the difference between > > >>>vector_1 = np.array( [ 1,0,1 ] ) > > with 1 bracket and > > >>>vector_2 = np.array( [ [ 1,0,1 ] ] ) > > with 2 brackets I'm not really sure what you don't

Re: [Tutor] difference between array([1,0,1]) and array([[1,0,1]])

2019-06-21 Thread Mats Wichmann
On 6/20/19 5:39 PM, Markos wrote: > Hi, > > I'm studying Numpy and I don't understand the difference between > vector_1 = np.array( [ 1,0,1 ] ) > > with 1 bracket and > vector_2 = np.array( [ [ 1,0,1 ] ] ) > > with 2 brackets the first is one-dimensional, the second two-dimensional.

[Tutor] difference between array([1,0,1]) and array([[1,0,1]])

2019-06-21 Thread Markos
Hi, I'm studying Numpy and I don't understand the difference between vector_1 = np.array( [ 1,0,1 ] ) with 1 bracket and vector_2 = np.array( [ [ 1,0,1 ] ] ) with 2 brackets The shape of vector_1 is: vector_1.shape (3,) But the shape of vector_2 is: vector_2.shape (1, 3) The tran

Re: [Tutor] Difference(s) betweenPython 3 static methods with and without @staticmethod?

2017-08-08 Thread boB Stepp
On Tue, Aug 8, 2017 at 2:39 AM, Alan Gauld via Tutor wrote: > On 08/08/17 02:22, boB Stepp wrote: [snip lots of good stuff] I am coming to the conclusion I need to code a substantial, challenging project using OOP techniques, instead of just the toy programs I have been playing around with so fa

Re: [Tutor] Difference(s) betweenPython 3 static methods with and without @staticmethod?

2017-08-08 Thread Cameron Simpson
On 08Aug2017 08:39, Alan Gauld wrote: (1) There are very, very few good uses for static methods in Python. If you think you need a static method, you probably could just use a regular module-level function. Amen to that, I try to avoid staticmethods... and so far have never found a valid use f

Re: [Tutor] Difference(s) betweenPython 3 static methods with and without @staticmethod?

2017-08-08 Thread Peter Otten
Alan Gauld via Tutor wrote: > classes are objects too... Also, classes are instances. Given >>> class Foo: ... pass ... >>> foo = Foo() >>> type(foo) >>> type(Foo) what is the type of the type of the type ... of foo? The answer is a circular definition that you cannot spell in Python its

Re: [Tutor] Difference(s) betweenPython 3 static methods with and without @staticmethod?

2017-08-08 Thread Alan Gauld via Tutor
On 08/08/17 02:22, boB Stepp wrote: > "@staticmethod" then there are two ways of calling the method, using > objects or using the class. Is there some reason not to use the > "ClassName.a_static_method()" syntax? Are there intended uses for > doing this? classes are objects too... You could ha

Re: [Tutor] Difference(s) betweenPython 3 static methods with and without @staticmethod?

2017-08-08 Thread Cameron Simpson
On 07Aug2017 20:22, boB Stepp wrote: On Mon, Aug 7, 2017 at 8:36 AM, Steven D'Aprano wrote: [...] It is hard to see the distinction between an ordinary method and a static method from this example. What you are seeing is, by accident, the equivalent of just writing: def my_method(): prin

Re: [Tutor] Difference(s) betweenPython 3 static methods with and without @staticmethod?

2017-08-07 Thread boB Stepp
I feel like I have gazed into a crystal clear pool, apparently shallow, with many interesting objects (Pun intended!) on the pool floor. Interested in these beautiful things, I jump in to grab one for close-up study only to find that the pool is much, ... , much deeper (> 1 boB-height) than it app

Re: [Tutor] Difference(s) betweenPython 3 static methods with and without @staticmethod?

2017-08-07 Thread Steven D'Aprano
On Sun, Aug 06, 2017 at 06:35:10PM -0500, boB Stepp wrote: > py3: class MyClass: > ... def my_method(): > ... print('This is my_method in MyClass!') > ... > py3: class MyOtherClass: > ... @staticmethod > ... def my_other_method(): > ... print('This is my_other_m

Re: [Tutor] Difference(s) betweenPython 3 static methods with and without @staticmethod?

2017-08-06 Thread eryk sun
On Sun, Aug 6, 2017 at 11:35 PM, boB Stepp wrote: > > I see no difference in result, whether I use the @staticmethod decorator or > not. While a staticmethod and a function are both descriptors [1], a staticmethod is basically a no-op descriptor. Its __get__ method always returns its unbound cal

Re: [Tutor] Difference(s) betweenPython 3 static methods with and without @staticmethod?

2017-08-06 Thread Alan Gauld via Tutor
On 07/08/17 00:35, boB Stepp wrote: > = > Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 > bit (AMD64)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > p

[Tutor] Difference(s) betweenPython 3 static methods with and without @staticmethod?

2017-08-06 Thread boB Stepp
I am looking more deeply into the subject of decorators for a bit (So I can thoroughly digest Steve's information in the thread "basic decorator question".) and have been first looking at static and class methods. As a start, I have tried the following: ===

Re: [Tutor] Difference between %f and %F string formatting?

2017-04-27 Thread Cameron Simpson
On 26Apr2017 22:51, Tim Peters wrote: [boB Stepp , on %i/%d and %f/%F] Hmm. I'm surprised this slight distinction was worth keeping two format codes that otherwise do the same thing. Is there an actual need for these due to Python being implemented behind the scenes in C? The implementation

Re: [Tutor] Difference between %f and %F string formatting?

2017-04-27 Thread Mats Wichmann
F means print it in uppercase. That's really an edge case for a float, that would only apply to the special values infinity and not-a-number. On April 26, 2017 8:08:16 PM MDT, boB Stepp wrote: >My Google-fu must be weak tonight. I cannot find any discernible >difference between '%f' % and '%F'

Re: [Tutor] Difference between %f and %F string formatting?

2017-04-26 Thread Tim Peters
[boB Stepp , on %i/%d and %f/%F] > Hmm. I'm surprised this slight distinction was worth keeping two > format codes that otherwise do the same thing. Is there an actual > need for these due to Python being implemented behind the scenes in C? The implementation is irrelevant to this. What is rele

Re: [Tutor] Difference between %f and %F string formatting?

2017-04-26 Thread eryk sun
On Thu, Apr 27, 2017 at 2:19 AM, Tim Peters wrote: > [boB Stepp ] > >> I cannot find any discernible >> difference between '%f' % and '%F' % >> . Is there any or do they duplicate >> functionality? If the latter, why are there two ways of doing the >> same thing? > > They differ only in the ca

Re: [Tutor] Difference between %f and %F string formatting?

2017-04-26 Thread boB Stepp
On Wed, Apr 26, 2017 at 9:19 PM, Tim Peters wrote: > [boB Stepp ] >> My Google-fu must be weak tonight. > > Look here: > > https://en.wikipedia.org/wiki/Printf_format_string Thanks. From the %d versus %i links I found, I should have pursued the C history more diligently for the %f versus %F

Re: [Tutor] Difference between %f and %F string formatting?

2017-04-26 Thread Tim Peters
[boB Stepp ] > My Google-fu must be weak tonight. Look here: https://en.wikipedia.org/wiki/Printf_format_string > I cannot find any discernible > difference between '%f' % and '%F' % > . Is there any or do they duplicate > functionality? If the latter, why are there two ways of doing the

[Tutor] Difference between %f and %F string formatting?

2017-04-26 Thread boB Stepp
My Google-fu must be weak tonight. I cannot find any discernible difference between '%f' % and '%F' % . Is there any or do they duplicate functionality? If the latter, why are there two ways of doing the same thing? I had a similar question for %d and %i, but googling suggests these are inheri

Re: [Tutor] Difference between rounding off and typecasting to int

2016-01-02 Thread Alan Gauld
On 02/01/16 14:33, Ratheesh kumar wrote: > But I can't get to understand what round() did int() cant't do With this kind of question its best to ask the interpreter: >>> int(12.1) 12 >>> int(12.9) 12 >>> round(12.1) 12 >>> round(12.9) 13 >>> Does that make it clearer? -- Alan G Author of the

[Tutor] Difference between rounding off and typecasting to int

2016-01-02 Thread Ratheesh kumar
Hii everyone, Today i was just solving a problem in hacker-rank. A simple one to calculate the tip and tax for the meal. The resultant answer should be rounded off. I first wrote the code as below: m=float(input()) x=int(input()) t=int(input()) tip=(m*x)/100 tax=(m*t)/100 total=m+tip+tax print("T

Re: [Tutor] difference between expressions and statements

2014-04-10 Thread bob gailer
On 4/10/2014 5:48 PM, Jared Nielsen wrote: Thanks for the thorough answer, Bob. I now understand the difference. Thanks for the ACK. It helps me remember I have something to contribute. ___ Tutor maillist - Tutor@python.org To unsubscribe or change

Re: [Tutor] difference between expressions and statements

2014-04-10 Thread Jared Nielsen
Thanks for the thorough answer, Bob. I now understand the difference. On Apr 10, 2014 2:11 PM, "bob gailer" wrote: > Caveat: I began this before there were any other responses. So this may be > overkill - but I ike to be thorough. > > On 4/9/2014 12:49 PM, Jared Nielsen wrote: > >> Hi Pythons, >>

Re: [Tutor] difference between expressions and statements

2014-04-10 Thread bob gailer
Caveat: I began this before there were any other responses. So this may be overkill - but I ike to be thorough. On 4/9/2014 12:49 PM, Jared Nielsen wrote: Hi Pythons, Could someone explain the difference between expressions and statements? I know that expressions are statements that produce a

Re: [Tutor] difference between expressions and statements

2014-04-09 Thread Dave Angel
Jared Nielsen Wrote in message: > Hi Pythons, > Could someone explain the difference between expressions and statements? > I know that expressions are statements that produce a value. > I'm unclear on functions and especially strings. > Are any of the following expressions? > > print(42) > print(

Re: [Tutor] difference between expressions and statements

2014-04-09 Thread Ben Finney
Jared Nielsen writes: > Could someone explain the difference between expressions and > statements? For general programming terminology, the Wikipedia articles tend to be good. https://en.wikipedia.org/wiki/Expression_%28computer_science%29> https://en.wikipedia.org/wiki/Statement_%28computer_sc

Re: [Tutor] difference between expressions and statements

2014-04-09 Thread Alan Gauld
On 09/04/14 17:49, Jared Nielsen wrote: Hi Pythons, Could someone explain the difference between expressions and statements? I know that expressions are statements that produce a value. Yep, that's it. I'm unclear on functions and especially strings. Unclear in what way? Both functions and

Re: [Tutor] difference between expressions and statements

2014-04-09 Thread Danny Yoo
> Could someone explain the difference between expressions and statements? > > I know that expressions are statements that produce a value. Yes, that's pretty much it. If you can point your finger at the thing and say that it produces a value, it's an expression. > Are any of the following expr

[Tutor] difference between expressions and statements

2014-04-09 Thread Jared Nielsen
Hi Pythons, Could someone explain the difference between expressions and statements? I know that expressions are statements that produce a value. I'm unclear on functions and especially strings. Are any of the following expressions? print(42) print("spam") spam = 42 print(spam) Is the first examp

Re: [Tutor] Difference between max(one, two) and max((one, two))

2013-07-10 Thread Dave Angel
On 07/05/2013 02:37 PM, Amandeep Behl wrote: and why with sum(one, two) we get an error whereas not with sum((one, two)) ? When replying to a message, your new text should go AFTER the quote. Putting it first is called top-posting, and it's a Microsoft-introduced abomination that's not compa

Re: [Tutor] Difference between max(one, two) and max((one, two))

2013-07-10 Thread Amandeep Behl
and why with sum(one, two) we get an error whereas not with sum((one, two)) ? On Fri, Jul 5, 2013 at 11:27 AM, Amandeep Behl wrote: > What is the difference between max(one, two) and max((one, two)) ? > > Thanks > Aman > ___ Tutor maillist - Tutor@py

[Tutor] Difference between max(one, two) and max((one, two))

2013-07-10 Thread Amandeep Behl
What is the difference between max(one, two) and max((one, two)) ? Thanks Aman ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Difference between types

2013-05-23 Thread Steven D'Aprano
On 24/05/13 05:57, Citizen Kant wrote: I guess I'm understanding that, in Python, if something belongs to a type, must also be a value. Everything in Python is a value, and everything belongs to a type. Including other types. Yes, types are values too, and types have types of their own. There

Re: [Tutor] Difference between types

2013-05-23 Thread Dave Angel
On 05/23/2013 03:57 PM, Citizen Kant wrote: It's quite hard to believe that you're not just trolling. Little that you say below makes any sense with regards to Python. I guess I'm understanding that, in Python, if something belongs to a type, must also be a value. Nothing belongs to a ty

Re: [Tutor] Difference between types

2013-05-23 Thread boB Stepp
On Thu, May 23, 2013 at 2:57 PM, Citizen Kant wrote: > I guess I'm understanding that, in Python, if something belongs to a type, > must also be a value. > > I guess I'm understanding that the reason why 9 is considered a value, is > since it's a normal form, an element of the system that cannot b

Re: [Tutor] Difference between types

2013-05-23 Thread Matthew Ngaha
wait for someone more knowledgeable to answer, but from what i know, Yes it does have a profound meaning. Strings consist of character sets. Something that was here way before Python Like i said my experience is limited so i too would like to hear some reponses ___

[Tutor] Difference between types

2013-05-23 Thread Citizen Kant
I guess I'm understanding that, in Python, if something belongs to a type, must also be a value. I guess I'm understanding that the reason why 9 is considered a value, is since it's a normal form*,* an element of the system that cannot be rewritten and reduced any further. I also guess I'm unders

Re: [Tutor] difference between super() and parent.__init__()?

2011-10-21 Thread Steven D'Aprano
Alex Hall wrote: On 10/21/11, Steven D'Aprano wrote: [...] The one exception to this is if your class changes the method signature. E.g. if A.method takes no arguments, but B.method requires an argument. super cannot help you now. But changing the signature of methods is almost always the wron

Re: [Tutor] difference between super() and parent.__init__()?

2011-10-21 Thread Alex Hall
On 10/21/11, Steven D'Aprano wrote: > Alex Hall wrote: >> Hi all, >> I am just curious: I have seen classes that are subclasses initialize >> their parents through both super and parentClass.__init__. What is the >> difference, if any, and is one "better" or "more pythonic" than the >> other? > >

Re: [Tutor] difference between super() and parent.__init__()?

2011-10-21 Thread Steven D'Aprano
Alex Hall wrote: Hi all, I am just curious: I have seen classes that are subclasses initialize their parents through both super and parentClass.__init__. What is the difference, if any, and is one "better" or "more pythonic" than the other? A simple question with a complicated answer... Firs

[Tutor] difference between super() and parent.__init__()?

2011-10-21 Thread Alex Hall
Hi all, I am just curious: I have seen classes that are subclasses initialize their parents through both super and parentClass.__init__. What is the difference, if any, and is one "better" or "more pythonic" than the other? -- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com

Re: [Tutor] Difference

2011-03-20 Thread Corey Richardson
-Original Message- From: ANKUR AGGARWAL To: tutor Sent: Sun, Mar 20, 2011 1:49 pm Subject: [Tutor] Difference Hey want to know whats the difference between the pygame.display.update() and pygame.display.flip() An explanation with the example would be grea. Thanks In Advance Ankur

[Tutor] Difference

2011-03-20 Thread ANKUR AGGARWAL
Hey want to know whats the difference between the pygame.display.update() and pygame.display.flip() An explanation with the example would be grea. Thanks In Advance Ankur Aggarwal ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscripti

Re: [Tutor] Difference between SimpleCookie and SmartCookie

2009-03-25 Thread Kent Johnson
On Wed, Mar 25, 2009 at 12:35 AM, Kumar wrote: > Thanks a lot for the reply Kent . > Could you please tell me If I will try to move from SmartCookie to > SimpleCokkie in out application, what precautions should I take care? Make sure that all the values in the Morsels are strings. Kent _

Re: [Tutor] Difference between SimpleCookie and SmartCookie

2009-03-24 Thread Kumar
Thanks a lot for the reply Kent . Could you please tell me If I will try to move from SmartCookie to SimpleCokkie in out application, what precautions should I take care? -Thanks Kumar On Tue, Mar 24, 2009 at 8:50 PM, Kent Johnson wrote: > On Tue, Mar 24, 2009 at 10:33 AM, Kumar wrote: > > I ju

Re: [Tutor] Difference between SimpleCookie and SmartCookie

2009-03-24 Thread Kent Johnson
On Tue, Mar 24, 2009 at 10:33 AM, Kumar wrote: > I just came to know about this classes SimpleCookie and SmartCookie. > I could get that usage. But I didn't get the difference between these > classes? > Can anybody please tell me what is the difference between this classes? SmartCookie allows coo

[Tutor] Difference between SimpleCookie and SmartCookie

2009-03-24 Thread Kumar
Hello, I am new to python. I just came to know about this classes SimpleCookie and SmartCookie. I could get that usage. But I didn't get the difference between these classes? Can anybody please tell me what is the difference between this classes? -Kumar __

Re: [Tutor] Difference in minutes between two time stamps

2009-03-03 Thread Tim Michelsen
import datetime s = '09:35:23' datetime.datetime.strptime(s, '%H:%M:%S') datetime.datetime(1900, 1, 1, 9, 35, 23) Can you figure out how to proceed from there? In case she doesn't know: import datetime as dt start="09:35:23" end="10:23:00" start_dt = dt.datetime.strptime(start, '%H:%

Re: [Tutor] Difference in minutes between two time stamps

2009-03-03 Thread Tim Michelsen
import datetime s = '09:35:23' datetime.datetime.strptime(s, '%H:%M:%S') datetime.datetime(1900, 1, 1, 9, 35, 23) Can you figure out how to proceed from there? In case she doesn't know: import datetime as dt start="09:35:23" end="10:23:00" start_dt = dt.datetime.strptime(start, '%H:%M:

Re: [Tutor] Difference in minutes between two time stamps

2009-03-02 Thread Chris Fuller
Use time.strptime() to parse them into seconds since the start of epoch, and then an ordinary numeric subtraction will work. Cheers On Monday 02 March 2009 19:45, Judith Flores wrote: > Hello, > >I can't seem to figure out the syntax to calculate the difference in > minutes between two time

Re: [Tutor] Difference in minutes between two time stamps

2009-03-02 Thread John Fouhy
2009/3/3 Judith Flores : > > Hello, > >   I can't seem to figure out the syntax to calculate the difference in > minutes between two time stamps. I already read the documentation about > datetime and time modules, but I was unable to implement the code. > > My code will be fed with two timestamps

[Tutor] Difference in minutes between two time stamps

2009-03-02 Thread Judith Flores
Hello, I can't seem to figure out the syntax to calculate the difference in minutes between two time stamps. I already read the documentation about datetime and time modules, but I was unable to implement the code. My code will be fed with two timestamps (as styrings): start="09:35:23" end

Re: [Tutor] Difference between Perl and Python

2007-11-04 Thread Steve Willoughby
Varsha Purohit wrote: > Hello everyone, >I wanted to know what are the differences between perl and > python, since both of them are scripting languages... There is plenty of difference between them and between all the other scripting languages. Look beyond the notion of "scripting" and

[Tutor] Difference between Perl and Python

2007-11-04 Thread Varsha Purohit
Hello everyone, I wanted to know what are the differences between perl and python, since both of them are scripting languages... thanks -- Varsha, ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Alan Gauld
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote >> Thanks guys it was really helpful i m just a beginner in >> python >> start to program since two days back. So finding little difficulty >> with >> some concepts. >> > > Don't worry, I'm a 20 days "old timer". ;c) And I've been using Python for

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Ricardo Aráoz
Varsha Purohit wrote: > > Thanks guys it was really helpful i m just a beginner in python > start to program since two days back. So finding little difficulty with > some concepts. > Don't worry, I'm a 20 days "old timer". ;c) ___ Tutor maillist

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Alan Gauld
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote >>From Python 2.5 documentation : > > index( sub[, start[, end]]) > Like find(), but raise ValueError when the substring is not found. As opposed to find() which returns -1 when the string is not found. That means you can use try/except with index but mu

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Varsha Purohit
Thanks guys it was really helpful i m just a beginner in python start to program since two days back. So finding little difficulty with some concepts. On 9/2/07, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > > Varsha Purohit wrote: > > Hello, > > i have again very basic question in python stri

Re: [Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Ricardo Aráoz
Varsha Purohit wrote: > Hello, > i have again very basic question in python string management. > > I am not able to understand how find and index works and what do they > actually return. > line = "this is varsha" print line.find("is") > 2 print line.rfind("is") > 5 print li

[Tutor] [tutor] Difference between index and find in manipulating strings

2007-09-02 Thread Varsha Purohit
Hello, i have again very basic question in python string management. I am not able to understand how find and index works and what do they actually return. >>> line = "this is varsha" >>> print line.find("is") 2 >>> print line.rfind("is") 5 >>> print line.rfind("varsha") 8 >>> print line.index(

Re: [Tutor] Difference between filter and map

2007-01-24 Thread Alan Gauld
"vanam" <[EMAIL PROTECTED]> wrote > Yes i did a mistake in expressing my problem below are the instances > of the > script and its corresponding output,for each instance its giving > contrasting > result i want explanation for that > [1]:def squ(n): > return n*n > filter(squ,rang

Re: [Tutor] Difference between filter and map

2007-01-24 Thread Kent Johnson
vanam wrote: > Yes i did a mistake in expressing my problem below are the instances of > the script and its corresponding output,for each instance its giving > contrasting result i want explanation for that This has pretty much been explained already. Do you have some question with the explanat

Re: [Tutor] Difference between filter and map

2007-01-23 Thread vanam
Yes i did a mistake in expressing my problem below are the instances of the script and its corresponding output,for each instance its giving contrasting result i want explanation for that [1]:def squ(n): return n*n filter(squ,range(3))>output is not seen on the interpreter ma

Re: [Tutor] Difference between filter and map

2007-01-23 Thread Chris Calloway
vanam wrote: > ya i am sure about that i am using python editor which has python > intrepreter attached to it i got the same output for both filter and map > def squ(n): >y = n*n > print y > filter(y,range(3))->0 1 4 > map(y,range(3))->0 1 4 You are not printing the result of either the fi

Re: [Tutor] Difference between filter and map

2007-01-23 Thread Chris Calloway
vanam wrote: > i want to know the difference between filter(function,sequence) and > map(function,sequence). >>> print filter.__doc__ filter(function or None, sequence) -> list, tuple, or string Return those items of sequence for which function(item) is true. If function is None, return the ite

Re: [Tutor] Difference between filter and map

2007-01-23 Thread Kent Johnson
vanam wrote: > ya i am sure about that i am using python editor which has python > intrepreter attached to it i got the same output for both filter and map > def squ(n): >y = n*n > print y > filter(y,range(3))->0 1 4 > map(y,range(3))->0 1 4 This is quite different that what you posted the

Re: [Tutor] Difference between filter and map

2007-01-23 Thread Danny Yoo
On Tue, 23 Jan 2007, vanam wrote: > i want to know the difference between filter(function,sequence) and > map(function,sequence). Hi Vanam, They may both take functions as input, but the intention of the functions is different. In the case of filter(), the input function is used to cull the

Re: [Tutor] Difference between filter and map

2007-01-23 Thread vanam
ya i am sure about that i am using python editor which has python intrepreter attached to it i got the same output for both filter and map def squ(n): y = n*n print y filter(y,range(3))->0 1 4 map(y,range(3))->0 1 4 On 1/23/07, Kent Johnson <[EMAIL PROTECTED]> wrote: vanam wrote: > i want t

Re: [Tutor] Difference between filter and map

2007-01-23 Thread Kent Johnson
vanam wrote: > i want to know the difference between filter(function,sequence) and > map(function,sequence).I tried for a simple script with an function > which finds the square of the number,after including separately filter > and map in the script i am getting the same results for instance > d

[Tutor] Difference between filter and map

2007-01-23 Thread vanam
i want to know the difference between filter(function,sequence) and map(function,sequence).I tried for a simple script with an function which finds the square of the number,after including separately filter and map in the script i am getting the same results for instance def squ(x): return x*x

Re: [Tutor] Difference between 'yield' and 'print'

2007-01-17 Thread Kent Johnson
Luke Paireepinart wrote: > Refer to http://docs.python.org/ref/yield.html for information about yield. > Disclaimer: The following information I'm going to present you I came up > with after reading that short explanation of 'yield' so it may not be > exactly correct. There is a longer explanat

Re: [Tutor] Difference between 'yield' and 'print'

2007-01-17 Thread Luke Paireepinart
raghu raghu wrote: > Is there any difference between yield and print in python script?i > have written a script based on fibonacci series where in i used yield > and print in two different scripts: > the script is given below: > def fib(n): > a,b = 0,1 > while a<=n: >print a >

[Tutor] Difference between 'yield' and 'print'

2007-01-16 Thread raghu raghu
Is there any difference between yield and print in python script?i have written a script based on fibonacci series where in i used yield and print in two different scripts: the script is given below: def fib(n): a,b = 0,1 while a<=n: print a a,b = b,a+b for x in fib(4): print

Re: [Tutor] Difference between popens

2006-06-10 Thread Michael P. Reilly
On 6/9/06, Bernard Lebel <[EMAIL PROTECTED]> wrote: Hey, thanks for the nice explanation Michael!BernardWhoops.. Hit "reply" instead of "reply to all".  My apologies to the group.  Dang gmail.  -Michael -- There's so many different worlds,So many different suns.And we have just one world,But we liv

Re: [Tutor] Difference between popens

2006-06-09 Thread Alan Gauld
> I'd like to know what are the differences at the various os.popenX > flavors. I read the documentation and I can see they return file > objects. so what can you do with these file objects? I mean, why > would you need a set of file objects rather than another? My OS topic covers some of the

Re: [Tutor] Difference between popens

2006-06-09 Thread Bernard Lebel
Hey, thanks for the nice explanation Michael! Bernard On 6/9/06, Michael P. Reilly <[EMAIL PROTECTED]> wrote: > Excuse the slightly pedantic discussion before I get to a real-world > example, but the differences get into something a bit deeper than Python and > into what is called "interproces

Re: [Tutor] Difference between popens

2006-06-09 Thread Dave Kuhlman
On Fri, Jun 09, 2006 at 03:38:58PM -0400, Bernard Lebel wrote: > Hi, > > I'd like to know what are the differences at the various os.popenX > flavors. I read the documentation and I can see they return file > objects. so what can you do with these file objects? I mean, why > would you need a s

[Tutor] Difference between popens

2006-06-09 Thread Bernard Lebel
Hi, I'd like to know what are the differences at the various os.popenX flavors. I read the documentation and I can see they return file objects. so what can you do with these file objects? I mean, why would you need a set of file objects rather than another? Sorry the difference is very not c

Re: [Tutor] difference between [[], [], []] and 3*[[]]

2005-05-22 Thread Mitsuo Hashimoto
2005/5/21, Kent Johnson <[EMAIL PROTECTED]>: > 3*[[]] makes a list with three references to the *same* list. This can cause > surprising behavior: > > >>> l=3*[[]] > >>> l > [[], [], []] > >>> l[0].append(1) > >>> l > [[1], [1], [1]] I see. > Often using a dict is a good solution to thi

Re: [Tutor] difference between [[], [], []] and 3*[[]]

2005-05-21 Thread Kent Johnson
Mitsuo Hashimoto wrote: > Hello, > > What's the difference between "[[], [], []]" and "3*[[]]" ? [[], [], []] makes a list containing references to three different lists. 3*[[]] makes a list with three references to the *same* list. This can cause surprising behavior: >>> l=3*[[]] >>> l [[

[Tutor] difference between [[], [], []] and 3*[[]]

2005-05-21 Thread Mitsuo Hashimoto
Hello, What's the difference between "[[], [], []]" and "3*[[]]" ? >>> a,b,c = [[], [], []] >>> id(a) 20609520 >>> id(b) 20722000 >>> id(c) 20721712 These ID is mutually different. But, >>> a,b,c = 3*[[]] >>> id(a) 20455728 >>> id(b) 20455728 >>> id(c) 20455728 >>> These are the same. On th

Re: [Tutor] Difference between for i in range(len(object)) andfor iin object

2004-12-18 Thread Jacob S.
> Thing is, for people like me, you generally either don't know that a > question is a dumb one until someone tells you the answer, (the 'of > course' moment), or until 5 minutes after you emailed > your query, you find the answer you were looking for... Amen! My life's story! Also, to Kumar. T

Re: [Tutor] Difference between for i in range(len(object)) andfor i in object

2004-12-13 Thread Liam Clarke
Good luck trying to find a decent Python book for beginners. I haven't been able to source Alan Gauld's book yet, (I'm saving for Amazon's shipping... I live in the Antipodes.), but afaik that's about the best one out, if his online tutorial (which I highly recommend Kumar, link at end.) is indic

Re: [Tutor] Difference between for i in range(len(object)) andfor i in object

2004-12-12 Thread Bob Gailer
At 08:27 AM 12/12/2004, kumar s wrote: Thank you for clearing up some mist here. In fact I was depressed by that e-mail I appreciate Alan's response and yours. I forgot that this was the Tutor list, as I see so many Python e-mails it is easy to get confused. Please resume seeing this list and m

Re: [Tutor] Difference between for i in range(len(object)) andfor i in object

2004-12-12 Thread kumar s
Thank you for clearing up some mist here. In fact I was depressed by that e-mail because there are not many tutorials that clearly explains the issues that one faces while trying to code in python. Also, due to lack of people who are proficient in python around our univ. campus in baltimore, i am

Re: [Tutor] Difference between for i in range(len(object)) andfor i in object

2004-12-09 Thread Alan Gauld
> Personally I am getting weary of a lot of requests that to me seem to come > from a lack of understanding of Python.. To be fair that is what the tutor list is for - learning Python. > Would you be willing to take a good tutorial so you understand > basic Python concepts and apply them to your

Re: [Tutor] Difference between for i in range(len(object)) and for i inobject

2004-12-09 Thread Alan Gauld
> Here is my code: > >>> spot_cor=[] > >>> for m in cor: > ... cols = split(cor,'\t') You are splitting the list not the item cols = split(m, '\t') Better to use a meaningful name too: for line in cor: would probably have made the mistake more obvious. > However, when I trie

Re: [Tutor] Difference between for i in range(len(object)) and for i in object

2004-12-09 Thread Jeff Shannon
kumar s wrote: > Here is my code: spot_cor=[] Create an empty list... for m in cor: Now, for each element in some other list from somewhere else, ... cols = split(cor,'\t') Ignore the element we've just isolated and try to split the entire list on '\t' ... Traceback (most recent call last):

Re: [Tutor] Difference between for i in range(len(object)) and for i in object

2004-12-09 Thread Bob Gailer
At 09:50 AM 12/9/2004, kumar s wrote: [snip] Personally I am getting weary of a lot of requests that to me seem to come from a lack of understanding of Python.. Would you be willing to take a good tutorial so you understand basic Python concepts and apply them to your code. I also despair that

RE: [Tutor] Difference between for i in range(len(object)) and for i in object

2004-12-09 Thread Robert, Andrew
764-7321 E-mail: [EMAIL PROTECTED] Linux User Number: #201204 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of kumar s Sent: Thursday, December 09, 2004 11:51 AM To: [EMAIL PROTECTED] Subject: [Tutor] Difference between for i in range(len(object)) and for i

[Tutor] Difference between for i in range(len(object)) and for i in object

2004-12-09 Thread kumar s
Dear group, My Tab delimited text looks like this: HG-U95Av2 32972_at432 117 HG-U95Av2 32972_at499 631 HG-U95Av2 32972_at12 185 HG-U95Av2 32972_at326 83 HG-U95Av2 32972_at62 197 I want to capture: co