Python Forum
Understand what it means that everything in Python is an object...
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Understand what it means that everything in Python is an object...
#7
(Feb-06-2021, 12:33 AM)bytecrunch Wrote: Thanks Jeff900,

Sorry, I am a beginner. What do you mean exactly when you say "just" Python scripts? To me, a script is how we call a Python program.

And you said, everything is an object which seems to be one of the hallmarks of OOP. But coding in Python does not imply OOP.

With scripting I basically mean you will just run some code at once. To analyse data for example, or do something with a bunch of files etc. It has a specific beginning and an end, unlike programs that will be kept alive one way or another. But I realise this is my opinion and kind of subjective...

But to give an example for the fact that even in a simple 'script' you're using objects, take a look at the following code.

>>> number = 1
>>> type(number)
Output:
<class 'int'>
In this example you can see a simple integer is not just an integer. It is a class (object) which is used to define integers. You can create your own classes in Python to create your own specific objects. Creating your own classes may feel more like OOP, but in fact with using Python you're working with objects all the time.
bytecrunch likes this post
Reply


Messages In This Thread
RE: Understand what it means that everything in Python is an object... - by Jeff900 - Feb-06-2021, 07:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python update binary object (override delivered Object properties) pierre38 4 1,839 May-19-2022, 07:52 AM
Last Post: pierre38
  Understand order of magnitude performance gap between python and C++ ThelannOryat 4 2,772 Mar-17-2021, 03:39 PM
Last Post: ThelannOryat
  Trying to understand the python code spalisetty 2 1,925 Mar-16-2020, 08:11 AM
Last Post: javiertzr01
  I do not understand why my python looks different from tutorials. noodlespinbot 2 5,236 Oct-12-2019, 09:56 PM
Last Post: noodlespinbot
  what "return" means? PY_beginner 9 4,018 Oct-10-2019, 07:18 AM
Last Post: newbieAuggie2019
  I dont understand bytes in python. blackknite 3 4,118 Oct-02-2019, 07:39 PM
Last Post: Gribouillis
  effective means to flip boolean values? Exsul 3 4,411 Aug-25-2019, 03:58 PM
Last Post: Exsul
  what means in Python the "->"? lsepolis123 2 2,038 Aug-22-2019, 08:08 AM
Last Post: DeaD_EyE
  Smtplib: What does context argument means? Pythenx 1 3,141 Mar-27-2019, 06:25 PM
Last Post: nilamo
  Trying to understand how import works in python patrick99e99 3 3,931 Jun-12-2018, 04:48 AM
Last Post: patrick99e99

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020