Re: Everything is an object in python - object class and type class

2015-06-02 Thread Steven D'Aprano
On Tuesday 02 June 2015 10:24, TheDoctor wrote: > A type is not an object in the same way an instantiated type is an object > -- anymore than a blueprint for a building is the building itself. Nobody says that blueprints are *buildings*. But buildings are not the only kind of object that exists.

Re: Language design

2015-06-02 Thread Steven D'Aprano
On Tuesday 02 June 2015 10:10, TheDoctor wrote: > On Friday, September 13, 2013 at 12:08:04 AM UTC-5, Steven D'Aprano wrote: Mark, you are digging up a conversation from nearly two years ago. Seriously? >> It makes no difference whether I write: >> >> atoms -> stars -> galaxies >> >> or

Re: What use of string module?

2015-06-02 Thread Steven D'Aprano
On Tuesday 02 June 2015 12:14, fl wrote: > Hi, > > I read the online help about string. It lists string constants, string > formatting, template strings and string functions. After reading these, > I am still puzzled about how to use the string module. > > Could you show me a few example about t

Re: Language design

2015-06-02 Thread Steven D'Aprano
On Tuesday 02 June 2015 07:45, TheDoctor wrote: > On Wednesday, September 11, 2013 at 6:40:22 PM UTC-5, Steven D'Aprano > wrote: >> On Wed, 11 Sep 2013 14:30:54 -0700, Mark Janssen wrote: >> >> > 1) It tried to make Object the parent of every class. >> >> Tried, and succeeded. > > Oh? How abou

Re: Language design

2015-06-02 Thread Chris Angelico
On Tue, Jun 2, 2015 at 5:19 PM, Steven D'Aprano wrote: > but that's not what my second example says. Look closely, and consider that > sometimes we write "Mark's hat" and sometimes "the hat of Mark". ... and sometimes "the hat Mark's talking through", which appears to put "hat" and "Mark's" the o

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 12:42:31 PM UTC+5:30, Steven D'Aprano wrote: > On Tuesday 02 June 2015 10:24, TheDoctor wrote: > > > A type is not an object in the same way an instantiated type is an object > > -- anymore than a blueprint for a building is the building itself. > > Nobody says that bl

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Chris Angelico
On Tue, Jun 2, 2015 at 5:44 PM, Rustom Mody wrote: >> Plates and spoons and knives and forks are objects. >> Cars and trucks and ships and planes are objects. >> Books and shoes and maps and compasses are objects. >> Buildings are objects. >> And blueprints of buildings are objects too. > > You ar

Knowledge Requirements for Machine Learning (SKLearn)

2015-06-02 Thread chrismeek4542
I would like to get into Machine learning. The problem I have is that my Math skills are sadly lacking. I went through SKlearn docs but it is beyond me. Could anyone recommended some resources to get up to speed with the subject? -- https://mail.python.org/mailman/listinfo/python-list

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 2:08:08 PM UTC+5:30, Chris Angelico wrote: > On Tue, Jun 2, 2015 at 5:44 PM, Rustom Mody wrote: > >> Plates and spoons and knives and forks are objects. > >> Cars and trucks and ships and planes are objects. > >> Books and shoes and maps and compasses are objects. > >> B

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Jun 2, 2015 at 5:44 PM, Rustom Mody wrote: >> 1 ∈ all these >> Are the '∈'s here same? Similar? > > Yes, they are. Every one of them is asserting (or asking, depending on > your point of view) whether or not the instance to its left is a > member of the set to its righ

Re: What use of string module?

2015-06-02 Thread Laura Creighton
In a message of Mon, 01 Jun 2015 19:14:18 -0700, fl writes: >Hi, > >I read the online help about string. It lists string constants, string >formatting, template strings and string functions. After reading these, >I am still puzzled about how to use the string module. > >Could you show me a few ex

Re: Knowledge Requirements for Machine Learning (SKLearn)

2015-06-02 Thread Fabien
On 06/02/2015 11:16 AM, chrismeek4...@gmail.com wrote: I would like to get into Machine learning. An Introduction to Statistical Learning: http://www-bcf.usc.edu/~gareth/ISL/ and corresponding MOOC. SKLearn and Statsmodels mailing lists: http://dir.gmane.org/gmane.comp.python.scikit-learn htt

Re: Knowledge Requirements for Machine Learning (SKLearn)

2015-06-02 Thread Laura Creighton
https://www.udacity.com/course/intro-to-machine-learning--ud120 Free online course using Python. Laura -- https://mail.python.org/mailman/listinfo/python-list

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Eddilbert Macharia
On Sunday, May 31, 2015 at 5:34:20 PM UTC+3, Eddilbert Macharia wrote: > Hello All , > > I'm wrecking my head trying to understand. where the class object comes into > play . > > Is it only meant to act as base class and does it mean there is an actual > class called object in python which all

Re: Everything is an object in python - object class and type class

2015-06-02 Thread BartC
On 01/06/2015 23:59, BartC wrote: In the new class style, type and class sort of mean the same thing. I'm developing a new language along the lines of Python, (After reading some of the rest of the sub-thread, I'm glad I reined in some of the proposed changes to my existing language to make

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Mark Lawrence
On 02/06/2015 11:36, Eddilbert Macharia wrote: you guys are just confusing me, you are going in loops, and still i have understood ,what makes everything in python an object. After 14 or more years writing Python I can't really answer that and quite frankly it doesn't worry me as I can quite

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 4:16:02 PM UTC+5:30, BartC wrote: > On 01/06/2015 23:59, BartC wrote: > > >> In the new class style, type and class sort of mean the same thing. > > > > I'm developing a new language along the lines of Python, > > (After reading some of the rest of the sub-thread, I'm

for...else

2015-06-02 Thread acdr
Hi, Currently, in various places in my code, I have the equivalent of: for x in it: if complicated_calculation_1(): cleanup() break complicated_calculation_2() if complicated_calculation_3(): cleanup() break Obviously, I'm repeating myself by having tw

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Steven D'Aprano
On Tue, 2 Jun 2015 08:36 pm, Eddilbert Macharia wrote: > you guys are just confusing me, you are going in loops, and still i have > understood ,what makes everything in python an object. hey is where i'm at > : *** type in python refers to data types e.g. int, str, boolean e.t.c. > right ? Yes. A

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 4:57:31 PM UTC+5:30, Steven D'Aprano wrote: > On Tue, 2 Jun 2015 08:36 pm, Eddilbert Macharia wrote: > > > you guys are just confusing me, you are going in loops, and still i have > > understood ,what makes everything in python an object. hey is where i'm at > > : *** t

Re: for...else

2015-06-02 Thread Todd
I think there is essentially zero chance of that. My understanding is that Guido regrets having "else" to begin with. But this should work broken = True for x in it: if complicated_calculation_1(): break complicated_calculation_2() if complicated_calculation_3(): brea

Re: Knowledge Requirements for Machine Learning (SKLearn)

2015-06-02 Thread chrismeek4542
Thank you both. Just what i was looking for -- https://mail.python.org/mailman/listinfo/python-list

How to access the low digits of a list

2015-06-02 Thread fl
Hi, I have a list: >>> lines ['12', '42', '49', '156', '225', '36', '49', '164', '11181', '3100'] I want to access the last two digits. That is: ['12', '42', '49', '56', '25', '36', '49', '64', '81', '00'] When I try to use lines[3][0] is '1' lines[3][1] is '5' lines[3][2] is '6' I d

Re: for...else

2015-06-02 Thread Peter Otten
acdr wrote: > Hi, > > Currently, in various places in my code, I have the equivalent of: > > for x in it: > if complicated_calculation_1(): > cleanup() > break > complicated_calculation_2() > if complicated_calculation_3(): > cleanup() > break > > Obv

Re: How to access the low digits of a list

2015-06-02 Thread Joel Goldstick
On Tue, Jun 2, 2015 at 8:23 AM, fl wrote: > Hi, > > I have a list: > > > > > > lines > ['12', '42', '49', '156', '225', '36', '49', '164', '11181', '3100'] > > > > I want to access the last two digits. That is: > > ['12', '42', '49', '56', '25', '36', '49', '64', '81', '00'] > > > When I try

Re: How to access the low digits of a list

2015-06-02 Thread Frank Stutzman
fl wrote: ---snip lines > ['12', '42', '49', '156', '225', '36', '49', '164', '11181', '3100'] > > > > I want to access the last two digits. That is: > > ['12', '42', '49', '56', '25', '36', '49', '64', '81', '00'] > > > When I try to use lines[3][0] is '1' > lines[3][1] is '5' > l

Re: for...else

2015-06-02 Thread Jean-Michel Pichavant
- Original Message - > From: "acdr" > To: python-list@python.org > Sent: Tuesday, 2 June, 2015 1:26:42 PM > Subject: for...else > > Hi, > > Currently, in various places in my code, I have the equivalent of: > > for x in it: > if complicated_calculation_1(): > cleanup() >

Re: How to access the low digits of a list

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 5:53:34 PM UTC+5:30, fl wrote: > Hi, > > I have a list: > > > > > > > >>> lines > ['12', '42', '49', '156', '225', '36', '49', '164', '11181', '3100'] > > > > I want to access the last two digits. That is: > > ['12', '42', '49', '56', '25', '36', '49', '64', '

Framework / CMS for Banking

2015-06-02 Thread Swapnil Bhadade
I am want to know which are the best CMS / framework for building web banking / Financial / lending services Best -- https://mail.python.org/mailman/listinfo/python-list

Re: Everything is an object in python - object class and type class

2015-06-02 Thread BartC
On 02/06/2015 12:27, Steven D'Aprano wrote: "Object" has a general meaning in computer science and programming, it is a compound data structure that is explicitly linked to a type which provides functionality that operates on that data structure. In the programming language C, *no* values are o

Re: for...else

2015-06-02 Thread acdr
That would work for my example, but it would only really work if all the calculations are in a nice function. If I just have a block of code, then I can't use it as easily. (E.g. replace "complicated_calculation_2()" by multiple lines of code, which I don't want to shove into a separate function.)

Python.exe has stopped working

2015-06-02 Thread Alexis Dubois
Hello ! I have this kind of message every time I quit my PyQt4 app whatever the method to quit is: a quit action menu, the windows "red cross", by quit(), close(), destroy(), deletelater(), ... "python.exe has stopped working" ->Check online for a solution ->Close the program I need to specify

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Marko Rauhamaa
BartC : > If you define 'object' in a certain way (eg. as boxed, tagged data), > then it follows that some values don't need to be objects. The word "object" really barely carries any meaning -- that's the point. It's a Latin-based synonym of the Germanic "thing." To say that everything is an ob

Re: Parser needed.

2015-06-02 Thread Grant Edwards
On 2015-06-02, Skybuck Flying wrote: > > { > > >{ > >} > } IOW, it's almost, but not quite, JSON. -- Grant Edwards grant.b.edwardsYow! My vaseline is at RUNNING... gmai

Re: for...else

2015-06-02 Thread Jean-Michel Pichavant
- Original Message - > From: "acdr" > To: "Jean-Michel Pichavant" > Cc: python-list@python.org > Sent: Tuesday, 2 June, 2015 2:52:21 PM > Subject: Re: for...else > > That would work for my example, but it would only really work if all > the calculations are in a nice function. You cann

Re: fork/exec & close file descriptors

2015-06-02 Thread Skip Montanaro
Reviving (and concluding) a thread I started a couple weeks ago, I asked: > The basic fork/exec dance is not a problem, but how do I discover > all the open file descriptors in the new child process to make sure > they get closed? Do I simply start at fd 3 and call os.close() on > everything up to

Re: for...else

2015-06-02 Thread acdr
The first solution in your e-mail (with a Cleanup exception) is definitely very close, functionally, to what I want to accomplish. In effect, it's the same structure as my original suggestion of "for...then...else", except now it'd be "try: for...else...except". That's workable. I can even cheat an

Re: Framework / CMS for Banking

2015-06-02 Thread Laura Creighton
In a message of Tue, 02 Jun 2015 05:41:31 -0700, Swapnil Bhadade writes: > I am want to know which are the best CMS / framework for building web banking > / Financial / lending services >Best >-- >https://mail.python.org/mailman/listinfo/python-list See this video. https://ep2013.europython

Re: Python.exe has stopped working

2015-06-02 Thread Laura Creighton
In a message of Tue, 02 Jun 2015 06:09:34 -0700, Alexis Dubois writes: >Hello ! > >I have this kind of message every time I quit my PyQt4 app whatever the method >to quit is: a quit action menu, the windows "red cross", by quit(), close(), >destroy(), deletelater(), ... > >"python.exe has stopped

Re: How to access the low digits of a list

2015-06-02 Thread Ian Kelly
On Tue, Jun 2, 2015 at 6:35 AM, Rustom Mody wrote: > For that matter even this works > But I am not sure whats happening or that I like it > [x[-2:] for x in lines] > ['12', '42', '49', '56', '25', '36', '49', '64', '81', '00'] x[-2:] selects all items in the sequence with index i such that

Re: for...else

2015-06-02 Thread Laura Creighton
You may be looking for dictionary dispatching. You can translate the key into a callable. def do_ping(self, arg): return 'Ping, {0}!'.format(arg) def do_pong(self, arg): return 'Pong, {0}!'.format(arg) dispatch = { 'ping': do_ping, 'pong': do_pong } and then at some poi

Re: Python.exe has stopped working

2015-06-02 Thread Alexis Dubois
On Tuesday, June 2, 2015 at 4:13:27 PM UTC+2, Laura Creighton wrote: > In a message of Tue, 02 Jun 2015 06:09:34 -0700, Alexis Dubois writes: > >Hello ! > > > >I have this kind of message every time I quit my PyQt4 app whatever the > >method to quit is: a quit action menu, the windows "red cross",

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Steven D'Aprano
On Tue, 2 Jun 2015 09:40 pm, Rustom Mody wrote: > On Tuesday, June 2, 2015 at 4:57:31 PM UTC+5:30, Steven D'Aprano wrote: >> On Tue, 2 Jun 2015 08:36 pm, Eddilbert Macharia wrote: [...] >> > *** The instance of class type is a data type an instance of class >> > type. right ? >> type(type) >>

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Ian Kelly
On Mon, Jun 1, 2015 at 4:59 PM, BartC wrote: > I'm developing a new language along the lines of Python, perhaps a brief > description of how things are done there might help. Or just give a > different perspective. > > Objects in this language are tagged: there's a code attached to each > indicati

Re: How to access the low digits of a list

2015-06-02 Thread Steven D'Aprano
On Tue, 2 Jun 2015 10:23 pm, fl wrote: > I don't know whether there is a way to know the length of lines[3]. The same way as to know the length of anything else: len(x) # the length of x len("hello") # the length of "hello" len(lines[3]) # the length of lines[3] > Then, > I can use a -1 ste

Re: for...else

2015-06-02 Thread Jean-Michel Pichavant
- Original Message - > From: "acdr" > To: "Jean-Michel Pichavant" > Cc: python-list@python.org > Sent: Tuesday, 2 June, 2015 4:00:12 PM > Subject: Re: for...else > > The first solution in your e-mail (with a Cleanup exception) is > definitely very close, functionally, to what I want to a

Re: fork/exec & close file descriptors

2015-06-02 Thread Marko Rauhamaa
Skip Montanaro : > os.closerange(fd_low, fd_high) > Close all file descriptors from fd_low (inclusive) to fd_high > (exclusive), ignoring errors. > > Guido's time machine strikes again... The only problem is that you don't know how high you need to go in general. Marko -- https://m

Re: fork/exec & close file descriptors

2015-06-02 Thread Skip Montanaro
On Tue, Jun 2, 2015 at 10:28 AM, Marko Rauhamaa wrote: > > The only problem is that you don't know how high you need to go in > general. Sure, but I didn't know anyway, so no matter what upper bound I choose (or what function I choose/implement), it's just going to be a guess. os.closerange just

Re: Framework / CMS for Banking

2015-06-02 Thread Swapnil
Respected: Thanks. Would you mind if , i ask you more detail Q’s on the framework. If not then any resources where i can i ask more Q’s ? Best Dr. Swapnil Bhadade M.B.B.S M.S Yindu (India) swapnilrbhadad...@gmail.com. ……….. Please a

Re: fork/exec & close file descriptors

2015-06-02 Thread Alain Ketterlin
Skip Montanaro writes: > Reviving (and concluding) a thread I started a couple weeks ago, I asked: > >> The basic fork/exec dance is not a problem, but how do I discover >> all the open file descriptors in the new child process to make sure >> they get closed? Do I simply start at fd 3 and call o

Re: Framework / CMS for Banking

2015-06-02 Thread Laura Creighton
In a message of Tue, 02 Jun 2015 21:09:48 +0530, Swapnil writes: > > >Respected: Thanks. Would you mind if , i ask you more detail Q’s on the >framework. If not then any resources where i can i ask more Q’s ? > >Best >Dr. Swapnil Bhadade You can ask more questions here. I just remembered that th

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 8:38:42 PM UTC+5:30, Steven D'Aprano wrote: > On Tue, 2 Jun 2015 09:40 pm, Rustom Mody wrote: > > > On Tuesday, June 2, 2015 at 4:57:31 PM UTC+5:30, Steven D'Aprano wrote: > >> On Tue, 2 Jun 2015 08:36 pm, Eddilbert Macharia wrote: > [...] > >> > *** The instance of cla

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Terry Reedy
On 6/2/2015 6:36 AM, Eddilbert Macharia wrote: you guys are just confusing me, you are going in loops, Ignore the troll who is trying to confuse you by slandering the rest of us. I have been using python for 18 years, I believe. Current Python has a loop at the core >>> isinstance(type, o

Re: fork/exec & close file descriptors

2015-06-02 Thread Marko Rauhamaa
Skip Montanaro : > On Tue, Jun 2, 2015 at 10:28 AM, Marko Rauhamaa wrote: >> >> The only problem is that you don't know how high you need to go in >> general. > > Sure, but I didn't know anyway, so no matter what upper bound I choose > (or what function I choose/implement), it's just going to be

Re: fork/exec & close file descriptors

2015-06-02 Thread Jon Ribbens
On 2015-06-02, Marko Rauhamaa wrote: > Skip Montanaro : > >> On Tue, Jun 2, 2015 at 10:28 AM, Marko Rauhamaa wrote: >>> >>> The only problem is that you don't know how high you need to go in >>> general. >> >> Sure, but I didn't know anyway, so no matter what upper bound I choose >> (or what func

Re: Parser needed.

2015-06-02 Thread MRAB
On 2015-06-02 05:45, Skybuck Flying wrote: Example for python: MyString = "Hello World" print MyString.rfind("World") if MyString.rfind("World"): print "yes" else: print "no" Pretty cool. .rfind returns the index if found, -1 if not found. "World".rfind("World") returns 0, which will be tre

Find in ipython3

2015-06-02 Thread Cecil Westerhof
I am thinking about using ipython3 instead of bash. When I want to find a file I can do the following: !find ~ -iname '*python*.pdf' but is there a python way? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/l

Re: What use of string module?

2015-06-02 Thread Tim Chase
On 2015-06-02 04:37, Mark Lawrence wrote: > > I read the online help about string. It lists string constants, > > string formatting, template strings and string functions. After > > reading these, I am still puzzled about how to use the string > > module. > > I suggest you don't bother, it's effec

Re: should "self" be changed?

2015-06-02 Thread Steven D'Aprano
On Fri, 29 May 2015 12:00 pm, Steven D'Aprano wrote: [...] > in a language where classes are > themselves values, there is no reason why a class must be instantiated, > particularly if you're only using a single instance of the class. Anyone > ever come across a named design pattern that involves

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Steven D'Aprano
On Tue, 2 Jun 2015 10:49 pm, BartC wrote: > On 02/06/2015 12:27, Steven D'Aprano wrote: > >> "Object" has a general meaning in computer science and programming, it is >> a compound data structure that is explicitly linked to a type which >> provides functionality that operates on that data struct

Re: Parser needed.

2015-06-02 Thread Skybuck Flying
"MRAB" wrote in message news:mailman.71.1433263397.13271.python-l...@python.org... On 2015-06-02 05:45, Skybuck Flying wrote: Example for python: MyString = "Hello World" print MyString.rfind("World") if MyString.rfind("World"): print "yes" else: print "no" Pretty cool. " .rfind retur

Re: should "self" be changed?

2015-06-02 Thread Marko Rauhamaa
Steven D'Aprano : > On Fri, 29 May 2015 12:00 pm, Steven D'Aprano wrote: > > [...] >> in a language where classes are >> themselves values, there is no reason why a class must be instantiated, >> particularly if you're only using a single instance of the class. Anyone >> ever come across a named

Re: for...else

2015-06-02 Thread ast
"Laura Creighton" a écrit dans le message de news:mailman.64.1433255400.13271.python-l...@python.org... You may be looking for dictionary dispatching. You can translate the key into a callable. def do_ping(self, arg): return 'Ping, {0}!'.format(arg) def do_pong(self, arg): return 'Pon

Re: Everything is an object in python - object class and type class

2015-06-02 Thread BartC
On 02/06/2015 18:00, Steven D'Aprano wrote: On Tue, 2 Jun 2015 10:49 pm, BartC wrote: On 02/06/2015 12:27, Steven D'Aprano wrote: In the programming language Java, *some* values are objects, and some values are not objects. In the programming language Python, *all* values are objects, in th

Re: Everything is an object in python - object class and type class

2015-06-02 Thread random832
On Tue, Jun 2, 2015, at 13:59, BartC wrote: > On 02/06/2015 18:00, Steven D'Aprano wrote: > > Again, this is not relevant. Javascript is dynamically typed, but some > > values are machine primitives and other values are objects. The interpreter > > keeps track of this at runtime. > > Javascript

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Jon Ribbens
On 2015-06-02, BartC wrote: > On 02/06/2015 18:00, Steven D'Aprano wrote: >> Again, this is not relevant. Javascript is dynamically typed, but some >> values are machine primitives and other values are objects. The interpreter >> keeps track of this at runtime. > > Javascript primitives include Nu

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Ned Batchelder
On Tuesday, June 2, 2015 at 1:59:37 PM UTC-4, BartC wrote: > On 02/06/2015 18:00, Steven D'Aprano wrote: > > On Tue, 2 Jun 2015 10:49 pm, BartC wrote: > > > >> On 02/06/2015 12:27, Steven D'Aprano wrote: > > >>> In the programming language Java, *some* values are objects, and some > >>> values are

Re: for...else

2015-06-02 Thread Laura Creighton
In a message of Tue, 02 Jun 2015 19:46:54 +0200, "ast" writes: > > >"Laura Creighton" a écrit dans le message de >news:mailman.64.1433255400.13271.python-l...@python.org... >> You may be looking for dictionary dispatching. >> >> You can translate the key into a callable. >> >> def do_ping(self, a

Could you explain lambda function to me?

2015-06-02 Thread fl
Hi, I see the description of lambda at the online tutorial, but I cannot understand it. '42' is transferred to the function. What 'x' value should be? I do not see it says that it is '0'. And, what is 'x'? >>> def make_incrementor(n): ... return lambda x: x + n ... >>> f = make_increm

Re: Could you explain lambda function to me?

2015-06-02 Thread Chris Kaynor
On Tue, Jun 2, 2015 at 11:14 AM, fl wrote: > Hi, > > I see the description of lambda at the online tutorial, but I cannot > understand it. '42' is transferred to the function. What 'x' value should > be? I do not see it says that it is '0'. And, what is 'x'? > The lambda keyword is merely anothe

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Jon Ribbens
On 2015-06-02, Dr. Bigcock wrote: > It doesn't really do anything. No one uses integers as objects. > (Any dissenters?) Yes. *Everyone* uses integers as objects. Containers such as lists and dictionaries and tuples etc contain objects. If integers weren't objects then you wouldn't be able to put

Re: Could you explain lambda function to me?

2015-06-02 Thread ast
"fl" a écrit dans le message de news:323866d1-b117-4785-ae24-7d04c49bc...@googlegroups.com... Hi, def make_incrementor(n): ... return lambda x: x + n ... f = make_incrementor(42) f(0) 42 f(1) 43 make_incrementor is a fonction which return a function ! and the returned function jus

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Ian Kelly
On Tue, Jun 2, 2015 at 12:10 PM, Ned Batchelder wrote: > On Tuesday, June 2, 2015 at 1:59:37 PM UTC-4, BartC wrote: >> Javascript primitives include Number and String. >> >> What does Python allow to be done with its Number (int, etc) and String >> types that can't be done with their Javascript co

Re: fork/exec & close file descriptors

2015-06-02 Thread Marko Rauhamaa
Alain Ketterlin : > The close(2) manpage has the following warning on my Linux system: > > | Not checking the return value of close() is a common but > | nevertheless serious programming error. It is quite possible that > | errors on a previous write(2) operation are first reported at the > | fina

Please help on this sorted function

2015-06-02 Thread fl
Hi, I try to learn sorted(). With the tutorial example: >>> ff=sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'}) >>> ff [1, 2, 3, 4, 5] I don't see what sorted does in this dictionary, i.e. the sequence of 1..5 is unchanged. Could you explain it to me? Thanks, -- https://mail.python.org/

Re: Please help on this sorted function

2015-06-02 Thread fl
On Tuesday, June 2, 2015 at 1:20:40 PM UTC-7, fl wrote: > Hi, > > I try to learn sorted(). With the tutorial example: > > > > > >>> ff=sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'}) > >>> ff > [1, 2, 3, 4, 5] > > > > I don't see what sorted does in this dictionary, i.e. the sequence of >

Re: Please help on this sorted function

2015-06-02 Thread Joonas Liik
>>> ff=sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'}) >>> ff [1, 2, 3, 4, 5] sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'}) is equivalent to sorted(iter({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})) and iter(dict) iterates over the dict keys, so when you do iter({1: 'D', 2: 'B', 3: 'B', 4: 'E',

Re: Please help on this sorted function

2015-06-02 Thread Joonas Liik
my_dict = {1: 'D', 2: 'B', 3: 'A', 4: 'E', 5: 'B'} # dict.items() returns an iterator that returns pairs of (key, value) pairs # the key argument to sorted tells sorted what to sort by, operator.itemgetter is a factory function , itemgetter(1)== lambda iterable: iterable[1] sorted_dict = sorted(my

Re: fork/exec & close file descriptors

2015-06-02 Thread Alain Ketterlin
Marko Rauhamaa writes: > Alain Ketterlin : > >> The close(2) manpage has the following warning on my Linux system: >> >> | Not checking the return value of close() is a common but >> | nevertheless serious programming error. It is quite possible that >> | errors on a previous write(2) operation a

Re: Where is 'palindrome' defined?

2015-06-02 Thread John Ladasky
On Monday, June 1, 2015 at 2:22:02 AM UTC-7, Marko Rauhamaa wrote: > Sota-apina nakataan raastimeen. > Apelle pane emit. > Saarnaa takanani paatos. > > (= "The war monkey will be chucked into a grater. > Hand the pistils to father-in-law. > Pathos does prea

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Grant Edwards
On 2015-06-02, Ian Kelly wrote: >>> Sorry. I meant "object" in the sense of OOP: something you might >>> extend or make a derived class with. >> >> I'm not sure you get to define which properties of objects you want >> not to count. > > Accepting for the sake of argument that "something to be s

Can Python function return multiple data?

2015-06-02 Thread fl
Hi, I just see the tutorial says Python can return value in function, it does not say multiple data results return situation. In C, it is possible. How about Python on a multiple data return requirement? Thanks, -- https://mail.python.org/mailman/listinfo/python-list

What is the difference between list() and list?

2015-06-02 Thread fl
Hi, I find the following results are interesting, but I don't know the difference between list() and list. >>> nums=list() >>> nums [] >>> xx=list >>> xx >>> nums [] >>> print(xx) >>> print(nums) [] >>> Could you tell me that? Thanks, -- https://mail.python.org/mailman/listinfo/pytho

Re: Can Python function return multiple data?

2015-06-02 Thread Joel Goldstick
On Tue, Jun 2, 2015 at 5:27 PM, fl wrote: > Hi, > > I just see the tutorial says Python can return value in function, it does > not say multiple data results return situation. In C, it is possible. > How about Python on a multiple data return requirement? > > > Thanks, > -- > https://mail.python.o

Re: What is the difference between list() and list?

2015-06-02 Thread Joel Goldstick
On Tue, Jun 2, 2015 at 5:33 PM, fl wrote: > Hi, > > I find the following results are interesting, but I don't know the difference > between list() and list. > > > > > > nums=list() nums > [] xx=list xx > nums > [] print(xx) > print(nums) > [] > > > > Could

Re: Can Python function return multiple data?

2015-06-02 Thread John Gordon
In <3bbe49da-e989-4a8c-a8a9-75d3a786f...@googlegroups.com> fl writes: > Hi, > I just see the tutorial says Python can return value in function, it does > not say multiple data results return situation. In C, it is possible. > How about Python on a multiple data return requirement? Python func

Re: Can Python function return multiple data?

2015-06-02 Thread sohcahtoa82
On Tuesday, June 2, 2015 at 2:27:37 PM UTC-7, fl wrote: > Hi, > > I just see the tutorial says Python can return value in function, it does > not say multiple data results return situation. In C, it is possible. > How about Python on a multiple data return requirement? > > > Thanks, You return

Re: What is the difference between list() and list?

2015-06-02 Thread John Gordon
In <3ada3275-68c9-421c-aa19-53c312c42...@googlegroups.com> fl writes: > I find the following results are interesting, but I don't know the difference > between list() and list. 'list()' invokes the list class, which creates and returns a new list. Since you haven't passed any arguments, the lis

Re: fork/exec & close file descriptors

2015-06-02 Thread Marko Rauhamaa
Alain Ketterlin : > Marko Rauhamaa writes: >> First, if close() fails, what's a poor program to do? > > Warn the user? Not assume everything went well? It all depends on the > application, and what the file descriptor represents. The problem here is in the system call contract, which is broken.

Re: Where is 'palindrome' defined?

2015-06-02 Thread Marko Rauhamaa
John Ladasky : > On Monday, June 1, 2015 at 2:22:02 AM UTC-7, Marko Rauhamaa wrote: > >> Sota-apina nakataan raastimeen. >> Apelle pane emit. >> Saarnaa takanani paatos. >> >> (= "The war monkey will be chucked into a grater. >> Hand the pistils to father-in-law. >

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Marko Rauhamaa
Grant Edwards : > On 2015-06-02, Ian Kelly wrote: >> Accepting for the sake of argument that "something to be subclassed" >> is a reasonable definition of object, > > Huh? You can't subclass an object. You can subclass a Class. More to the point: you don't need classes for objects -- even in t

Re: fork/exec & close file descriptors

2015-06-02 Thread Chris Angelico
On Wed, Jun 3, 2015 at 7:06 AM, Alain Ketterlin wrote: > I've no idea what the OP's program was doing, so I'm not going to split > hairs. I can't imagine why one would like to mass-close an arbitrary set > of file descriptors, and I think APIs like os.closerange() are toxic and > an appeal to slop

Re: Can Python function return multiple data?

2015-06-02 Thread Chris Angelico
On Wed, Jun 3, 2015 at 7:27 AM, fl wrote: > I just see the tutorial says Python can return value in function, it does > not say multiple data results return situation. In C, it is possible. > How about Python on a multiple data return requirement? Technically, neither C nor Python can return mult

Re: Please help on this sorted function

2015-06-02 Thread Chris Angelico
On Wed, Jun 3, 2015 at 6:25 AM, fl wrote: > I am still new to Python. How to get the sorted dictionary output: > > {1: 'D', 2: 'B', 3: 'A', 4: 'E', 5: 'B'} Since dictionaries don't actually have any sort of order to them, the best thing to do is usually to simply display it in order. And there's

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Ian Kelly
On Tue, Jun 2, 2015 at 3:47 PM, Mark Lawrence wrote: > The classic response to "Super Considered Harmful" for those who may be > interested is > https://rhettinger.wordpress.com/2011/05/26/super-considered-super/ and > recently https://www.youtube.com/watch?v=EiOglTERPEo I feel slightly cheated.

Re: fork/exec & close file descriptors

2015-06-02 Thread Skip Montanaro
Folks, I'm not interested in rehashing this. I don't know what all the open file descriptors are. Some/many/most will have been opened by underlying C++ libraries and will not have been opened by code at the Python level. I do think the addition of an os.fsync() attempt on each file descriptor befo

Re: should "self" be changed?

2015-06-02 Thread Ian Kelly
On Tue, Jun 2, 2015 at 11:19 AM, Marko Rauhamaa wrote: > Steven D'Aprano : > >> On Fri, 29 May 2015 12:00 pm, Steven D'Aprano wrote: >> >> [...] >>> in a language where classes are >>> themselves values, there is no reason why a class must be instantiated, >>> particularly if you're only using a s

Issuing commands using "exec_command()" of paramiko AND also sending commands together

2015-06-02 Thread Pythonista
Using paramiko's exec_command(), i would like to send a command, process its output and do it for several other commands. I notice that its not quick enough or something like that. How would I handle that scenario AND also providing multiple commands together (there is 1 post on stackoverflow f

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Eddilbert Macharia
On Tuesday, June 2, 2015 at 2:27:31 PM UTC+3, Steven D'Aprano wrote: > On Tue, 2 Jun 2015 08:36 pm, Eddilbert Macharia wrote: > > > you guys are just confusing me, you are going in loops, and still i have > > understood ,what makes everything in python an object. hey is where i'm at > > : *** type

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Mark Lawrence
On 03/06/2015 05:16, Eddilbert Macharia wrote: Sadly yes i have worked with java, and that is what is causing me so much grief.In java objects are instance of a class.pretty simple. You might like to read http://dirtsimple.org/2004/12/python-is-not-java.html and http://dirtsimple.org/2004/

  1   2   >