Re: Which linux distro is more conducive for learning the Python programming language?

2022-08-04 Thread Christian Heimes
On 04/08/2022 20.12, Barry wrote: Noted with thanks Kushal. Since I can download FREE copies of RHEL 9.0, I will use it then. I consider rhel 9 is an old os. I would suggest using fedora over rhel. Fedora 36 has python 3.10 and the when fedora 37 is released it will have python 3.11. And fedor

Re: ssl server: how to disable client cert verfication?

2022-02-04 Thread Christian Heimes
On 04/02/2022 19.24, Grant Edwards wrote: The problem is _getting_ the client certificate that was provided during the client/server handshake. That's trivial if the handshake was successful. The problem is obtaining the client certificate when the handshake fails. I was hoping there was a way to

Re: ssl server: how to disable client cert verfication?

2022-02-04 Thread Christian Heimes
On 03/02/2022 19.57, Grant Edwards wrote: I've got a small ssl server app. I want to require a certificate from the client, so I'm using a context with context.verify_mode = ssl.CERT_REQUIRED But, I want all certificates accepted. How do I disable client certificate verification? You can't. P

Re: About Python Compressed Archive or Binaries

2022-01-18 Thread Christian Heimes
On 17/01/2022 18.49, Kirill Ratkin wrote: It would be nice to have just zip file with python interpreter (not executable installer), unpack it anywhere, add path  to this 'anywhere' to PATH, and use it. Java/DotNet/Go have this option. But python - not. And question is - why? Java is develo

Re: Searching pypi.org, is there an 'advanced search'?

2021-07-18 Thread Christian Heimes
On 18/07/2021 10.15, Chris Green wrote: > Mark Lawrence wrote: >> On Saturday, July 17, 2021 at 1:03:21 PM UTC+1, Chris Green wrote: >>> Every time I go to pypi.org to look for a neat utility or something I >>> curse the stupid search. >>> >>> Is there really no better search available? Apart fr

Re: Retrieving non-/etc/passwd users with Python 3?

2021-03-31 Thread Christian Heimes
On 31/03/2021 14.45, Loris Bennett wrote: > Chris Angelico writes: > >> On Wed, Mar 31, 2021 at 11:21 PM Loris Bennett >> wrote: >>> >>> Hi, >>> >>> I want to get a list of users on a Linux system using Python 3.6. All >>> the users I am interested in are just available via LDAP and are not in

Re: port to PDOS (especially mainframe)

2021-03-24 Thread Christian Heimes
On 23/03/2021 22.22, Paul Edwards wrote: > "long long" is not C90. I don't have support for that. The > "i370" target of GCC 3.2.3 doesn't have DI instructions > working. Just 32 bits. Everything is 32 bits. Which version of Python are you using as baseline? CPython requires C99 since 3.6, https:/

Re: Python subinterpreters with separate GILs

2021-02-10 Thread Christian Heimes
On 11/02/2021 03.51, James Lu wrote: > Directly removing the Global Interpreter Lock (GIL) would break a lot > of libraries that implicitly assume it is there. What if Python had > "realms" that each had separate GILs? > > The "realms" (not sure if "subinterpreter" is the correct term here) > coul

Re: Debian testing and virtual environment error message

2020-12-27 Thread Christian Heimes
On 27/12/2020 04.05, songbird wrote: > songbird wrote: > ... >> The package mentioned is installed: >> >> >> = >> >> $ dpkg -l | grep python3-venv >> ii python3-venv 3.9.0-4 >> amd64pyvenv-3 binary for python3 (default python3 version)

Re: How to diagnose import error when importing from .so file?

2020-07-29 Thread Christian Heimes
On 29/07/2020 15.34, Chris Green wrote: > I have some Python Gtk 2 code I'm trying to convert to Python > pygobject GTK 3. > > However I'm stuck on an import statement that fails:- > > import pyscand > > > The error message is:- > > File "/usr/libexec/okimfputl.new/guicom.py", line 66,

Re: The speed of glob()

2020-07-29 Thread Christian Heimes
On 29/07/2020 11.43, Gisle Vanem wrote: > Chris Angelico wrote: > >>> Has anybody noticed the speed of 'glob()' has >>> decreased somewhere between v3.6 and v3.10. >>> >>> I got these results: >>>     Python 3.6.5: >>>   1st run: 0.14694 >>>   2nd run: 0.09506   <- *always* the fastest >>>

Re: Spam, bacon, sausage and Spam (was: EuroPython 2020: Data Science Track)

2020-07-23 Thread Christian Heimes
On 23/07/2020 02.12, Cameron Simpson wrote: > On 22Jul2020 15:00, Christian Heimes wrote: >> Hi MAL, >> >> would it be possible to reduce the amount of EuroPython spam on >> @python.org mailing lists to a sensible level? This mailing list is a >> general discussio

Spam, bacon, sausage and Spam (was: EuroPython 2020: Data Science Track)

2020-07-22 Thread Christian Heimes
Hi MAL, would it be possible to reduce the amount of EuroPython spam on @python.org mailing lists to a sensible level? This mailing list is a general discussion list for the Python programming language. It's not a conference advertisement list. Something between 1 to 3 mails per conference and ye

Re: Developers are advised to purge these malicious packages

2019-12-04 Thread Christian Heimes
On 04/12/2019 18.59, David Lowry-Duda wrote: > I notice that "python3-dateutil" is in over 4000 github repositories > [1]. That sounds like a disaster. > > [1]: https://github.com/search?q=python3-dateutil&type=Code At least the first pages are packaging files for Debian, Fedora, and other Linux

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Christian Heimes
On 02/12/2019 22.25, Barry Scott wrote: > > >> On 2 Dec 2019, at 17:55, Rob Gaddi wrote: >> >> On 12/2/19 9:26 AM, Chris Clark wrote: >>> Test case: >>>import array >>>array.array('L', [0]) >>> # x.itemsize == 8 rather than 4 >>> This works fine (returns 4) under

Re: Amber Brown: Batteries Included, But They're Leaking

2019-05-19 Thread Christian Heimes
On 19/05/2019 22.48, Chris Angelico wrote: >> the sslmodule requires a monkeypatch to connect to non-ASCII domain names, It's not correct. There were some bugs in IDNA support in the SSL module. Nathaniel and I worked on the topic and fixed it in 3.7, see https://bugs.python.org/issue28414 Python

Re: AES Encryption/Decryption

2018-11-02 Thread Christian Heimes
On 02/11/2018 15.42, Jeff M wrote: > Python newbie here, looking for code samples for encrypting and decrypting > functions, using AES. See lots of stuff on the interwebs, but lots of > comments back an forth about bugs, or implemented incorrect, etc... > > I need to encrypt some strings that w

Re: How to make python pick up my new-and-shiny openssl shared object

2018-08-07 Thread Christian Heimes
On 2018-08-08 00:07, Fetchinson . via Python-list wrote: > The highest version of openssl available on my system is 1.0.0 which > is not good enough for pip these days (or github for that matter). So > I've installed 1.1.0 to a custom location /home/fetch/opt. But if I do > > import ssl > ssl.OPEN

Re: Can anyone tell me where the old MacPython "16 ton" logo came from?

2018-07-15 Thread Christian Heimes
On 2018-07-15 14:05, Mark wrote: > I'm curious to understand how come the original MacPython logo is of a 16 ton > weight (rather than, say the word 'python' or a picture of a snake)? > You can see the logo here: https://homepages.cwi.nl/~jack/macpython/ Most obscure references in Python are base

Re: Why cannot I use __slots__ and weakrefs together?

2018-05-26 Thread Christian Heimes
On 2018-05-26 11:17, Steven D'Aprano wrote: > Here is my code: > > > > cut here %< > > import weakref > d = weakref.WeakValueDictionary() > > class Spam: > pass > > class Eggs: > __slots__ = ['spanish_inquisition'] > > d['a'] = Spam() # Okay. > d['b'] = Eggs() # Nobody wi

Re: SSL/TLS support in Pyro4

2017-08-04 Thread Christian Heimes
On 2017-08-04 17:11, Robin Becker wrote: > On 04/08/2017 15:12, Irmen de Jong wrote: >> On 04/08/2017 15:44, Robin Becker wrote: > .. >> You can specify a CAcert using load_verify_locations on the ssl >> context. Is that what >> you meant? I figured out that if you set that to the peer's >>

Re: @lru_cache on functions with no arguments

2017-08-01 Thread Christian Heimes
On 2017-08-01 01:31, t...@tomforb.es wrote: > As part of the Python 3 cleanup in Django there are a fair few uses of > @functools.lru_cache on functions that take no arguments. A lru_cache isn't > strictly needed here, but it's convenient to just cache the result. Some > examples are here: https

Re: is @ operator popular now?

2017-07-15 Thread Christian Heimes
On 2017-07-15 14:05, Matt Wheeler wrote: > On Sat, 15 Jul 2017, 12:35 oyster, wrote: > >> as the title says. has @ been used in projects? >> > > Strictly speaking, @ is not an operator. > It delimits a decorator statement (in python statements and operations are > not the same thing). > However,

Re: Is Python SSL API thread-safe?

2017-01-22 Thread Christian Heimes
On 2017-01-22 21:18, Grant Edwards wrote: > Is the Python SSL API thread-safe with respect to recv() and send()? > > IOW, can I have one thread doing blocking recv() calls on an SSL > connection object while "simultaneously" a second thread is calling > send() on that same connection object? > >

Re: How to create a socket.socket() object from a socket fd?

2017-01-22 Thread Christian Heimes
On 2017-01-22 01:03, Grant Edwards wrote: > On 2017-01-21, Christian Heimes wrote: > >> You might be interested in my small module >> https://pypi.python.org/pypi/socketfromfd/ . I just releases a new >> version with a fix for Python 2. Thanks for the hint! :) >> &

Re: How to create a socket.socket() object from a socket fd?

2017-01-21 Thread Christian Heimes
On 2017-01-21 23:41, Grant Edwards wrote: > On 2017-01-21, Grant Edwards wrote: > >> Given a Unix file discriptor for an open TCP socket, I can't figure >> out how to create a python 2.7 socket object like those returned by >> socket.socket() >> >> Based on the docs, one might think that socket.f

Re: Python, asyncio, and systemd

2017-01-17 Thread Christian Heimes
On 2017-01-17 17:57, Chris Angelico wrote: > If I write a web server using asyncio (and the aiohttp package), I can > spin up the server with: > > await loop.create_server(app.make_handler(), "0.0.0.0", 8080) > > This works fine for a high port, but if I want to bind to port 80, I > need to eithe

Re: US/Eastern offset

2016-12-22 Thread Christian Heimes
On 2016-12-22 21:49, Skip Montanaro wrote: > In a small application I realized I needed all my timestamps to have > timezone info. Some timestamp strings come in with no TZ markings, but > I know they are US/Eastern. so, I built one: > import pytz tz = pytz.timezone("US/Eastern") tz

Re: array.itemsize: Documentation Versus Reality

2016-09-17 Thread Christian Heimes
On 2016-09-17 05:47, Lawrence D’Oliveiro wrote: > >>> a = array.array("I", (0,)) > >>> a.itemsize > 4 > >>> a = array.array("L", (0,)) > >>> a.itemsize > 8 > > According to , the “minimum > size” should be 2 and 4 respectively.

Re: file.seek() and file.tell() look inconsistent to me

2016-07-04 Thread Christian Heimes
On 2016-07-04 17:48, Marco Buttu wrote: > Hi all, > > if I open a file in text mode, do you know why file.seek() returns the > number of bytes, and file.tell() takes the number of bytes? I was > expecting the number of characters, like write() does: Your expectations are not correct. tell() and s

Re: linux os.rename() not an actual rename?

2015-07-20 Thread Christian Heimes
On 2015-07-20 20:50, Marko Rauhamaa wrote: > "Jason H" : > >> I have a server process that looks (watches via inotify) for files to >> be moved (renamed) into a particular directory from elsewhere on the >> same filesystem. We do this because it is an atomic operation, and our >> server process ca

Re: List of "python -m" tools

2015-01-11 Thread Christian Heimes
On 12.01.2015 05:17, Miki Tebeka wrote: > Greetings, > > I've compiled a list of "python -m" tools at > pythonwise.blogspot.com/2015/01/python-m.html. > > Did I miss something? What are your favorite "python -m" tools? My all time favorite is "python -me", https://pypi.python.org/pypi/e. It's a

Re: "High water" Memory fragmentation still a thing?

2014-10-03 Thread Christian Heimes
On 03.10.2014 21:16, Antoine Pitrou wrote: > It is not a leak. It is a quite common pattern of memory fragmentation. > The article is wrong in assuming that Python doesn't return the memory to > the OS. Python does return its empty memory pools to the OS, however the OS > itself may not be able to

Re: SNI support in python 2.7 for Locust load tests

2014-09-30 Thread Christian Heimes
On 30.09.2014 16:50, Reddy wrote: > Hello, > > At the beginning - welcome everyone, as this is my first post here. I'm not > an active Python developer now, but I have general knowledge of the language. > > I'm trying to use locust (http://locust.io/) to run load test of one site > we're devel

Re: hashlib suddenly broken

2014-09-18 Thread Christian Heimes
On 18.09.2014 23:39, Larry Martell wrote: > $ python > Python 2.7.2 (default, Oct 11 2012, 20:14:37) > [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin > Type "help", "copyright", "credits" or "license" for more information. import _hashlib _hashlib.__file__ >

Re: hashlib suddenly broken

2014-09-18 Thread Christian Heimes
On 18.09.2014 21:23, Larry Martell wrote: > On Thu, Sep 18, 2014 at 11:18 AM, Chris Angelico wrote: >> On Fri, Sep 19, 2014 at 3:07 AM, Steven D'Aprano >> wrote: >>> but I expect that's probably not where the problem lies. My *wild guess* is >>> that your system updated SSL, and removed some unde

Re: pycrypto 3.4 binaries for windows x86

2014-09-09 Thread Christian Heimes
On 09.09.2014 16:45, Nagy László Zsolt wrote: > Where can I find compiled installer for pycrypto for python 3.4 windows > 32bit? Voidspace does not have compiled installers for 3.4, only 3.3. > pip cannot install it because it wants to compile it from source. (I > need a binary installer, and I don

Re: patch request for os.urandom()

2014-07-17 Thread Christian Heimes
On 17.07.2014 20:34, Paul Rubin wrote: > Could os.urandom() be patched to use the new Linux getrandom() system > call on systems where it is available? Further info: > > http://lists.openwall.net/linux-kernel/2014/07/17/235 > > I've stopped posting to the Python bug tracker because the password

Re: confused about the different built-in functions in Python

2014-05-26 Thread Christian Heimes
On 26.05.2014 21:00, Marko Rauhamaa wrote: > Terry Reedy : > >> Part of the answer is Python's history. Up to about 2.1, most built-in >> types did not have methods, though I know lists did. Ints and strings >> did not, or chr and ord might have been int.chr() and str.ord(). (The >> current string

Re: Using ssl.wrap_socket() in chroot jail

2014-05-07 Thread Christian Heimes
On 07.05.2014 17:42, Grant Edwards wrote: > Let's say you have a server/daemon application written in python that > accepts incoming SSL connections. > > You want to run that application in a chroot jail. > > The last thing you want in that jail is your SSL certificate private > key file. > >

Re: Normal dict behavior?

2014-05-07 Thread Christian Heimes
On 07.05.2014 17:20, Ned Batchelder wrote: > Because 0 == 0.0 > hash(0) == hash(0.0) and 0 == 0.0 Christian -- https://mail.python.org/mailman/listinfo/python-list

Re: Password validation security issue

2014-03-02 Thread Christian Heimes
On 01.03.2014 21:11, Chris Angelico wrote: > The problem isn't SHA-256. The problem is insecure passwords, the way > we've been taught to make them by the banks. Hence, XKCD 936. Your argumentation is just wrong. You are saying "It's OK to use a totally insecure way to hash passwords because passw

Re: Password validation security issue

2014-03-01 Thread Christian Heimes
On 01.03.2014 21:25, Roy Smith wrote: > In article , > Christian Heimes wrote: > >> With software like [1] and a fast GPU >> it is possible to do more than 10*10^9 checks/second for SHA-256. > > Just out of curiosity, how does that differ from 10^10 checks/second?

Re: Password validation security issue

2014-03-01 Thread Christian Heimes
On 01.03.2014 19:45, Chris Angelico wrote: > On Sun, Mar 2, 2014 at 5:31 AM, Christian Heimes wrote: >>>>>> encrypted = hashlib.sha256(login+'NaCl protects your >>>>>> passwords'+password).hexdigest() >>>>>> encrypted &g

Re: Password validation security issue

2014-03-01 Thread Christian Heimes
On 01.03.2014 19:11, Chris Angelico wrote: > On Sun, Mar 2, 2014 at 4:49 AM, Renato wrote: >> Hello everybody, I implemented a password validation with a Python 2.7.5 >> script in OpenSUSE 13.1. The user calls it passing 'login' and 'password' as >> arguments. I made a dictionary in the format h

Re: Problems compiling Python 3.4 on Ubuntu

2014-02-03 Thread Christian Heimes
On 03.02.2014 16:14, Ram Rachum wrote: > Worked! Thanks Ervin! $ sudo apt-get build-dep python3.3 will install everything you need to compile Python 3.4 on Debian and Ubuntu. Good luck! :) Christian -- https://mail.python.org/mailman/listinfo/python-list

Re: pytz question: GMT vs. UTC

2014-01-30 Thread Christian Heimes
On 30.01.2014 04:27, Chris Angelico wrote: > On Thu, Jan 30, 2014 at 1:40 PM, MRAB wrote: >>> How cruel... I suspect the smack at 0degC is much more painful >>> than one >>> at room temperature >>> >> It's the 21st century; you should be making use of Unicode: 0°C. > > I started to read

Re: No overflow in variables?

2014-01-23 Thread Christian Heimes
On 22.01.2014 19:26, Chris Angelico wrote: > Internally, I believe CPython uses the GNU Multiprecision Library > (GMP), which gives an efficient representation and operation format, > scaling to infinity or thereabouts. You can go to any size of integer > you like without there being any difference

Re: Error while building Python doc

2013-12-22 Thread Christian Heimes
Am 22.12.2013 21:59, schrieb Terry Reedy: > Did you run "make -C Doc checkout" first? (I do not know what the -C > does, as I just do "make checkout" and occasionally make update in Doc > on Windows, which run Doc/make.bat. -C == change directory "make -C Doc html" is like "cd Doc; make html; cd

Re: Compiling Python 3.3.2 on CentOS 6.4 - unable to find compiled OpenSSL?

2013-11-05 Thread Christian Heimes
Am 05.11.2013 01:23, schrieb Victor Hooi: > Hi, > > We have a machine running CentOS 6.4, and we're attempting to compile Python > 3.3.2 on it: > > # cat /etc/redhat-release > CentOS release 6.4 (Final) > > We've compiled openssl 1.0.1e 11 by hand on this box, and installed it into

Re: sorting german characters äöü...

2013-10-30 Thread Christian Heimes
Am 30.10.2013 19:38, schrieb Ulrich Goebel: > Hello, > > for a SQLite database I would like to prepare a collating function in > python. It has to compare two (unicode-)strings s, t and should return > -1 if st. > > The strings are german names/words, and what I would like is to have a > case-ins

Re: Maintaining a backported module

2013-10-24 Thread Christian Heimes
Am 24.10.2013 06:54, schrieb Steven D'Aprano: > As some of you are aware, I have a module accepted into the standard > library: > > http://docs.python.org/3.4/library/statistics.html > > I'm now at the point where I wish to backport this module to support > versions of Python back to 3.1 at lea

SSL issues in Python stdlib and 3rd party code

2013-08-12 Thread Christian Heimes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello, (re-post from the Python developer list) last week Ryan Sleevi of the Google Chrome Security Team has informed us about about two issues in Python's SSL module. I already new about the cause of the first bug and suspected that our SSL module

Re: Python 3: dict & dict.keys()

2013-07-24 Thread Christian Heimes
Am 24.07.2013 18:34, schrieb Chris Angelico: > Side point: Why is iterating over a dict equivalent to .keys() rather > than .items()? It feels odd that, with both options viable, the > implicit version iterates over half the dict instead of all of it. > Obviously it can't be changed now, even if .i

Re: Floating point minimum and maximum exponent values

2013-07-16 Thread Christian Heimes
Am 16.07.2013 14:04, schrieb Chris Angelico: > Piece of extreme oddity, this. > help(sys.float_info) > lots of other info ... > | max_exp > | DBL_MAX_EXP -- maximum int e such that radix**(e-1) is representable > | > | min_exp > | DBL_MIN_EXP -- minimum int e such that r

Re: Bluetooth Sockets

2013-07-16 Thread Christian Heimes
Am 13.07.2013 10:53, schrieb Simfake Fake: > Hi. I'm trying to connect to a bluetooth serial adaptor using python > 3.x. However, in python 3.3.2 win x32, I get "AttributeError: module has > no attribute AF_..." when trying to use socket.AF_BLUETOOTH, despite the > docs http://docs.python.org/3.3/l

Re: How do I get the OS System Font Directory(Cross-Platform) in python?

2013-07-11 Thread Christian Heimes
Am 11.07.2013 19:19, schrieb Metallicow: > @ Chris “Kwpolska” Warrick > Thanks, that is a start anyway. > a Pure-Python way was what I was wanting, not win32api stuff. > > "C:\Windows\Fonts" > The windows path proves valid. Works on XP, Vista, 7. Not sure about win8? That's the wrong way to

Re: Casting classes WAS: Documenting builtin methods

2013-07-11 Thread Christian Heimes
Am 12.07.2013 02:23, schrieb Mark Janssen: > A user was wondering why they can't change a docstring in a module's class. For CPython builtin types (classes) and function have read-only doc strings for multiple reasons. Internally the doc strings are stored as constant C string literals. The __doc_

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-12 Thread Christian Heimes
Am 13.05.2013 01:23, schrieb Mr. Joe: > I seem to stumble upon a situation where "!=" operator misbehaves in > python2.x. Not sure if it's my misunderstanding or a bug in python > implementation. Here's a demo code to reproduce the behavior - > """ Python 2.7 doesn't use the negation of __eq__ whe

Re: object.enable() anti-pattern

2013-05-08 Thread Christian Heimes
Am 08.05.2013 10:52, schrieb Steven D'Aprano: > Basically, any time you have two steps required for using an object, e.g. > like this: > > obj = someobject(arg1, arg2) > obj.enable() > > you should move the make-it-work functionality out of the enable method > and into __init__ so that creating

Re: Red Black Tree implementation?

2013-05-02 Thread Christian Heimes
Am 02.05.2013 01:11, schrieb Dan Stromberg: > > What's the best Red Black Tree implementation for Python with an > opensource license? > > I started out looking at > http://newcenturycomputers.net/projects/rbtree.html > because it was > prett

Re: Parsing soap result

2013-04-17 Thread Christian Heimes
Am 17.04.2013 19:55, schrieb darnold: > On Apr 17, 8:50 am, Ombongi Moraa Fe > wrote: > >> how do I use xml.etree.ElementTree to print the parameters address and >> deliveryStatus? Or is there a better python method? >> > > > I'm sure there are prettier ways to do this, but you can use XPath >

Re: Surrogate pairs in new flexible string representation

2013-03-29 Thread Christian Heimes
Am 29.03.2013 07:22, schrieb Ian Kelly: > Since the PEP specifically mentions ParseTuple string conversion, I am > thinking that this is probably the motivation for caching it. A > string that is passed into a C function (that uses one of the various > UTF-8 char* format specifiers) is perhaps lik

Re: Interesting list() un-optimization

2013-03-07 Thread Christian Heimes
Am 07.03.2013 17:00, schrieb Ian Kelly: > On Thu, Mar 7, 2013 at 4:22 AM, Wolfgang Maier > wrote: >> Well, it skips the costly len() call because your iter(Foo()) returns >> iter(range()) under the hood and list() uses that object's __len__() method. > > Iterators do not generally have __len__ me

Re: Python Speed

2013-02-27 Thread Christian Heimes
Am 27.02.2013 23:24, schrieb Terry Reedy: > On 2/27/2013 3:21 AM, jmfauth hijacked yet another thread: >> Some are building, some are destroying. > > We are still waiting for you to help build a better 3.3+, instead of > trying to 'destroy' it with mostly irrelevant cherry-picked benchmarks. PEP

Re: python 3 problem: how to convert an extension method into a class Method

2013-02-26 Thread Christian Heimes
Am 26.02.2013 21:19, schrieb Ethan Furman: > Dumb question, but have you tried just assigning it? In Py3 methods are > just normal functions... > > 8<-- > class A(): > pass > > A.method = c_method > 8<-- That doesn't work with builtin functions

Re: subclassable types

2013-02-22 Thread Christian Heimes
Am 22.02.2013 10:35, schrieb Wolfgang Maier: > Also: can you use introspection to find out whether a type is valid as a > base type? I don't think so. For CPython the information is stored in the type's structure. When type->tp_flags & Py_TPFLAGS_BASETYPE is true then subclassing is allowed. But I

Re: Need some help confirming transactions using sha256

2013-02-01 Thread Christian Heimes
Am 31.01.2013 18:55, schrieb Peter Pearson: txid = 'r7A7clvs9waizF+6QEiI0tgAq1ar48JItK3kg9kaeAFXz2vsMsHmOd9r9fhkmtxTz3CQnGAPMaDeKLvgb1A2VA' secret = '10812806653842663997bf5971637f86f26c71a4716276d7fa8f323a83588d91:1' hashlib.sha256(txid+":"+secret).hexdigest() > 'dfa8769

Re: Any built-in ishashable method ?

2013-01-18 Thread Christian Heimes
Am 18.01.2013 12:56, schrieb Jean-Michel Pichavant: > You guessed right. But it took me a lot of time before jumping to that > conclusion, mostly because the code worked in the first place (it can with a > little bit of luck). > Now I'm extra careful about what I use as dict key, I was just wonde

Re: Compiling native extensions with Visual Studio 2012?

2013-01-15 Thread Christian Heimes
Am 12.01.2013 17:06, schrieb Alec Taylor: > Would be awesome to get these built into stdlib. > > Compiling my own versions mostly for virtualenv purposes; though > sometimes I can't find the binary on: > http://www.lfd.uci.edu/~gohlke/pythonlibs/ Let's see. I've 10 months to work on the PEP + imp

Re: Compiling native extensions with Visual Studio 2012?

2013-01-12 Thread Christian Heimes
Am 12.01.2013 08:45, schrieb Alec Taylor: > There have been various threads for MSVC 2010[1][2], but the most > recent thing I found for MSVC 2012 was [3]… from 6 months ago. > > Basically I want to be able to compile bcrypt—and yes I should be > using Keccak—x64 binaries on Windows x64. > > Ther

Re: how to detect the encoding used for a specific text data ?

2012-12-20 Thread Christian Heimes
Am 20.12.2012 12:57, schrieb iMath: > how to detect the encoding used for a specific text data ? You can't. It's not possible unless the file format can specify the encoding somehow, e.g. like XML's header . Sometimes you can try and make an educated guess. But it's just a guess and it may give

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Christian Heimes
Am 19.12.2012 16:01, schrieb Stefan Krah: > The uppercase ß isn't really needed, since ß does not occur at the beginning > of a word. As far as I know, most Germans wouldn't even know that it has > existed at some point or how to write it. I think Python 3.3+ is using uppercase mapping (uc) instea

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Christian Heimes
Am 19.12.2012 15:23, schrieb wxjmfa...@gmail.com: > But, this is not the problem. > I was suprised to discover this: > 'Straße'.upper() > 'STRASSE' > > I really, really do not know what I should think about that. > (It is a complex subject.) And the real question is why? It's correct. LATIN

Re: What are the minimum requirements to get a job in?

2012-12-14 Thread Christian Heimes
Am 14.12.2012 04:25, schrieb Greg Donald: > On Thu, Dec 13, 2012 at 8:49 PM, wrote: >> My aim is to get a job into google or cisco or facebok. > > I made it to the 4th interview with Google. When they say they want a > "developer" they really mean they want a developer/sysadmin/kernel > hacker/

Re: Imaging libraries in active development?

2012-11-29 Thread Christian Heimes
Am 28.11.2012 22:11, schrieb Jorgen Grahn: > I thought those formats were dead since about a decade? (Ok, I know > TIFF has niches, but JPEG 2000?) Baseline TIFF is still used a lot when a lossless image format is required. It's widely used for scientific stuff, long-time preservation, health car

Re: Imaging libraries in active development?

2012-11-28 Thread Christian Heimes
Am 28.11.2012 19:14, schrieb Michael Torrie: > I'm curious. What features do you need that pil doesn't have? Other > than updating pil to fix bugs, support new image types or new versions > of Python, what kind of active development do you think it needs to > have? Maybe pil has all the features

Re: Generate unique ID for URL

2012-11-13 Thread Christian Heimes
Am 14.11.2012 01:50, schrieb Richard: > These URL ID's would just be used internally for quick lookups, not exposed > publicly in a web application. > > Ideally I would want to avoid collisions altogether. But if that means > significant extra CPU time then 1 collision in 10 million hashes would

Re: Generate unique ID for URL

2012-11-13 Thread Christian Heimes
Am 14.11.2012 01:41, schrieb Richard Baron Penman: > I found the MD5 and SHA hashes slow to calculate. > The builtin hash is fast but I was concerned about collisions. What > rate of collisions could I expect? Seriously? It takes about 1-5msec to sha1() one MB of data on a modern CPU, 1.5 on my bo

Re: Generate unique ID for URL

2012-11-13 Thread Christian Heimes
Am 14.11.2012 01:26, schrieb Chris Kaynor: > One option would be using a hash. Python's built-in hash, a 32-bit > CRC, 128-bit MD5, 256-bit SHA or one of the many others that exist, > depending on the needs. Higher bit counts will reduce the odds of > accidental collisions; cryptographically secure

Re: Missing modules compiling python3.3

2012-11-04 Thread Christian Heimes
Am 04.11.2012 15:42, schrieb Giacomo Alzetta: > I'm trying to compile python3.3 on my (K)ubuntu 12.04, but some modules are > missing. > > In particular when doing make test I get: > > Python build finished, but the necessary bits to build these modules were not > found: > _bz2 _c

Re: bit count or bit set && Python3

2012-10-25 Thread Christian Heimes
Am 25.10.2012 16:47, schrieb Charles Hixson: > In Python3 is there any good way to count the number of on bits in an > integer (after an & operation)? Simple, easy, faster than a Python loop but not very elegant: bin(number).count("1") Christian -- http://mail.python.org/mailman/listinfo/

Re: Compiler Error for build Python -3.3.0 (Suggestions)

2012-10-22 Thread Christian Heimes
Am 22.10.2012 23:31, schrieb Joe Davis: >The version of Python I have on my old Solaris boxes is old and > isn't supported and dosn't have all the modules that I need.I have > downloaded the new 3.3 version and have been trying to compile it and > have no luck: > > After running the ./conf

[ann] pysha3 0.2.1 released

2012-10-06 Thread Christian Heimes
Hello, today I've released pysha3 0.2.1 [1]. It's a standalone version of the SHA-3 extension that I merged into CPython's development branch (future 3.4) a couple of hours ago. It provides the Keccak [2] cryptographic hashing algorithm that was officially selected as SHA-3 by NIST a four days ago

Re: instance.attribute lookup

2012-10-05 Thread Christian Heimes
Am 05.10.2012 19:39, schrieb Ethan Furman: > I'm thinking step 1 is flat-out wrong and doesn't exist. Does anybody > know otherwise? The answer is confusing and also wrong. For instance it ignores the existence of __slots__, metaclasses and the different lookup strategy of __special__ methods in

Re: [RELEASED] Python 3.3.0

2012-09-29 Thread Christian Heimes
Am 29.09.2012 15:42, schrieb Andriy Kornatskyy: > > The following doctest fails with python3.3 (it is okay for python2.4-2.7, > 3.2). > > class adict(dict): > > """

Re: what is the difference between st_ctime and st_mtime one is the time of last change and the other is the time of last modification, but i can not understand what is the difference between 'change'

2012-09-28 Thread Christian Heimes
Am 28.09.2012 17:07, schrieb Chris Angelico: > On Fri, Sep 28, 2012 at 11:12 PM, 陈伟 wrote: >> >> -- >> http://mail.python.org/mailman/listinfo/python-list > > In future, can you put the body of your message into the body please? :) > > ctime is creation time, not change time. mtime is modificati

Re: How to limit CPU usage in Python

2012-09-20 Thread Christian Heimes
Am 20.09.2012 17:12, schrieb Rolando Cañer Roblejo: > Hi all, > > Is it possible for me to put a limit in the amount of processor usage (% > CPU) that my current python script is using? Is there any module useful > for this task? I saw Resource module but I think it is not the module I > am lookin

Re: How to get the list of all my open file(descriptor)s and locks?

2012-09-19 Thread Christian Heimes
Am 19.09.2012 19:34, schrieb Ismael Farfán: > Hello list > > From man 2 EXECVE > "By default, file descriptors remain open across an execve()" > > And from man 2 FCNTL > "Record locks are... preserved across an execve(2)." > > So the question: > * If I execve a python script (from C), how can I

Re: Least-lossy string.encode to us-ascii?

2012-09-13 Thread Christian Heimes
Am 13.09.2012 23:26, schrieb Tim Chase: > I've got a bunch of text in Portuguese and to transmit them, need to > have them in us-ascii (7-bit). I'd like to keep as much information > as possible, just stripping accents, cedillas, tildes, etc. So > "serviço móvil" becomes "servico movil". Is ther

Re: The opener parameter of Python 3 open() built-in

2012-09-03 Thread Christian Heimes
Am 03.09.2012 14:32, schrieb Marco: > Does anyone have an example of utilisation? The opener argument is a new 3.3 feature. For example you can use the feature to implement exclusive creation of a file to avoid symlink attacks. import os def opener(file, flags): return os.open(file, flags |

Re: proper reply format

2012-08-24 Thread Christian Heimes
Am 24.08.2012 22:31, schrieb Ethan Furman: > Just having Willem's name at the top was confusing. Also, because you > didn't trim his signature, the rest of your reply looked like a > signature to Thunderbird (which uses a line of '--' to figure the start > of signatures). As you can see, the rest

Re: New image and color management library for Python 2+3

2012-08-20 Thread Christian Heimes
Am 19.08.2012 19:35, schrieb Jan Riechers: > I'm sorry for getting out of your initial question/request, but did you > try out ImageMagick before making use of FreeImage - do you even perhaps > can deliver a comparison between your project and ImageMagick (if > regular Python is used)? > > I ask c

Re: Python 2.7 import socket urllib fails to load, module not found

2012-08-17 Thread Christian Heimes
Am 17.08.2012 21:20, schrieb wdt...@comcast.net: > Just installed python 2.7 and using with web2py. > > When running python from command line to bring up web2py server, get errors > that python socket and urllib modules cannot be found, can't be loaded. This > is not a web2py issue. > > No ot

Re: email with a non-ascii charset in Python3 ?

2012-08-15 Thread Christian Heimes
Am 15.08.2012 14:16, schrieb Helmut Jarausch: > Hi, > > I'm sorry to ask such a FAQ but still I couldn't find an answer - neither in > the docs nor the web. > > What's wrong with the following script? > > Many thanks for a hint, > Helmut. > > #!/usr/bin/python3 > #_*_ coding: latin1 _*_ > > i

New image and color management library for Python 2+3

2012-08-14 Thread Christian Heimes
Hello fellow Pythonistas, I'm looking for co-developers, testers, documentation writers and users for a new image library I created. The code is available at https://bitbucket.org/tiran/smc.freeimage Background story: I'm working for a company that creates Python based solutions for libraries --

Re: Pickle file and send via socket

2012-08-06 Thread Christian Heimes
ckle.html#module-pickle Warning The pickle module is not intended to be secure against erroneous or maliciously constructed data. Never unpickle data received from an untrusted or unauthenticated source. Christian Heimes -- http://mail.python.org/mailman/listinfo/python-list

Re: How to deal with python 32bit memory error

2012-07-24 Thread Christian Heimes
Am 24.07.2012 11:58, schrieb Dave Angel: > There are some limitations to 32 bits, that have nothing to do with > Python specifically. However, they have different impact, depending on > the environment you're running in. First and foremost, address are > 32bits, which limits them to 4gb of ram.

Re: How to represent dates BC

2012-07-24 Thread Christian Heimes
Am 24.07.2012 11:55, schrieb Laszlo Nagy: > What is the good representation here? Should I implement my own date > type? (I wouldn't want to.) JDN [1] is a commonly used format for wide ranges of dates. I've used it in the past to refer to days BC. PyPI offers a Python module [2] that looks well w

Re: Incorrect detection of futimesns/futimes in 3.3.0b1

2012-07-19 Thread Christian Heimes
Am 19.07.2012 11:03, schrieb RICHARD MOSELEY: > I am now considering providing a general patch to the configure.ac > file which will more correctly detect all the > various flavours of utimes (futimens, futimes, lutimes, futimesat, > utimensat and utimes) using a different che

  1   2   3   4   5   6   7   8   9   10   >