urllib.request with proxy and HTTPS

2017-06-30 Thread Pavel Volkov
Hello, I'm trying to make an HTTPS request with urllib. OS: Gentoo Python: 3.6.1 openssl: 1.0.2l This is my test code: = CODE BLOCK BEGIN = import ssl import urllib.request from lxml import etree PROXY = 'proxy.vpn.local:' URL = "https://google.com; proxy =

Caching function results

2016-03-03 Thread Pavel Volkov
Suppose, I have some resource-intensive tasks implemented as functions in Python. Those are called repeatedly in my program. It's guranteed that a call with the same arguments always produces the same return value. I want to cache the arguments and return values and in case of repititive call

Re: anyone tell me why my program will not run?

2015-11-21 Thread Pavel Volkov
On суббота, 21 ноября 2015 г. 6:30:02 MSK, Dylan Riley wrote: Also some more notes: heads = int("1") tails = int("2") Why use this strange initialization? The usual way: heads = 1 tails = 2 gives the same result. while flips != 0: flips -= 1 There's no need to use while and flips

Re: anyone tell me why my program will not run?

2015-11-21 Thread Pavel Volkov
On суббота, 21 ноября 2015 г. 6:30:02 MSK, Dylan Riley wrote: i am learning python and was tasked with making a program that flips a coin 100 times and then tells you the number of heads and tails. First, you have a syntax error: if result = heads: should be: if result == heads: Second,

Using map()

2014-11-16 Thread Pavel Volkov
I checked my modules with pylint and saw the following warning: W: 25,29: Used builtin function 'map' (bad-builtin) Why is the use of map() discouraged? It' such a useful thing. -- https://mail.python.org/mailman/listinfo/python-list

object().__dict__

2014-04-22 Thread Pavel Volkov
There are some basics about Python objects I don't understand. Consider this snippet: class X: pass ... x = X() dir(x) ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__',

Re: python for everyday tasks

2013-11-27 Thread Pavel Volkov
On Saturday 23 November 2013 02:01:26 Steven D'Aprano wrote: * Python is not Java, and Java is not Python either: http://dirtsimple.org/2004/12/python-is-not-java.html http://dirtsimple.org/2004/12/java-is-not-python-either.html Thanks for all those references. There's this statement in the