Re: [Tutor] In matplotlib, why are there axes classes vs. axes API? Why not list them under one documentation?

2018-06-19 Thread Hilton Fernandes
Dear all,

while MatPlotLib can have a myriad of options -- and that can be really
confusing --, there is sample code for almost everything in their site.

So, I had a great time playing with it.

And from what I remember from visiting their site, there are two versions
of many of the resources: one deriived from the Matlab API for plotting --
hence the name --, and one more Pythonic.

So, I believe that the good people developing MatPlotLib is already taking
care of the clumsiness of the original form of the library, and rephrasing
it in good programming style.

All the best,
Hilton


On Sat, Jun 16, 2018 at 11:20 PM, C W  wrote:

> I have found the matplotlib list.
>
> Cheers!
>
> On Sat, Jun 16, 2018 at 7:13 PM, Alan Gauld via Tutor 
> wrote:
>
> > On 16/06/18 05:49, Mike C wrote:
> > > I can only compare to the R language I've used. If there is an issue,
> > > say a function freezes at startup, one user brings it up to the list,>
> > when the respective maintainer sees the bug, it is usually addressed
> >
> > Which is fine if there is a team working onthe project full time
> >  - as there would be on a commercial project - perhaps by sponsorship.
> > But many(most?) open source projects are not sponsored., they are
> > a small (often just one or two) individuals working in their spare
> > time.
> >
> > > In terms of funding. Isn't Python heavily used in industry,
> >
> > Yes and several companies sponsor development of the core
> > python language. As such major issues tend to be addressed rapidly.
> > But... matplotlib is not part of that core language.
> >
> > It is a part of ScyPy which is not used by such large
> > numbers of industrial companies (and is more directly
> > of interest to researchers and academics rather than
> > commercial developers - a group best known for lack of
> > funds!) and as such is less likely to be responsive,
> > especially when the issues are not bugs or functionality
> > affecting - they are just usability irritations.
> >
> >
> > --
> > Alan G
> > Author of the Learn to Program web site
> > http://www.alan-g.me.uk/
> > http://www.amazon.com/author/alan_gauld
> > Follow my photo-blog on Flickr at:
> > http://www.flickr.com/photos/alangauldphotos
> >
> >
> > ___
> > Tutor maillist  -  Tutor@python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
> >
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What's the difference between calling a method with parenthesis vs. without it?

2018-06-19 Thread Steven D'Aprano
On Tue, Jun 19, 2018 at 11:52:08AM -0400, C W wrote:

> Thank you all. I'm relatively new to OOP, I think that's where the problem
> is. It's different from C or any C alike language.

Apart from C-like languages like C++, Objective C, C# and others with 
objects :-)

Actually in this specific instance, what seems to be tripping you up is 
not the *object oriented* flavour of the code, but the *functional 
programming* flavour of the code, specifically that functions are values 
at all. (Whether they are "objects" or not is not very important.)

https://en.wikipedia.org/wiki/Functional_programming

In this case, it isn't *much* functional programming. It is just the 
idea that functions are values, just like strings and lists and floats.


-- 
Steve
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What's the difference between calling a method with parenthesis vs. without it?

2018-06-19 Thread C W
Thank you all. I'm relatively new to OOP, I think that's where the problem
is. It's different from C or any C alike language.

I'm still figuring out what's under the hood with OOP.

Thanks!

On Mon, Jun 18, 2018 at 8:26 PM, Steven D'Aprano 
wrote:

> On Mon, Jun 18, 2018 at 08:50:24AM -0600, Mats Wichmann wrote:
>
> > Python is not like certain other languages.
>
> But it is like *other* certain other languages.
>
> :-)
>
> Python's execution model is different from C, Pascal or Fortran, but it
> is quite similar to Ruby, Lua and Javascript.
>
>
>
> --
> Steve
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What's the difference between calling a method with parenthesis vs. without it?

2018-06-19 Thread Alan Gauld via Tutor
On 19/06/18 16:52, C W wrote:
> Thank you all. I'm relatively new to OOP, I think that's where the problem
> is. It's different from C or any C alike language.

True, but even in C you can have pointers to functions
which work in a similar fashion.

> I'm still figuring out what's under the hood with OOP.

This particular feature has nothing to do with OOP,
it happens at the procedural level too.
Consider:

>>> aVar = 42
>>> aVar
42
>>> aVar()
Traceback (most recent call last):
  File "", line 1, in 
aVar()
TypeError: 'int' object is not callable
>>> def aFunc(): return 66

>>> aFunc()
66
>>> aFunc

>>>

So using parens to access a variable yields an error,.
Using parens on a function is fine
Not using parens on a variable returns the value
Not using parens on a function returns the function

And finally:

>>> anotherVar = aFunc
>>> anotherVar

>>> anotherVar()
66
>>>

We make a variable reference a function.
Now the variable acts just like the function it
references.

That's because variables in Python are just names
that reference a value and the variable "acts" like
whatever kind of value it references.

But it has nothing to do with OOP. It is much
more fundamental than that.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor