Why are Python's 'private' methods not actually private?

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...

Why do people use __ (double underscore) so much in C++

I was taking a look through some open-source C++ code and I noticed a lot of double underscores used within in the code, mainly at the start of variable names. return __CYGWIN__; Just wondering:...

What is the meaning of single and double underscore before an object name?

Can someone please explain the exact meaning of having single and double leading underscores before an object's name in Python, and the difference between both? Also, does that meaning stay the...

Is this the RegEx for matching any cell reference in an Excel formula?

I have been trying to create a regular expressions pattern that matches any reference in any Excel formula, including absolute, relative, and external references. I need to return the entire...

What characters are forbidden in Windows and Linux directory names?

I know that / is illegal in Linux, and the following are illegal in Windows (I think) * . " / \ [ ] : ; | , What else am I missing? I need a comprehensive guide, however, and one that takes into...

Why is frontend of Magento site not loading up? - Fatal error: Class ‘Mage__Helper_Data’ not found

I’ve got an issue with the front end of a magento site, it is throwing a 500 error. The back end admin is absolutely fine and functional, I'm able to log in no problem and there is no loss of...

Valid identifier characters in Scala

One thing I find quite confusing is knowing which characters and combinations I can use in method and variable names. For instance val #^ = 1 // legal val # = 1 // illegal val + = 1 // legal val...

Issue with Python single and double underscore variables

I am unsure what I am doing wrong; or why this is the case. I've the following code: class Expression (Node): """ ... """ def __init__ (self): self.__expressionType = None def...

KnockoutJS - how do I debounce clicks?

I want to change what happens by default when a button is pressed - I need to prevent buttons from being double-clicked. One option is wrapping the functions the buttons are bound to in _.once()...

dir() without built-in methods

Is there some way to get all of the attributes of an object without the built ins? I'm hoping to achieve this without the types package or without manually checking for double underscores if...

Length of string in Jinja/Flask

Jinja unfortunately does not support executing arbitrary Python code, such as {% if len(some_var)>1 %} ... {% endif %} My current workaround is to use the deprecated, ugly, double-underscore...

Restructured text (rst) http links underscore ('__' vs '_' use)

With restructured text, I've seen both these used: `Some Link <http://www.some.com>`_ `Some Link <http://www.some.com>`__ Both generate the same output from Sphinx, Whats the difference between...

How is __mro__ different from other double underscore names?

I stumbled upon this behavior for double underscore name that I don't understand: class A: pass class B: pass class C(A,B): __id__ = 'c' c = C() print(C.__mro__) # print the method...

Django ORM: Get verbose_name of field via filter lookup

I can query my model with MyModel.objects.filter(othermodel__nr='foo'). This works fine. I would like to get the verbose_name of the field. Example: class OtherModel(models.Model): ...

Alternative word delimiter than underscore (_) for PostgreSQL objects (fields, tables, etc.) which doesn't require me to use quotes ("") to query?

Is there any alternative word delimiter other than underscore (_) for PostgreSQL objects (fields, tables, etc.) which doesn't require me to use quotes ("") to query? The special delimiter will be...

Windows 10 Print to PDF from command-line

I'm correcting assignments from my students right now and I'd like to automate an annoying step I always have to do. After annotating their PDF solutions, I need to Print them to PDF files in...

Double underscore in python

class A(object): def __get(self): pass def _m(self): return self.__get() class B(A): def _m(self): return...

Unable to identify the WebElement using className which has double underscore.(Selenium WebDriver - JAVA)

I have been trying to identify some WebElement using className selector which contains Double Underscore and Hyphens in it (for example: grid__row) but when I run the script I...

Please give a step-by-step explanation of how Infix class from the Python Infix Hack instantination and operators overloading work

This article shows a way to create custom infix operators using functional programming in python. Here is a simplified version of Infix class described in the article: class Infix: def...

Regex Detect Double Space

I am trying to get a regex that will detect if there is a double space in a string. But if it does detect a double space it will return as false. So essentially anything else in the string is...

Laravel default auth module translation

I have generated the default Laravel auth module. Everywhere in the blades of the module, I see Double Underscore __ function assuming that translation is almost there. for example <li> <a...

Chrome on Windows adding trailing underscores to downloaded files?

I've got a rather odd situation happening, that I'm having difficulty tracking down in an existing Django application. One of the views, which inherits from APIView, returns with a file when a...

ReactJs : `npm run build` fails with Exit status 1

I have a Create React App, Single Page Application application. When I fire npm run build command, I get following error : npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build:...

Django model operations with foreign key and double underscore

I'm new to Django and just being curious to know more. Assuming I have two models defined as follows: class ModelA(models.Model): Item1 = models.Charfield() description =...

Python: How to get the absolute path of file where a function was called?

In Python, the __file__ double underscore variable can be used to get the file path of the script where the variable is used. Is there way to get the file path of the script where a function was...

How can I check if an identifier is dunder or class-private (i.e. will be mangled)?

I'm writing a project that gives advice about variable names, and I want it to tell if a name matches any of the reserved classes of identifiers. The first one ("private") is pretty...

Quad-precision numbers with Intel Compiler (icc)

I have been trying to work with Intel's Quad-precision floats. I have the following code, and it is returning unexpected results. #include <stdio.h> #include <math.h> int print(const char *label,...

What advantages does C++20's std::source_location have over the pre-defined macros __FILE__, __LINE__ and __FUNCTION__?

In my current project, I have used: Log(__LINE__, __FUNCTION__, message); But the new C++20 utility class std::source_location comes with functions line(), column(), file_name(), function_name(),...

`Bluetooth: bluetooth_adapter_winrt.cc:1073 Getting Default Adapter failed` Windows VM Python multiprocessing selenium

I have a crawler that I have created using python and selenium: see below (feel free to test it out and leave comments/ tips!). This works well on my Mac(locally), however it says it takes around...

What's the maximum precision (after the decimal point) of a float in Javascript

An algorithm I'm using needs to squeeze as many levels of precision as possible from a float number in Javascript. I don't mind whether the precision comes from a number that is very large or with...