“public” or “private” attribute in Python ? What is the best way?

Typically, Python code strives to adhere to the Uniform Access Principle. Specifically, the accepted approach is: Expose your instance variables directly, allowing, for instance, foo.x = 0, not foo.set_x(0) If you need to wrap the accesses inside methods, for whatever reason, use @property, which preserves the access semantics. That is, foo.x = 0 now invokes … Read more

Func vs. Action vs. Predicate [duplicate]

The difference between Func and Action is simply whether you want the delegate to return a value (use Func) or not (use Action). Func is probably most commonly used in LINQ – for example in projections: or filtering: or key selection: Action is more commonly used for things like List<T>.ForEach: execute the given action for … Read more

How to read html from a url in python 3

I looked at previous similar questions and got only more confused. In python 3.4, I want to read an html page as a string, given the url. In perl I do this with LWP::Simple, using get(). A matplotlib 1.3.1 example says: import urllib; u1=urllib.urlretrieve(url). python3 can’t find urlretrieve. I tried u1 = urllib.request.urlopen(url), which appears … Read more

How to fix “ERROR: The system was unable to find the specified registry key or value.” when running a batch file

You’re not deleting a registry key named: You’re deleting a registry value, named: Functions which exists under the key named HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002. To perform the task you therefore need to use the correct syntax: You would also need to run the script ‘as Administrator’, to prevent an Access is denied message.