Linked Questions

0 votes
1 answer
7k views

I use Ruby on a daily basis and know it is a purely object oriented language. As far as I know, pure object oriented languages' distinguishable characteristic is that all variables are objects, even ...
StanMarsh's user avatar
  • 729
2 votes
0 answers
54 views

Little question: are int, float, bool, list, str, etc. actual classes in python? For example, if we write x = 5 we create an instance of a class int and assign this instance to a variable x. Am I ...
trollpidor's user avatar
829 votes
26 answers
1.8m views

This is my code: import datetime today = datetime.date.today() print(today) This prints: 2008-11-22 which is exactly what I want. But, I have a list I'm appending this to and then suddenly everything ...
NomadAlien's user avatar
  • 9,310
155 votes
9 answers
67k views

I'm looking for a clear, concise and accurate answer. Ideally as the actual answer, although links to good explanations welcome.
Keith's user avatar
  • 157k
60 votes
15 answers
31k views

Ruby can add methods to the Number class and other core types to get effects like this: 1.should_equal(1) But it seems like Python cannot do this. Is this true? And if so, why? Does it have something ...
airportyh's user avatar
  • 22.8k
9 votes
6 answers
2k views

I remember that at one point, it was said that Python is less object oriented than Ruby, since in Ruby, everything is an object. Has this changed for Python as well? Is the latest Python more object ...
nonopolarity's user avatar
15 votes
8 answers
31k views

I am surprised that my question was not asked (worded like the above) before. I am hoping that someone could break down this basic term "object" in the context of a OOP language like Python. ...
jchua's user avatar
  • 414
21 votes
2 answers
38k views

I understand that in python every thing, be it a number, string, dict or anything is an object. The variable name simply points to the object in the memory. Now according to this question, >> ...
darkryder's user avatar
  • 832
3 votes
4 answers
6k views

I have started learning about python, reading some tutorials, and i have seen the sentence that Everything is an object in Python, what does it actually mean?
Md. Tanvir Raihan's user avatar
5 votes
3 answers
7k views

hasattr documentation says that it takes an object and an attribute name and lets you know if that attribute exists on that object. I have discovered that it seems to work on class names too (i.e. ...
Programmer Person's user avatar
0 votes
4 answers
4k views

I'm adding dynamically attribute to a module, before using it I want to verify that the added attribute exist (in the module). hasattr signature is: hasattr(object, name) module is not an object, ...
EitanG's user avatar
  • 221
3 votes
3 answers
6k views

I am looking for the equivalent of PHPs InvalidArgumentException to use in case a function gets an argument that has an incorrect type. I'm working with Python 3. (And I am quite new to Python.) ...
Jeroen De Dauw's user avatar
7 votes
1 answer
619 views

I fully understand what is being passed to self in this example. I'm very confused on how it is being passed to self internally. Could someone help me understand? class Cars: def __init__(self,...
Ben Hutton's user avatar
3 votes
5 answers
738 views

Everything in Python is an object We all know this sentence and all Pythonistas (including me) loving it. In that regard, it is interesting to look at operators. They seem to be no objects, e.g. >&...
gehbiszumeis's user avatar
  • 3,749
2 votes
5 answers
2k views

I constantly see people state that "Everything in Python is an object.", but I haven't seen "thing" actually defined. This saying would lead me to believe that all tokens of any kind are also ...
BenevolentDeity's user avatar

15 30 50 per page