General > General Technical Chat
How many people code in C these days, and if so, why?
dietert1:
A compiled language like C/C++ prevails for people who want some IP protection. After that hands-on advice that even elderly people need to learn Python i started looking up some examples, then downloaded pycharm IDE. Then during installation a little panel popped up asking me for the root password. What? Isn't that IDE written in Python?
Then i found i already had Python 3.7 on my Debian internet computer and the editor supported syntax hiliting for python, so i enjoyed the examples. Appended my first exercise if anybody is interested.
Tried another example with pyqt5, but that complains about super()... Maybe i am invoking another old python.
Regards, Dieter
Edit: The example script2.py worked after i made it invoke python3 instead of python. Besides that i had to install another Debian package with Qt5 bindings for python3 instead of Qt5 bindings for python that i had installed before. Now the first panels appear on my gnome desktop...
paulca:
super() is valid .. at least in python 3.
For example:
def evaluate(self, data):
state = super().evaluate(data)
if not state:
return []
jfiresto:
--- Quote from: paulca on May 17, 2020, 11:53:51 am ---super() is valid .. at least in python 3.
For example:
def evaluate(self, data):
state = super().evaluate(data)
if not state:
return []
--- End quote ---
Unfortunately, Python 2's super() is wordier and needs evaluate()'s host class:
def evaluate(self, data):
state = super(Class, self).evaluate(data)
if not state:
return []
Could feeding a super() without arguments to Python 2 be the issue?
paulca:
--- Quote from: jfiresto on May 17, 2020, 12:08:04 pm ---
--- Quote from: paulca on May 17, 2020, 11:53:51 am ---super() is valid .. at least in python 3.
For example:
def evaluate(self, data):
state = super().evaluate(data)
if not state:
return []
--- End quote ---
Unfortunately, Python 2's super() is wordier and needs evaluate()'s host class:
def evaluate(self, data):
state = super(Class, self).evaluate(data)
if not state:
return []
Could feeding a super() without arguments to Python 2 be the issue?
--- End quote ---
Probably, but it reminds me of a great way to troll Python programmers.
When they say, "It's object orientated.", reply, "No. It's not.", when they whine and get all uppity point them to the four corner stones of object orientation and get them to tick them off as to which Python supports.
Abstraction - Nope. No protection, no formal interface, no "Interface" concept.
Encapsulation - Nope. No protection, no internal/private/hidden members, everything is public.
Inheritance - Sort of, but without the above it's a bit weak and allows you to do really messed up stuff that you really shouldn't.
Polymorphism - Again, sort of, but not really.
The fact it has "self" as a function argument to make it an instance method is a sure sign it's not truely OOP. It's OOP-like and only barely.
It's not just python though. OOP-like languages include, PHP, C#, Javascript, Perl.
bd139:
It’s duck typed. None of those concepts make sense without a static type system.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version