super or not super?

2019-07-12 Thread Paulo da Silva
Hi all!

Is there any difference between using the base class name or super to
call __init__ from base class?

class C1:
def __init__(self):
...

class C2(C1):
def __init__(self):
C1.__init__(self) or super().__init__() ??
...

I have been using super, but I see some scripts where the base class
name is used.

Thanks for any comments.
-- 
https://mail.python.org/mailman/listinfo/python-list


Books for Python 3.7

2019-07-12 Thread mok888
Can anyone help me.
New to Python.
Installed version 3.7
I purchased the "Python for Dummies" book But this book was written for an 
older version of Python.
All the examples and samples don't work with version 3.7
Can anyone direct me to which is the latest book to buy to properly learn 
Python.
Thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Books for Python 3.7

2019-07-12 Thread sjmsoft
On Friday, July 12, 2019 at 11:37:08 AM UTC-3, [email protected] wrote:
> Can anyone help me.
> New to Python.
> Installed version 3.7
> I purchased the "Python for Dummies" book But this book was written for an 
> older version of Python.
> All the examples and samples don't work with version 3.7
> Can anyone direct me to which is the latest book to buy to properly learn 
> Python.
> Thanks

You don't say what Python release your book covers, but the first thing to know 
is that Python 3 has many incompatibilities with Python 2.  I don't think any 
book that covers Python 2 is useful for a new Python programmer using Python 3.

You also don't say whether you're a beginning programmer or a veteran wanting 
to learn a new language.  This might affect your book choice, as some are 
directed more toward beginning programmers.

One good choice is Dive Into Python, available for free on-line (google "dive 
into python 3").  I'm sure other folks could suggest additional suitable Python 
3 books.

HTH,
  Steve J. Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: super or not super?

2019-07-12 Thread Rhodri James

On 12/07/2019 15:12, Paulo da Silva wrote:

Hi all!

Is there any difference between using the base class name or super to
call __init__ from base class?

class C1:
def __init__(self):
...

class C2(C1):
def __init__(self):
C1.__init__(self) or super().__init__() ??
...

I have been using super, but I see some scripts where the base class
name is used.


For a simple single inheritance case like this there isn't any 
difference, but using super() a good habit to get into.  Mostly it makes 
code maintenance easier: if you suddenly decide to change your base 
class to C3 (say for debug purposes), you only have to change one line:


class C3:
def __init__(self):
...

class C2(C3):
def __init__(self):
super().__init__()

Using the base class by name can lead to errors like this:

class C2(C3):
def __init__(self):
C1.__init__(self)  # Whoops, forgot this one

super() also has major advantages if you are stuck with multiple 
inheritance.  Raymond Hettinger has an excellent article on this here:

https://rhettinger.wordpress.com/2011/05/26/super-considered-super/

--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


Re: Books for Python 3.7

2019-07-12 Thread Richard Mok
On Friday, July 12, 2019 at 11:04:57 AM UTC-4, [email protected] wrote:
> On Friday, July 12, 2019 at 11:37:08 AM UTC-3, [email protected] wrote:
> > Can anyone help me.
> > New to Python.
> > Installed version 3.7
> > I purchased the "Python for Dummies" book But this book was written for an 
> > older version of Python.
> > All the examples and samples don't work with version 3.7
> > Can anyone direct me to which is the latest book to buy to properly learn 
> > Python.
> > Thanks
> 
> You don't say what Python release your book covers, but the first thing to 
> know is that Python 3 has many incompatibilities with Python 2.  I don't 
> think any book that covers Python 2 is useful for a new Python programmer 
> using Python 3.
> 
> You also don't say whether you're a beginning programmer or a veteran wanting 
> to learn a new language.  This might affect your book choice, as some are 
> directed more toward beginning programmers.
> 
> One good choice is Dive Into Python, available for free on-line (google "dive 
> into python 3").  I'm sure other folks could suggest additional suitable 
> Python 3 books.
> 
> HTH,
>   Steve J. Martin

Hi Steve

Thanks for the super fast response.
It does not mention on the book which version of Python it is using.
I assume it is for 2.7
Its written by Stef and Aahz Maruch

I am a seasoned programmer but only on main frames computer using RPG, Cobol 
etc.
I have no experience programming on a PC at all.
That's why I bought the Dummies book, so that I can start from the very 
beginning.

Will check out the Dive Into Python.

Thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Books for Python 3.7

2019-07-12 Thread Terry Reedy

On 7/12/2019 11:27 AM, Richard Mok wrote:


It does not mention on the book which version of Python it is using.


That would likely mean 2.x.  Easy way to tell:
2.x has 'print x' statements.  3.x has 'print(x)' function calles.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: super or not super?

2019-07-12 Thread Thomas Jollans
On 12/07/2019 16.12, Paulo da Silva wrote:
> Hi all!
>
> Is there any difference between using the base class name or super to
> call __init__ from base class?

There is, when multiple inheritance is involved. super() can call
different 'branches' of the inheritance tree if necessary.


Let me demonstrate:


class A1:
    def __init__(self):
    super().__init__()
    print('A1 called')

class B1(A1):
    def __init__(self):
    super().__init__()
    print('B1 called')

class C1(A1):
    def __init__(self):
    super().__init__()
    print('C1 called')

class D1(B1,C1):
    def __init__(self):
    super().__init__()
    print('D1 called')


class A2:
    def __init__(self):
    object.__init__(self)
    print('A2 called')

class B2(A2):
    def __init__(self):
    A2.__init__(self)
    print('B2 called')

class C2(A2):
    def __init__(self):
    A2.__init__(self)
    print('C2 called')

class D2(B2,C2):
    def __init__(self):
    super().__init__()
    print('D2 called')

if __name__ == '__main__':
    D1()
    print('---')
    D2()


##


% python3 super_demo.py
A1 called
C1 called
B1 called
D1 called
---
A2 called
B2 called
D2 called


>
> class C1:
>   def __init__(self):
>   ...
>
> class C2(C1):
>   def __init__(self):
>   C1.__init__(self) or super().__init__() ??
>   ...
>
> I have been using super, but I see some scripts where the base class
> name is used.

Just use super(), especially in __init__.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Books for Python 3.7

2019-07-12 Thread MRAB

On 2019-07-12 16:40, Terry Reedy wrote:

On 7/12/2019 11:27 AM, Richard Mok wrote:


It does not mention on the book which version of Python it is using.


That would likely mean 2.x.  Easy way to tell:
2.x has 'print x' statements.  3.x has 'print(x)' function calles.

I had a brief look online and saw a preview. It was written in 2006 and 
Appendix B stops at Python 2.5. A lot has happened since then!

--
https://mail.python.org/mailman/listinfo/python-list


Re: Books for Python 3.7

2019-07-12 Thread RIchy M
On Friday, July 12, 2019 at 1:00:01 PM UTC-4, MRAB wrote:
> On 2019-07-12 16:40, Terry Reedy wrote:
> > On 7/12/2019 11:27 AM, Richard Mok wrote:
> > 
> >> It does not mention on the book which version of Python it is using.
> > 
> > That would likely mean 2.x.  Easy way to tell:
> > 2.x has 'print x' statements.  3.x has 'print(x)' function calles.
> > 
> I had a brief look online and saw a preview. It was written in 2006 and 
> Appendix B stops at Python 2.5. A lot has happened since then!

I already stopped studying from this book.
Now just reading the 3.7 tutorial that came with the install.
But I am a beginner...
Finding it tough to learn like that.
I need like a beginners guide to Python 3.7 sort of book.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Books for Python 3.7

2019-07-12 Thread Andrew Z
Richy,
 What specific part you consider hard?
If i may suggest,  get a (pet) project as you read it.

On Fri, Jul 12, 2019, 13:46 RIchy M  wrote:

> On Friday, July 12, 2019 at 1:00:01 PM UTC-4, MRAB wrote:
> > On 2019-07-12 16:40, Terry Reedy wrote:
> > > On 7/12/2019 11:27 AM, Richard Mok wrote:
> > >
> > >> It does not mention on the book which version of Python it is using.
> > >
> > > That would likely mean 2.x.  Easy way to tell:
> > > 2.x has 'print x' statements.  3.x has 'print(x)' function calles.
> > >
> > I had a brief look online and saw a preview. It was written in 2006 and
> > Appendix B stops at Python 2.5. A lot has happened since then!
>
> I already stopped studying from this book.
> Now just reading the 3.7 tutorial that came with the install.
> But I am a beginner...
> Finding it tough to learn like that.
> I need like a beginners guide to Python 3.7 sort of book.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Books for Python 3.7

2019-07-12 Thread RIchy M
On Friday, July 12, 2019 at 2:45:48 PM UTC-4, Andrew Z wrote:
> Richy,
>  What specific part you consider hard?
> If i may suggest,  get a (pet) project as you read it.
> 
> On Fri, Jul 12, 2019, 13:46 RIchy M  wrote:
> 
> > On Friday, July 12, 2019 at 1:00:01 PM UTC-4, MRAB wrote:
> > > On 2019-07-12 16:40, Terry Reedy wrote:
> > > > On 7/12/2019 11:27 AM, Richard Mok wrote:
> > > >
> > > >> It does not mention on the book which version of Python it is using.
> > > >
> > > > That would likely mean 2.x.  Easy way to tell:
> > > > 2.x has 'print x' statements.  3.x has 'print(x)' function calles.
> > > >
> > > I had a brief look online and saw a preview. It was written in 2006 and
> > > Appendix B stops at Python 2.5. A lot has happened since then!
> >
> > I already stopped studying from this book.
> > Now just reading the 3.7 tutorial that came with the install.
> > But I am a beginner...
> > Finding it tough to learn like that.
> > I need like a beginners guide to Python 3.7 sort of book.
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >

Hi Andrew

I feel that that guide is written for people who already have some basic 
knowledge of Python.
I am on the beginners level only.

What is a (pet) project?
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: Wing Python IDE 7.0.4 Released

2019-07-12 Thread Wingware
Wing Python IDE 7.0.4 has been released. Some of the highlights of this 
release include:


Fix debugging notebooks with newer Jupyter versions
Fix setting up a Django project with the default Python Executable
Don't lose retained Debug I/O buffers after 60 seconds
Avoid several incorrect code warnings
Fix refactoring or finding points of use in code that has type hints
Fix Move Program Counter in remote files
Fix remote searching and Find Uses to include files that are not 
open in the editor
Avoid displaying spurious Disk File is Newer dialogs when saving 
remote files

Fix comparing two directories
Avoid hanging up in file comparisons with large difference blocks
Fix several problems in the extension scripting API
Fix many other bugs

You can obtain this release with Check for Updates in Wing 7's Help menu 
or download it now:


https://wingware.com/downloads

**New in Wing 7**

Wing 7 introduces an improved code warnings and code quality inspection 
system that includes built-in error detection and tight integration with 
Pylint, pep8, and mypy. This release also adds a new data frame and 
array viewer, a MATLAB keyboard personality, easy inline debug data 
display with Shift-Space, improved stack data display, support for PEP 
3134 chained exceptions, callouts for search and other code navigation 
features, four new color palettes, improved bookmarking, a high-level 
configuration menu, magnified presentation mode, a new update manager, 
stepping over import internals, simplified remote agent installation, 
and much more.


For details see What's New in Wing 7:  https://wingware.com/wingide/whatsnew

**Try Wing 7 Now!**

Wing 7 is a an exciting new step for Wingware's Python IDE product line. 
Find out how Wing 7 can turbocharge your Python development by trying it 
today.


Download Wing 7.0.4: https://wingware.com/downloads

Wing 7 installs side by side with earlier versions of Wing, so there is 
no need to remove old versions in order to try it. Wing 7 will read and 
convert your old preferences, settings, and projects. Projects should be 
saved to a new name since earlier versions of Wing cannot read Wing 7 
projects.


See Upgrading https://wingware.com/doc/install/upgrading for details and 
Migrating from Older Versions https://wingware.com/doc/install/migrating 
for a list of compatibility notes.


--
https://mail.python.org/mailman/listinfo/python-list


Re: Books for Python 3.7

2019-07-12 Thread Andrew Z
Then look at, for example, tutorialpoint.com for basic concepts - loops,
data structures,  objects .

Pet- project- something you want to build.

For example, my  current petproject is a android based clock with a voice
recognition.
Use case - clock should understand 2-3 commands to set time 8nterval and
start/stop countdown.
I have 0 knowledge in android and kotlin. So for me to get to voice
recognition part i need to learn basics of the android and kotlin.



On Fri, Jul 12, 2019, 15:35 RIchy M  wrote:

> On Friday, July 12, 2019 at 2:45:48 PM UTC-4, Andrew Z wrote:
> > Richy,
> >  What specific part you consider hard?
> > If i may suggest,  get a (pet) project as you read it.
> >
> > On Fri, Jul 12, 2019, 13:46 RIchy M  wrote:
> >
> > > On Friday, July 12, 2019 at 1:00:01 PM UTC-4, MRAB wrote:
> > > > On 2019-07-12 16:40, Terry Reedy wrote:
> > > > > On 7/12/2019 11:27 AM, Richard Mok wrote:
> > > > >
> > > > >> It does not mention on the book which version of Python it is
> using.
> > > > >
> > > > > That would likely mean 2.x.  Easy way to tell:
> > > > > 2.x has 'print x' statements.  3.x has 'print(x)' function calles.
> > > > >
> > > > I had a brief look online and saw a preview. It was written in 2006
> and
> > > > Appendix B stops at Python 2.5. A lot has happened since then!
> > >
> > > I already stopped studying from this book.
> > > Now just reading the 3.7 tutorial that came with the install.
> > > But I am a beginner...
> > > Finding it tough to learn like that.
> > > I need like a beginners guide to Python 3.7 sort of book.
> > > --
> > > https://mail.python.org/mailman/listinfo/python-list
> > >
>
> Hi Andrew
>
> I feel that that guide is written for people who already have some basic
> knowledge of Python.
> I am on the beginners level only.
>
> What is a (pet) project?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list