Hot answers tagged

7

If you add variables to self in the constructor of Class and don't call Class.__init__() in the constructor of Subclass, then these variables will not be in your Subclass object. See that question for an example. In your case, Class is simply a function repository. So, it will not make a difference. However, in the future, you may need to add some ...


3

Instead of thinking about the potential benefits of a potential tool, think about the actual issues and bottlenecks you encounter in your workflow—only then you should focus on the tools which actually solve those issues. For instance, you may have a slow feedback cycle between developers and QA. Imagine a developer commits the changes on Monday at 5 p.m.; ...


3

Many security "holes" are the result of programming mistakes. Programmers necessarily make assumptions about how their programs will be used and sometimes these assumptions are incorrect. A good example is Bobby Tables. At one time it was considered a common practice to accept input from a user, concatenate that with commands to a database, then execute ...


2

Is using __import__('module_name') an antipattern in Python? The api for __import__ is somewhat misleading. I personally would prefer to avoid it where possible. The docs for Python 3 state: Direct use of __import__() is also discouraged in favor of importlib.import_module(). Here's the API for __import__: mod = __import__( module, # string ...


2

Not much of coding in Python and its long time since I coded in C. For C programs, I used to prefer top-down, because that is how I design my programs. If a calls b, b is listed after a. I also used to have a header for each .c file that lists all functions in it and included in the .c file. I follow the same model in Java class methods now.


2

The difference between my_list = list() and my_list = [] is that list requires a namespace lookup, first in the module level globals, then in the builtins. On the other hand, [] is a list literal and is parsed as creating a new list from the language, which doesn't require any name lookups. So the literal is faster on object creation. Otherwise, ...


1

What a build system like Bazel might give you? Self-contained builds with all dependencies, including all binary extensions dependencies, put into one package (see py_binary). This additionally helps keep as few things installed on a prod machine as possible. limiting the attack surface. Easily invoked unit tests in different environments. Compiling and ...


1

If you import the entries one by one, then you should be able to know when the import was terminated simply by looking at the destination database (I imagine that there is some unique identifier in the destination database which makes it possible for you to link every product there to a product in the source database, right?) If you do a bulk insert, you ...


1

Wappalyser will not be able to see the backend code running on a remote server. If you are running your Django site locally, then it will be able to inspect and report on everything. or to put it another way, you do not have access to Youtube's backend server so you cannot tell anything about it or the technology it uses. You do have full access to your ...


1

I came across this question looking for a similar answer myself. What I have found is the "Rete Algorithm", which is well explained here: https://techondec.wordpress.com/2011/03/14/rete-algorithm-demystified-part-2/ For your example, country would then be an Alpha node, below which each country(-group) hangs, and onto which you connect the actions, which ...



Only top voted, non community-wiki answers of a minimum length are eligible