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: 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: 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: 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: 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: 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: 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: Read STDIN as bytes rather than a string

2012-06-18 Thread Christian Heimes
Am 19.06.2012 01:13, schrieb Jason Friedman: > I tried this: sys.stdin wraps a buffered reader which itself wraps a raw file reader. >>> sys.stdin <_io.TextIOWrapper name='' mode='r' encoding='UTF-8'> >>> sys.stdin.buffer <_io.BufferedReader name=''> >>> sys.stdin.buffer.raw <_io.FileIO name='' m

Re: Finding absolute path of imported module?

2012-06-19 Thread Christian Heimes
Am 19.06.2012 19:55, schrieb Roy Smith: > So, the question is, is there any way to dump all the *absolute* > pathnames of all the imported modules? I can iterate over > sys.modules.values(), but that doesn't give me absolute pathnames, so > I can't tell which version of the symlink existed when th

Re: Py3.3 unicode literal and input()

2012-06-20 Thread Christian Heimes
Am 18.06.2012 20:45, schrieb Terry Reedy: > The simultaneous reintroduction of 'ur', but with a different meaning > than in 2.7, *was* a problem and it should be removed in the next release. FYI: http://hg.python.org/cpython/rev/8e47e9af826e Christian -- http://mail.python.org/mailman/listinfo/

Re: Is that safe to use ramdom.random() for key to encrypt?

2012-06-20 Thread Christian Heimes
Am 20.06.2012 17:25, schrieb D'Arcy Cain: > As "they" say, random number generation is too important to be left > to chance. :-) Hilarious! You made my day! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Introspect imports from module

2012-06-21 Thread Christian Heimes
Am 21.06.2012 10:03, schrieb Bastian Ballmann: > Any suggestions how I could just get the import of module.to.inspect? > Thanks && have a nice day! You could try a completely different approach and use the compiler package to inspect the abstract syntrax tree of a compiled module. The approach has

Re: how can I implement "cd" like shell in Python?

2012-06-28 Thread Christian Heimes
Am 28.06.2012 13:09, schrieb Sergi Pasoev: > Do you mean to implement the cd command ? To what extent do you want to > implement it ? if what you want is just to have a script to change the > current working directory, it is as easy as this: Please note that you can't change the working directory

Re: tiffany 0.6.1 released

2012-06-30 Thread Christian Heimes
Am 30.06.2012 18:25, schrieb Paul Rubin: > Christian Tismer writes: >> Tiffany stands for any tiff. The tiny module solves a large set of >> problems, has no dependencies and just works wherever Python works. >> Tiffany was developed in the course of the *DiDoCa* project and will >> always appear

Re: locals().update(...)

2012-07-04 Thread Christian Heimes
Am 04.07.2012 13:56, schrieb eis...@gmail.com: > I expected this to work: It doesn't work and that's documented: http://docs.python.org/library/functions.html?highlight=locals#locals -- http://mail.python.org/mailman/listinfo/python-list

Re: How to safely maintain a status file

2012-07-08 Thread Christian Heimes
Am 08.07.2012 13:29, schrieb Richard Baron Penman: > My initial solution was a thread that writes status to a tmp file > first and then renames: > > open(tmp_file, 'w').write(status) > os.rename(tmp_file, status_file) You algorithm may not write and flush all data to disk. You need to do addition

Re: How to safely maintain a status file

2012-07-08 Thread Christian Heimes
Am 08.07.2012 22:57, schrieb Laszlo Nagy: > But even if the rename operation is atomic, there is still a race > condition. Your program can be terminated after the original status file > has been deleted, and before the temp file was renamed. In this case, > you will be missing the status file (alt

Re: How to safely maintain a status file

2012-07-09 Thread Christian Heimes
Am 09.07.2012 07:50, schrieb Plumo: >> Windows doesn't suppport atomic renames if the right side exists. I >> suggest that you implement two code paths: > > Problem is if the process is stopped between unlink and rename there > would no status file. Yeah, you have to suffer all of Windows' design

Re: Python Interview Questions

2012-07-09 Thread Christian Heimes
Am 09.07.2012 23:22, schrieb Peter: > One of my favourite questions when interviewing - and it was 100% reliable > :-) - "what are your hobbies?" > > If the answer included programming then they were hired, if not, then they > went to the "B" list. on the contrary! When a potential candidate ha

Re: How to safely maintain a status file

2012-07-09 Thread Christian Heimes
Am 09.07.2012 22:24, schrieb John Nagle: > Rename on some file system types (particularly NFS) may not be atomic. The actual operation is always atomic but the NFS server may not notify you about success or failure atomically. See http://linux.die.net/man/2/rename, section BUGS. > That's b

Re: Python Interview Questions

2012-07-09 Thread Christian Heimes
Am 10.07.2012 01:40, schrieb Roy Smith: > Do you really want to make hire/no-hire decisions based on somebody's > ability to second-guess what you probably wanted to hear when you asked > a pointless question? I don't want her/him to second-guess at all. I expect a straight and honest answer. Se

Re: tiffany 0.6.1 released

2012-07-10 Thread Christian Heimes
Am 09.07.2012 17:51, schrieb Christian Tismer: > It turns out to be a problem with multiple strips in a tiff file. > PIL does not support that. Maybe I can find an easy solution, > maybe I'm better off using > > smc.freeimage > > as suggested by Christian Heimes, >

Re: Python Interview Questions

2012-07-10 Thread Christian Heimes
Am 10.07.2012 09:33, schrieb Steven D'Aprano: > This is why I hate job interviews. You have like 30 minutes, or even as > little as 30 seconds, to make a good impression on somebody who may or > may not be capable of telling the difference between a cheese sandwich > and a box of hair -- and eve

Re: How to safely maintain a status file

2012-07-12 Thread Christian Heimes
Am 12.07.2012 14:30, schrieb Laszlo Nagy: > This is not a contradiction. Although the rename operation is atomic, > the whole "change status" process is not. It is because there are two > operations: #1 delete old status file and #2. rename the new status > file. And because there are two operation

Re: How to safely maintain a status file

2012-07-12 Thread Christian Heimes
Am 12.07.2012 19:43, schrieb Laszlo Nagy: > Well, I didn't know that this is going to work. At least it does not > work on Windows 7 (which should be POSIX compatible?) Nope, Windows's file system layer is not POSIX compatible. For example you can't remove or replace a file while it is opened by a

Re: [Python] RE: How to safely maintain a status file

2012-07-13 Thread Christian Heimes
Am 13.07.2012 21:57, schrieb MRAB: > It's possible to create a temporary file even in Windows. Windows has a open() flag named O_TEMPORARY for temporary files. With O_TEMPORARY the file is removed from disk as soon as the file handle is closed. On POSIX OS it's common practice to unlink temporary

Re: How to safely maintain a status file

2012-07-14 Thread Christian Heimes
Am 13.07.2012 03:52, schrieb Steven D'Aprano: > And some storage devices (e.g. hard drives, USB sticks) don't actually > write data permanently even when you sync the device. They just write to > a temporary cache, then report that they are done (liar liar pants on > fire). Only when the cache i

Re: assertraises behaviour

2012-07-16 Thread Christian Heimes
Am 16.07.2012 15:38, schrieb andrea crotti: > This small example doesn't fail, but the OSError exception is cathed > even if not declared.. > Is this the expected behaviour (from the doc I would say it's not). > (Running on arch-linux 64 bits and Python 2.7.3, but it doesn the same > with Python 3.

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

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

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

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: 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: 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: 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: 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: 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: 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: 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: [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: 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

[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: 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

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: 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: 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: 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: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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: Question about name scope

2012-02-01 Thread Christian Heimes
Am 01.02.2012 18:36, schrieb Dave Angel: > def f(a): > from math import sin, cos > return sin(a) + cos(a) > > print f(45) > > Does what you needed, and neatly. The only name added to the global > namspace is f, of type function. I recommend against this approach. It's slightly slower an

Re: PyCrypto builds neither with MSVC nor MinGW

2012-02-05 Thread Christian Heimes
Am 05.02.2012 15:40, schrieb Alec Taylor: > PIL, PyCrypto and many other modules require a C compiler and linker. > > Unfortunately neither install on my computer, with a PATH with the following: > > C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC > C:\libraries\MinGW\msys\1.0\bin > C:\lib

Re: How can I catch misnamed variables?

2012-02-10 Thread Christian Heimes
Am 10.02.2012 22:06, schrieb John Gordon: > Is there an automated way to catch errors like these? I'm using the > compileall module to build my program and it does catch some errors > such as incorrect indentation, but not errors like the above. Write unit tests and use coverage to aim for 100% c

Re: Python usage numbers

2012-02-12 Thread Christian Heimes
Am 12.02.2012 23:07, schrieb Terry Reedy: > But because of the limitation of ascii on a worldwide, as opposed to > American basis, we ended up with 100-200 codings for almost as many > character sets. This is because the idea of ascii was applied by each > nation or language group individually to t

Re: Python math is off by .000000000000045

2012-02-22 Thread Christian Heimes
Am 22.02.2012 19:13, schrieb Alec Taylor: > Simple mathematical problem, + and - only: > 1800.00-1041.00-555.74+530.74-794.95 > -60.9500045 > > That's wrong. That's only the correct answer for unlimited precision, not for IEEE-754 semantics. http://en.wikipedia.org/wiki/IEEE_754 >

Re: How to re-implement the crypt.crypt function?

2012-03-10 Thread Christian Heimes
Am 10.03.2012 20:33, schrieb Cosmia Luna: > I'm not searching for a full solution and only want to know how to use > hashlib to create a equivalent string like If you chance your mind and choose to use a full solution, then I highly recommend passlib [1]. It has an implementation of SHA-512 cryp

Re: How to re-implement the crypt.crypt function?

2012-03-10 Thread Christian Heimes
Am 10.03.2012 21:15, schrieb Roy Smith: > By today's standards, the algorithm isn't considered very strong. The > only place I'm aware that uses it is unix password files, and even there > many (most?) systems have replaced it with something stronger such as > SHA1. Maybe Apache .htaccess file

Re: How to re-implement the crypt.crypt function?

2012-03-10 Thread Christian Heimes
Am 10.03.2012 21:41, schrieb Roy Smith: > But is that what crypt.crypt() does? I though it implemented the > old-style triple-DES. Python's crypt module is an interface to the OS' crypt() function. On some systems the crypt() function supports additional algorithms. You can read it up in the not

Re: urllib.urlretrieve never returns???

2012-03-17 Thread Christian Heimes
Am 17.03.2012 15:13, schrieb Laszlo Nagy: > See attached example code. I have a program that calls exactly the same > code, and here is the strange thing about it: > > * Program is started as "start.py", e.g. with an open console. In this > case, the program works! > * Program is started a

Re: python segfault

2012-03-27 Thread Christian Heimes
Am 28.03.2012 00:27, schrieb Michael Poeltl: > hi, > > can anybody tell why this 'little stupid *thing* of code' let's python-3.2.2, > 2.6.X or python 2.7.2 segfault? The code segfaults because you have increased the recursion limit. The amount of recursions is limited by the stack size. A C pro

Re: Problem connecting to SMTP/IMAP server using SSL

2012-04-12 Thread Christian Heimes
Am 12.04.2012 08:56, schrieb Julien Phalip: > Hi Michael, > > Thanks again for your reply. I've tried using SMTP with TLS. And again > it works with the VPN turned on but it still won't work with the VPN > turned off. For some reason I don't understand, it simply won't > instantiate the SMTP/SMTP_

Re: Newbie naive question ... int() throws ValueError

2012-05-11 Thread Christian Heimes
Am 11.05.2012 17:51, schrieb Terry Reedy: > If the domain of a function is truly all Python objects, it cannot raise > an error. I believe id(x) is such an example. Even id() can raise an exception, for example MemoryError when you are running out of memory. Christian -- http://mail.python.org/

Re: Good data structure for finding date intervals including a given date

2012-05-14 Thread Christian Heimes
Am 12.05.2012 14:17, schrieb Jean-Daniel: > Hello, > > I have a long list of n date intervals that gets added or suppressed > intervals regularly. I am looking for a fast way to find the intervals > containing a given date, without having to check all intervals (less > than O(n)). > > Do you know

Re: Hashability questions

2012-05-14 Thread Christian Heimes
Am 13.05.2012 21:11, schrieb Bob Grommes: > Noob alert: writing my first Python class library. > > I have a straightforward class called Utility that lives in Utility.py. > > I'm trying to get a handle on best practices for fleshing out a library. As > such, I've done the following for starters

Re: Hashability questions

2012-05-15 Thread Christian Heimes
Am 15.05.2012 07:27, schrieb Ian Kelly: > Why? I can't see any purpose in implementing __eq__ this way, but I > don't see how it's "broken" (assuming that __hash__ is actually > implemented somehow and doesn't just raise TypeError). The > requirement is that if two objects compare equal, then the

Re: install python 2.6 on Ubuntu 12.04

2012-05-23 Thread Christian Heimes
Am 23.05.2012 02:51, schrieb Benjamin Kaplan: > Even easier: > > ./configure > make > sudo make altinstall > > If I recall correctly, that will install it in > /usr/local/lib/python2.6 and it will create /usr/local/bin/python2.6 > but it will not create /usr/local/bin/python so it won't clobber t

Re: install python 2.6 on Ubuntu 12.04

2012-05-23 Thread Christian Heimes
Am 23.05.2012 09:40, schrieb Christian Heimes: > You recall correctly. That's the recommended and correct way to install > Python 2.6 on a recent machine, with one exception. You must compile it > with the option MACHDEP=linux2, otherwise sys.platform will contain the > string

Re: PEP 405 vs 370

2012-05-25 Thread Christian Heimes
Am 25.05.2012 21:45, schrieb Damjan Georgievski: > http://www.python.org/dev/peps/pep-0405/ > > I don't get what PEP 405 (Python Virtual Environments) brings vs what we > already had in PEP 370 since Python 2.6. My PEP 370 is about installing additional packages as an unprivileged user and for th

Re: PIL threading problems

2012-05-30 Thread Christian Heimes
Am 30.05.2012 05:09, schrieb Paul Rubin: > Kind of a long shot, but are there known problems in calling PIL from > multiple threads? I'm getting weird intermittent core dumps from my > app, no idea what's causing them, but PIL is the only C module I'm > using, and I do see some mention on the inte

Re: Compare 2 times

2012-06-06 Thread Christian Heimes
Am 06.06.2012 14:50, schrieb loial: > I have a requirement to test the creation time of a file with the > current time and raise a message if the file is more than 15 minutes > old. > > Platform is Unix. > > I have looked at using os.path.getctime for the file creation time and > time.time() for

Re: network protocols

2012-06-13 Thread Christian Heimes
Am 13.06.2012 13:41, schrieb Tarek Ziadé: > Hey > > I was surprised not to find any way to list all protocol names listed in > /etc/protocols in Python > > We have > > socket.getprotobyname(NAME) > > But there's no way to get the list of names > > Any ideas if this is available in the stdlib s

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Christian Heimes
Am 12.06.2012 11:39, schrieb Gilles: > I notice that Python-based solutions are usually built as long-running > processes with their own web server (or can run in the back with eg. > Nginx and be reached through eg. FastCGI/WSGI ) while PHP is simply a > language to write scripts and requires a web

Re: network protocols

2012-06-13 Thread Christian Heimes
Am 13.06.2012 16:56, schrieb Christian Heimes: > Am 13.06.2012 13:41, schrieb Tarek Ziadé: >> Hey >> >> I was surprised not to find any way to list all protocol names listed in >> /etc/protocols in Python >> >> We have >> >> socket.getprotobynam

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Christian Heimes
Am 13.06.2012 22:48, schrieb Gilles: > On Wed, 13 Jun 2012 17:27:21 +0200, Christian Heimes > wrote: >> A long running process has lots of benefits that makes design and >> development easier and makes your app faster. > > Thanks much for the infos. Makes you wonder

Re: Academic citation of Python

2012-06-16 Thread Christian Heimes
Am 16.06.2012 22:44, schrieb Terry Reedy: > Rossum, Guido van, et al, *The Python Language Reference*, Python > Software Foundation; http://docs.python.org/py3k/reference/index.html Actually it's "van Rossum, Guido", not "Rossum, Guido van". The "van" is part of the family name, not a middle name.

Re: Python 3.3.0a4, please add ru'...'

2012-06-17 Thread Christian Heimes
Am 16.06.2012 19:36, schrieb jmfauth: > Please consistency. Python 3.3 supports the ur"" syntax just as Python 2.x: $ ./python Python 3.3.0a4+ (default:4c704dc97496, Jun 16 2012, 00:06:09) [GCC 4.6.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> ur"" '' [739

Re: Python 3.3.0a4, please add ru'...'

2012-06-17 Thread Christian Heimes
Am 17.06.2012 14:11, schrieb jmfauth: > I noticed this at the 3.3.0a0 realease. > > The main motivation for this came from this: > http://bugs.python.org/issue13748 > > PS I saw the dev-list message. > > PS2 Opinion, if not really useful, consistency nver hurts. We are must likely drop the ur""

Re: How good is security via hashing

2011-06-07 Thread Christian Heimes
Am 07.06.2011 20:26, schrieb Terry Reedy: > On 6/7/2011 7:35 AM, Robin Becker wrote: > >> I guess what I'm asking is whether any sequence that's using random to >> generate random numbers is predictable if enough samples are drawn. > > Apparently so. random.random is *not* 'cryptographically secu

Re: os.path and Path

2011-06-16 Thread Christian Heimes
Am 16.06.2011 18:16, schrieb Ethan Furman: > Steven D'Aprano wrote: >> If Path is intended to be platform independent, then >> these two paths could represent the same location: >> >> 'a/b/c:d/e' # on Linux or OS X >> 'a:b:c/d:e' # on classic Mac pre OS X >> >> and be impossible on Windows. So w

Re: module problem on windows 64bit

2011-06-27 Thread Christian Heimes
Am 27.06.2011 19:02, schrieb Peter Irbizon: > Hello, > > on 32-bit windows everything works ok but on 64-bit win I am getting > this error: > Traceback (most recent call last): > File "app.py", line 1040, in do_this_now > File "kinterbasdb\__init__.pyc", line 119, in > File "kinterbasdb\_kinte

Re: module problem on windows 64bit

2011-06-28 Thread Christian Heimes
Am 27.06.2011 22:03, schrieb Peter Irbizon: > well, my program exe generated from py2exe. I am running Python 2.7 on my > win xp 32bit box then I compile my application with py2exe. After that I can > use it on other computers (on 32bit everything works perfect) but on 64 bit > windows I am getting

Re: module problem on windows 64bit

2011-06-28 Thread Christian Heimes
Am 28.06.2011 14:59, schrieb Peter Irbizon: > yes, that's right. but I am using embedable version of fbclient.dll so I > don't need to install Firebird Sql Server package. all dlls are in my > program folder even so it does not work. fbclient.dll may depend on more DLLs. Dependency walker is a gre

Re: using an instance of Object as an empty class

2011-06-29 Thread Christian Heimes
Am 29.06.2011 16:58, schrieb Ulrich Eckhardt: > Now, follow-up question: > 1. The slots are initialized to None, right? Or are they just reserved? IOW, > would "print a.x" right after creation of the object print anything or raise > an AttributeError? No, slots don't have a default value. It wou

Re: How to get a dateiled process information on windows?

2011-07-01 Thread Christian Heimes
Am 01.07.2011 22:06, schrieb Leandro Ferreira: > I need to write an application that monitors the memory consumption of > a process, there is some library that facilitates this work? > I searched on google found nothing more interesting. Have a look at psutil http://code.google.com/p/psutil/ . It

Re: Extracting property getters from dir() results

2011-07-06 Thread Christian Heimes
Am 06.07.2011 11:02, schrieb Gnarlodious: > Using introspection, is there a way to get a list of "property > getters"? > > Does this: > > vars=property(getVars(), "Dump a string of variables and values") > > have some parsable feature that makes it different from other > functions? Or would I ne

Re: Large number multiplication

2011-07-06 Thread Christian Heimes
Am 06.07.2011 21:30, schrieb Billy Mays: > I was looking through the python source and noticed that long > multiplication is done using the Karatsuba method (O(~n^1.5)) rather > than using FFTs O(~n log n). I was wondering if there was a reason the > Karatsuba method was chosen over the FFT con

Re: Large number multiplication

2011-07-06 Thread Christian Heimes
Am 06.07.2011 22:15, schrieb Billy Mays: > I believe it is possible to do FFTs without significant rounding error. > I know that the GIMPS's Prime95 does very large multiplications using > FFTs (I don't know if they use the integer based or double based > version). I also know they have guard

Re: how to get a list of all the hosts on the intranet around my workstation?

2011-07-16 Thread Christian Heimes
Am 16.07.2011 21:13, schrieb Dan Stromberg: > Some options: > > 1) Broadcast ping > 2) nmap the subnet, optionally with -P0 > 3) Check the arp cache (optionally after options 1, 2 or 4) > 4) Unicast ping everything on the subnet in parallel - very effective, very > fast, might want to do it with t

Re: problem in compiling the module in VC2010

2011-07-20 Thread Christian Heimes
Am 20.07.2011 17:33, schrieb llwa...@gmail.com: > Hi all, > I am compiling the example with MCVS2010 VC 2010 is not officially supported. Christian -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >