Python and Option Explicit
-
Please someone adds an Option Explicit to Python. The fact that something like this is even conceivable, let alone valid, is atrocious:
class Empty:
passEmpty.completelyNewAttribute = "seriously?" # adds a class member
obj = Empty()
obj.randomTypo = 10 # adds an instance member only to objEvery new programmer makes fun of C++ for being unnecessarily hard to use but I think that a language like Python, with all the possible ways it enables programmers to shoot themselves, is 10 times harder than C++. And yes, my opinion that Python is VB with different clothes is only becoming stronger. Ugh.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
Remember when people complained about C, so someone came up with lint? Guess what? pylint.org 😊
-
Remember when people complained about C, so someone came up with lint? Guess what? pylint.org 😊
Lint... the only tool that can take a perfectly readable piece of code and make a total mess out of it. I wonder what damages it can do with Python.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
-
Please someone adds an Option Explicit to Python. The fact that something like this is even conceivable, let alone valid, is atrocious:
class Empty:
passEmpty.completelyNewAttribute = "seriously?" # adds a class member
obj = Empty()
obj.randomTypo = 10 # adds an instance member only to objEvery new programmer makes fun of C++ for being unnecessarily hard to use but I think that a language like Python, with all the possible ways it enables programmers to shoot themselves, is 10 times harder than C++. And yes, my opinion that Python is VB with different clothes is only becoming stronger. Ugh.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
I think what you're looking for are __slots__
class Empty:
__slots__ = ('completelyNewAttribute',)Empty.completelyNewAttribute = "seriously?" # adds a class member
obj = Empty()
obj.randomTypo = 10 # raises AttributeError: 'Empty' object has no attribute 'randomTypo' -
I think what you're looking for are __slots__
class Empty:
__slots__ = ('completelyNewAttribute',)Empty.completelyNewAttribute = "seriously?" # adds a class member
obj = Empty()
obj.randomTypo = 10 # raises AttributeError: 'Empty' object has no attribute 'randomTypo' -
Please someone adds an Option Explicit to Python. The fact that something like this is even conceivable, let alone valid, is atrocious:
class Empty:
passEmpty.completelyNewAttribute = "seriously?" # adds a class member
obj = Empty()
obj.randomTypo = 10 # adds an instance member only to objEvery new programmer makes fun of C++ for being unnecessarily hard to use but I think that a language like Python, with all the possible ways it enables programmers to shoot themselves, is 10 times harder than C++. And yes, my opinion that Python is VB with different clothes is only becoming stronger. Ugh.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
read up on __slots__ 3. Data model — Python 3.10.2 documentation[^]
-
Please someone adds an Option Explicit to Python. The fact that something like this is even conceivable, let alone valid, is atrocious:
class Empty:
passEmpty.completelyNewAttribute = "seriously?" # adds a class member
obj = Empty()
obj.randomTypo = 10 # adds an instance member only to objEvery new programmer makes fun of C++ for being unnecessarily hard to use but I think that a language like Python, with all the possible ways it enables programmers to shoot themselves, is 10 times harder than C++. And yes, my opinion that Python is VB with different clothes is only becoming stronger. Ugh.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
No! It is about the right tool for the job.I love C++, Java, SQL and Python but all of them require different ways of thinking and is for solving different problems. If you approach Python like C++ it will frustrate you to no end. However, for the right problem Python is an absolute blast to use! If you need to get something done quickly, with lots of uncertainty and you have the opportunity to iterate Python is amazing. I love it when you can work with an interface/dataset which you only need a small portion of and you don't have to define and type the stuff you are not interested (which happens a LOT in the data world). Of course lots of people hate that uncertainty and would love for everything they work with to be 100% defined, but defining something 100% of which you only use 10% is literally a waste of time. Of course that depends on context. If you deal with transactional banking you want everything defined 100% and I will stick to Java/C++. If you are trying to extract value from an enterprise data lake quickly where you don't know all the data, will have no opportunity to know all the data then using Python for ML and other purposes is awesome.
-
No! It is about the right tool for the job.I love C++, Java, SQL and Python but all of them require different ways of thinking and is for solving different problems. If you approach Python like C++ it will frustrate you to no end. However, for the right problem Python is an absolute blast to use! If you need to get something done quickly, with lots of uncertainty and you have the opportunity to iterate Python is amazing. I love it when you can work with an interface/dataset which you only need a small portion of and you don't have to define and type the stuff you are not interested (which happens a LOT in the data world). Of course lots of people hate that uncertainty and would love for everything they work with to be 100% defined, but defining something 100% of which you only use 10% is literally a waste of time. Of course that depends on context. If you deal with transactional banking you want everything defined 100% and I will stick to Java/C++. If you are trying to extract value from an enterprise data lake quickly where you don't know all the data, will have no opportunity to know all the data then using Python for ML and other purposes is awesome.
Of course. I loved VB6 for its intended use and it had the following nigthmares
Option Base 1
Option Compare Text
Option Explicit ' The issue is that it's not the default so it is actually like Python
On Error Resume NextDim variable as Variant
I know where it comes from and what it is meant to do, I think it is awesome with its extensive standard library. I need it to automate stuff and talk to libraries while showing a minimal UI for expert users. So, the same as VB but portable and still maintained.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
-
obermd wrote:
Option Explicit is the programmer telling you how they're handling variables.
and that is supposed to make me feel more comfortable with it? :laugh: :laugh: :thumbsdown:
-
You do understand that Python was named in honour of "Monty Python's Flying Circus" (where chaos and madness were the norm)?
-
when I see code statements like
goto
andoption explicit
, I run in the opposite direction.den2k88 wrote:
with all the possible ways it enables programmers to shoot themselves
I honestly think that is the objective (thinning the herd). :sigh:
den2k88 wrote:
Every new programmer makes fun of C++
What is funny about this is that most of the software these "new programmers" run, was written partly or mostly in C++. Inconceivable! :laugh:
by the way, this dude revealed a secret feature of
goto
in c++ that apparently very few people know about (from 31m:15s): CppCon 2019: Miro Knejp “Non-conforming C++: the Secrets the Committee Is Hiding From You” - YouTube[^] disclamer: i myself am a visual basic guy, sogoto
caught my attention. i further have no clue about c++ -
Please someone adds an Option Explicit to Python. The fact that something like this is even conceivable, let alone valid, is atrocious:
class Empty:
passEmpty.completelyNewAttribute = "seriously?" # adds a class member
obj = Empty()
obj.randomTypo = 10 # adds an instance member only to objEvery new programmer makes fun of C++ for being unnecessarily hard to use but I think that a language like Python, with all the possible ways it enables programmers to shoot themselves, is 10 times harder than C++. And yes, my opinion that Python is VB with different clothes is only becoming stronger. Ugh.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
These days it feels like C# has taken one look at Python and said to the guy next to him: "hold my beer..."
cheers Chris Maunder
-
Please someone adds an Option Explicit to Python. The fact that something like this is even conceivable, let alone valid, is atrocious:
class Empty:
passEmpty.completelyNewAttribute = "seriously?" # adds a class member
obj = Empty()
obj.randomTypo = 10 # adds an instance member only to objEvery new programmer makes fun of C++ for being unnecessarily hard to use but I think that a language like Python, with all the possible ways it enables programmers to shoot themselves, is 10 times harder than C++. And yes, my opinion that Python is VB with different clothes is only becoming stronger. Ugh.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
Nahh, that is the fun stuff. When I was doing my first foray into this language I just could not stop giggling, since I could almost imagine Pinky and Brain kinda talking about adding this feature here, that feature over there and how coooool would it be to have feature in their language like that. Anyway, python is great for prototyping AI algos and building\training models. I also heard that web guys do it with quality.But since I use it for my diploma with AI stuff in it, I only saw how well you can use it to build AI stuff with it.