In this example, a user can still access and set the variable using:  obj = C() obj._x=10 varA  = obj._x   Even if we use __x instead of _x in below code, x still doesn't become private. So the only purpose of _x is to let the programmers know that it is not meant to be set directly via obj._x?  class C:     def __init__(self):         self._x = None      @property     def x(self):         """I'm the 'x' property."""         return self._x      @x.setter     def x(self, value):         self._x = value      @x.deleter     def x(self):         del self._x
Python gives us the ability to create 'private' methods and variables within a class by prepending double underscores to the name, like this: __myPrivateMethod(). How, then, can one explain this  >>> class MyClass: ...     def myPublicMethod(self): ...             print 'public method' ...     def __myPrivateMethod(self): ...             print 'this is private!!' ...  >>> obj = MyClass() >>> obj.myPublicMethod() public method >>> obj.__myPrivateMethod() Traceback (most recent call last):   File "", line 1, in  AttributeError: MyClass instance has no attribute '__myPrivateMethod' >>> dir(obj) ['_MyClass__myPrivateMethod', '__doc__', '__module__', 'myPublicMethod'] >>> obj._MyClass__myPrivateMethod() this is private!!   What's the deal?!  I'll explain this a little for those who didn't quite get that.  >>> class MyClass: ...     def myPublicMethod(self): ...             print 'public method' ...     def __myPrivateMethod(self): ...             print 'this is private!!' ...  >>> obj = MyClass()   What I did there is create a class with a public method and a private method and instantiate it.  Next, I call its public method.  >>> obj.myPublicMethod() public method   Next, I try and call its private method.  >>> obj.__myPrivateMethod() Traceback (most recent call last):   File "", line 1, in  AttributeError: MyClass instance has no attribute '__myPrivateMethod'   Everything looks good here; we're unable to call it. It is, in fact, 'private'. Well, actually it isn't. Running dir() on the object reveals a new magical method that python creates magically for all of your 'private' methods.  >>> dir(obj) ['_MyClass__myPrivateMethod', '__doc__', '__module__', 'myPublicMethod']   This new method's name is always an underscore, followed by the class name, followed by the method name.  >>> obj._MyClass__myPrivateMethod() this is private!!   So much for encapsulation, eh?  In any case, I'd always heard Python doesn't support encapsulation, so why even try? What gives?
Did the law of conservation of energy apply to the earliest moments of the Big Bang? If so, what theoretical physics supports this?   I hear that Einstein's theory of relativity disputes the law of conservation of energy- so does that mean the law is false, or only some aspect of it? I know how to compute modular multiplicative inverses for co-prime variables $a$ and $b$, but is there an efficient method for computing variable $x$ where $x &lt; b$ and $a$ and $b$ are not co-prime, given variables $a$, $b$ and $c$, as described by the equation below?   $ a x \equiv c \mod b $   For example, given  $ 154x \equiv 14 \mod 182 $, is there an efficient method for computing all the possibilities of $x$, without pure bruteforce?  Please note that I'm not necessarily asking for a direct solution, just a more optimized one.    I do not believe that the Extended Euclidean Algorithm will work here, because $a$ and $b$ are not co-prime.   Edit:  Follow up question, since the first one had a shortcut:  Could the be computed efficiently as well?  $12260x \equiv 24560 \mod 24755$.  $107$ needs to be one of the computed answers. Selecting a database in mysql with spaces in its name I want to select my particular database in mysql console, but the problem is that my database name has a space in between and mysql ignores the part after the space. For instance, when i give the command:  use 'student registration'   I get the message:  cannot find database 'student' Do effects with the duration of one minute end at the beginning or the end of your turn? The Rage class feature of the Barbarian allows you to rage for one minute given you either took damage or attacked every round. A round is defined as a 6-second interval. So the rage can last up to 10 rounds. Now my question is, does it end at the end of your 10th round or at the beginning of your 11th round? There are other effects like that, also concentration spells with the duration of 1 or 10 minutes. Sometimes those are activated before combat starts and end during combat. In general: Does an effect/concentration end at the end of your last turn during the timespan or at the beginning of your first turn after the timespan? C programming, why does this large array declaration produce a segmentation fault? How to toggle background image on button click? In a dictionary like this:  Dictionary&lt;string, string&gt; openWith = new Dictionary&lt;string, string&gt;();  openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("dib", "paint.exe"); openWith.Add("rtf", "wordpad.exe");  Console.WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]);   The output is:     For Key = "rtf" value = wordpad.exe   What does the {0} mean? When a polished piece of metal (or steel in particular) is heated to incandescence, how do its reflective properties change?  Given a mirror-like surface, would the object temporarily cease to act like a mirror at a certain temperature?  Would the specular reflection of light turn into diffuse reflection; in other words, would the surface temporarily become matte/dull?  I am not asking about permanent changes to the object such as melting, but rather can there be a temporary change in the reflectivity only while the the object is hot, that disappears when the object is cooled down?  Background of the question: I have a laser scanner that usually has trouble scanning shiny surfaces with high specular/ low diffuse reflectivity; and it seems to work a lot better for hot steel pieces than for cold ones. Glowing steel also looks less shiny to me than cold steel, but of course that is hard to tell with all the glowing Weird evaluation order in chained functions What's the difference between anonymous methods (C# 2.0) and lambda expressions (C# 3.0)? On my system (Windows Vista Home Premium 64bit) Python files are associated with Python interpreter:  C:\Users\Piotr&gt;assoc .py .py=Python.File C:\Users\Piotr&gt;ftype Python.File Python.File=c:\python\2.7\python.exe "%1" %*   Nevertheless when I run any Python script from command line a window titled Open With pops up asking me to Choose the program you want to use to open this file. I have come across the following few questions on past exams papers.. I know how to solve these type when it is of the form $a_nz^n$ but don't have a clue what to do with these. Any help would be greatly appreciated!  (i) $\displaystyle\sum_{n=0}^\infty \bigg(\dfrac{1}{2n}\bigg)z^{3n}$.  (ii) $\displaystyle\sum_{n=0}^\infty(2^n+i)(z-i)^n$.  (iii) Show that the radius of convergence of $\displaystyle\sum_{n=0}^\infty z^{n!}$ is $1$ and that there are infinitely many $z \in \mathbb{C}$ with $|z|=1$ for which the series diverges. What did the general public know about Darth Vader? When Darth Vader first becomes Palpatine's apprentice, very few know of his existence and connection to the Emperor: the members of the Trade Federation (whom he dispatches) and Yoda, Kenobi, Organa, and their associates are all that seem to know at the end of Episode III.  Ultimately, the Resistance would know about him as they would be fighting him, and Organa could have been able to inform them about his identity and the fact that he is a Force user. The military of the Empire would know of his existence, but even high-ranking members likely wouldn't know his past or identity. However, they would know about the fact that he is a Force user due to his tendency to use his "sorcerer's ways" to choke people.  So, how much would the general public have known about Vader? Would they have known him as just another military leader, or would they have known he was Palpatine's right-hand man? Would they have known about his ability to use the Force, and therefore the possibility that he was a Sith? Have Kylo Ren's Force abilities been shown before? I'm only familiar with the movies, so in The Force Awakens I saw some use of the Force that was new to me.  Most notable were these two abilities:      freezing blaster bolts in mid-air, and directly reading someone's mind like he tried with Rey.   Have either of these happened before? Are locks unnecessary in multi-threaded Python code because of the GIL? If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all?  If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect?  sorry if this is a dumb question, but it is something I have always wondered about Python on multi-processor/core machines.    same thing would apply to any other language implementation that has a GIL. What is object slicing? How do I concatenate const/literal strings in C? How to make a cross-module variable? Number of vertices present in all maximum matchings Given a graph $G$, we need to find the cardinality of the largest set of vertices so that each of them are present in every maximum matching possible.   Is there a solution beside the obvious remove each vertex and find the maximum matching to see it reduces? Why CAN we see the new moon at night? I understand that the Moon's phases are determined by its position in orbit relative to the Sun. (See: ). The "shadow" is not cast by the Earth (a common misconception - this is actually a lunar eclipse), but by the moon's body itself.  It would appear that, in order for the moon to be a new moon, it would have to be somewhere between the Earth and the Sun. However, it would seem that, if we were looking at a new moon, we'd necessarily be looking at the Sun as well.  Why, then, can we sometimes see a new moon at night? Why doesn't it vanish at night for a half-month every month, between its last/first quarters?