Re: Good debugger for CPython 3.2?

2012-10-19 Thread Dan Stromberg
On Fri, Oct 19, 2012 at 9:26 AM, Dan Stromberg wrote: > > What's a good debugger for CPython 3.2? I'd prefer to use it on Linux > Mint 13, and I'd be happy with something based on X11 or curses. > > I tried winpdb, but it was cranky that Linux didn't have a

while expression feature proposal

2012-10-24 Thread Dan Loewenherz
BLOCK VAR = EXPR I'm curious what the possibility of adding the following to Python as syntactic sugar: while EXPR as VAR: BLOCK Apologies if that has been proposed before. I searched the archives and couldn't find any mention of it. Best, Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: bit count or bit set && Python3

2012-10-25 Thread Dan Stromberg
On Thu, Oct 25, 2012 at 9:24 AM, Mark Lawrence wrote: > On 25/10/2012 15:47, Charles Hixson wrote: > >> In Python3 is there any good way to count the number of on bits in an >> integer (after an & operation)? >> Alternatively, is there any VERY light-weight implementation of a bit >> set? I'd pre

Re: while expression feature proposal

2012-10-25 Thread Dan Loewenherz
o in one of my projects, since it makes things harder to understand. So all in all, it's a net negative from just doing things the canonical way (with the while / assignment pattern). Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: while expression feature proposal

2012-10-26 Thread Dan Loewenherz
On Thursday, October 25, 2012 11:06:01 PM UTC-7, Paul Rubin wrote: > Dan Loewenherz writes: > > > In this case, profile_id is "None" when the loop breaks. It would be > > > much more straightforward (and more Pythonic, IMO), to write: > > > > >

Re: while expression feature proposal

2012-10-26 Thread Dan Loewenherz
quot;profile_ids") # conditional succeeds, '123' passed to profile_id '123', True >>> client.spop("profile_ids") # conditional succeeds, '' passed to profile_id '', True >>> client.spop("profile_ids") # conditional fails '', False Dan -- http://mail.python.org/mailman/listinfo/python-list

Building python, bz2 coming up missing

2012-11-21 Thread Dan Stromberg
I'm attempting to build cpython 2.{5,6,7} and cpython 3.[0,1,2,3}. I find that having them all around facilitates interversion testing and discovering what works in which versions. Anyway, in 3.3, I'm getting a bz2 module, but in 3.2, I'm not - but only when compiling on Linux Mint 14. On Linux

Re: Building python, bz2 coming up missing

2012-11-21 Thread Dan Stromberg
On Wed, Nov 21, 2012 at 12:18 PM, Dan Stromberg wrote: > > I'm attempting to build cpython 2.{5,6,7} and cpython 3.[0,1,2,3}. I find > that having them all around facilitates interversion testing and > discovering what works in which versions. > > Anyway, in 3.3, I'

Re: Brython - Python in the browser

2012-12-22 Thread Dan Sommers
iplication as a mathematical use of the asterisk. Until recently, the number of characters available to a programming language was limited (APL notwithstanding). Practicality beat (paste tense) purity. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Thought of the day

2013-01-14 Thread Dan Sommers
umented, then that policy extends to stepping on (or not stepping on) the memory of other threads, too. The APIs for threads and processes is pretty much the same, so I suppose it doesn't matter much, either. Use the right tool for the job. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Dan Sommers
Unicode handling. Also, demand that names be one character long, to > enforce creativity by the Mark Rosewater principle. We will then have a > truly wonderful language; everything will be so utterly readable. I think we did that once. We called it APL. ;-) Dan -- http://mail.python.org/

Re: Python modules

2013-01-14 Thread Dan Sommers
now you have two names for every function within scipy. The functions themselves are not duplicated. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Dan Sommers
Foo inherits from Baz and be done with it: phylum Foo(Baz): pass > That is SO much clearer ;-) For some definitions of "SO" and "much," yes. ;-) Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Param decorator - can you suggest improvements

2013-01-17 Thread Dan Sommers
alled Pocket. And the sentinel may have been None, but then you can't set the value to None (at least not through the apparent API). Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Param decorator - can you suggest improvements

2013-01-18 Thread Dan Sommers
On Fri, 18 Jan 2013 09:10:34 +, Steven D'Aprano wrote: > On Fri, 18 Jan 2013 03:38:08 +0000, Dan Sommers wrote: >> This, or something like this, is very old: >> >> sentinel = object() >> class Magic: >> def __init__(self, value): >>

Re: Where to put data

2012-01-26 Thread Dan Stromberg
I think that /usr/*/python-whatever/site-packages and related directories are very much overused in the python world, and tend to cause problems eventually - EG when you need to install two versions of a program on the same machine, same interpreter. I prefer to provide a configure script that acc

Re: what is the unicode?

2012-01-28 Thread Dan Sommers
CJK ideographs. >>>> u'中国' > u'\u4e2d\u56fd' > > what is the meaning of u'\u4e2d\u56fd'? u'\u4e2d\u56fd' = \x4e2d\x56fd > ?? Those are the "code points" of those characters. Unicode assigns code point, which

simple system for building packages for multiple platforms?

2012-02-01 Thread Dan Goodman
ances and submitting build jobs to these, but setting that up looks to be a lot of work and I guess many people have had this problem before. So, what do other people do? Also, once we have a build system up, I guess it can also be used for a more extensive testing system on these multiple platf

Re: Python usage numbers

2012-02-12 Thread Dan Sommers
ASCII these days. I imagine that even Steven's surname should be spelled D’Aprano rather than D'Aprano. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: [semi OT]: Smartphones and Python?

2012-02-20 Thread Dan Stromberg
On Wed, Feb 15, 2012 at 3:36 PM, Paul Rubin wrote: > Martin Schöön writes: > > A very quick internet search indicated that this should be no big > > deal if I go for an Android-based phone. What about the alternatives? > > It works pretty well with Maemo, though phones with that are not so easy

Re: How can I make an instance of a class act like a dictionary?

2012-02-27 Thread Dan Sommers
t would be better (and cleaner) simply to use the instance > itself as the dictionary, rather than have to go through an instance > variable. Check out the "Bunch" class: http://code.activestate.com/recipes/52308/ HTH, Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: lang comparison: in-place algorithm for reversing a list in Perl, Python, Lisp

2012-02-29 Thread Dan Stromberg
On Wed, Feb 29, 2012 at 8:07 PM, Xah Lee wrote: > fun example. > > in-place algorithm for reversing a list in Perl, Python, Lisp > http://xahlee.org/comp/in-place_algorithm.html > > plain text follows > > > What's “In-place Algorithm”? > > Xah Lee, 2012-02

Re: Parse cisco's "show ip route" output in Python 2.7

2012-03-04 Thread Dan Stromberg
I've done little with Ciscos, but what if you use individual things like "show ip ospf", "show ip rip database", etc. instead of "show ip route". Does that makes things a little more consistent? Often big problems are simpler if we can divide them into smaller, more manageable subproblems. On S

Re: Porting Python to an embedded system

2012-03-04 Thread Dan Stromberg
You might check out pymite. http://wiki.python.org/moin/PyMite Oh, but I'm now realizing that's part of the python on a chip project, so in a way it's already been mentioned. Anyway, PyMite, I gather, is a tiny python for microcontrollers. On Sun, Mar 4, 2012 at 2:58 AM, Justin Drake wrote: >

Re: Fast file data retrieval?

2012-03-12 Thread Dan Stromberg
If the ID's are sorted, you could probably rig a binary search using seek. This'll be easier if the records have a constant length, but it's still possible for variable-length, just messier. Otherwise you could stash them all in a dictionary (in memory) or anydbm (on disk) to get indexed access.

Re: cannot open shared object file

2012-03-16 Thread Dan Stromberg
A suggestion: 1) strace it. http://stromberg.dnsalias.org/~strombrg/debugging-with-syscall-tracers.html 2) Show the output to a C programmer, or take some educated guesses yourself. On Thu, Mar 15, 2012 at 11:47 PM, Steven Lo wrote: > ** > > Hi, > > We are getting the following error during a 'm

Re: Does anyone actually use PyPy in production?

2012-03-17 Thread Dan Stromberg
I personally feel that python-list should be restricted to discussing Python the language, not just CPython the implementation. Anyway, there are many kinds of production, no? But I use Pypy for my backups frequently, which is a form of production use. Pypy+backshift pass my automated tests as w

Re: best way to create warning for obsolete functions and call new one

2012-03-26 Thread Dan Sommers
You want a DeprecationWarning. HTH, Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-30 Thread Dan Sommers
A keystroke here, a keystroke there (those were the days *before* drag-and-drop and point-and-drool), and even managers and executives could "write programs." Now, of course, those managers and executives still command higher salaries, so I guess ChrisA is right about us assem

Re: How do I use PyGTK to put text besides clickable buttons?

2012-04-02 Thread Dan Stromberg
You could use an hbox. Or rather, a vbox with a bunch of hbox's in it. On Thu, Mar 29, 2012 at 10:45 PM, Jason Hsu, Mr. Swift Linux < jhsu802...@gmail.com> wrote: > I've decided to use PyGTK instead of gtkdialog for providing > configuration menus/dialog boxes in Swift Linux, the Linux distro I

Re: Python Gotcha's?

2012-04-05 Thread Dan Sommers
ng else in the language) and then scan for the a corresponding "punctuation, close" or "punctuation, final" character. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Dan Stromberg
You might try running your Python process with: strace -f -s 1024 -o /tmp/script.strace python /path/to/script.py Then you (perhaps with a C programmer) can likely track down what happened right before the crash by examining the system call tracer near the end of the file. http://stromberg.dns

Re: red-black tree data structure

2012-04-11 Thread Dan Stromberg
Bringing this back to Python a bit: http://newcenturycomputers.net/projects/rbtree.html http://pypi.python.org/pypi/bintrees/0.3.0 http://pypi.python.org/pypi/treap/0.995 Red-Black trees are supposed to be slower than treaps on average, but they're also supposed to have a lower standard deviation

Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread Dan Sommers
ost > programmers. And that's the difference between "serious programmers" and "most programmers." Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Zipping a dictionary whose values are lists

2012-04-12 Thread Dan Sommers
te works. What am I doing wrong? Try this: >>> list(zip(*d.values())) d.values() is a list, but zip wants the individual values as separate arguments. HTH, Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible develop applications in python for android and which IDE could you recommend me (Eclipse, ...)???

2012-04-12 Thread Dan Stromberg
http://code.google.com/p/android-scripting/ However, I've not used it, and I'm told it requires a stub for each new android method exposed to python. I find it a little regrettable that they didn't start frp, jython or pypy for jvm instead of cpython, to avoid all the stubbing. On Thu, Apr 12, 2

Re: Sockets accept() in child processes

2012-04-12 Thread Dan Stromberg
I wonder if this'll do what you need: https://trac.calendarserver.org/browser/CalendarServer/trunk/twext/python/sendfd.py On Thu, Apr 12, 2012 at 2:31 AM, Thibaut DIRLIK wrote: > Hi, > > I'm writing a multiprocess server with Python 3.2 and the multiprocessing > module. Here is my current impleme

Re: Problem connecting to SMTP/IMAP server using SSL

2012-04-12 Thread Dan Stromberg
Are you quite sure that your iPhone isn't using some sort of VPN? On my Android phone, I need a VPN client to access my work mail, but I install it once and forget about it; it doesn't require me to enter my password more than once. On Fri, Mar 30, 2012 at 10:39 PM, Julien wrote: > Hi, > > I'm

Re: Problem connecting to SMTP/IMAP server using SSL

2012-04-12 Thread Dan Stromberg
Maybe it's a matter of two different protocols, one requiring a VPN, one not. You could perhaps try a sniffer to check that out. Where to place the sniffer could be complicated though. On Fri, Mar 30, 2012 at 10:39 PM, Julien wrote: > Hi, > > I'm able to connect to an Exchange server via SMTP

Re: Sockets accept() in child processes

2012-04-12 Thread Dan Stromberg
On Thu, Apr 12, 2012 at 10:48 AM, Merwin wrote: > Le 12/04/2012 19:10, Dan Stromberg a écrit : > > >> I wonder if this'll do what you need: >> https://trac.calendarserver.**org/browser/CalendarServer/** >> trunk/twext/python/sendfd.py<https://trac.calendarserv

Re: Emacs Lisp vs Perl: Validate Local File Links

2012-04-13 Thread Dan Espen
of text for further analysis.» > > -- > > If you are a perl coder, and disagree, let me know your opinion. > (showing working code is very welcome) My comment about perl there > applies to python too. (python code welcome too.) Interesting. Perl, Python, and Lisp

Re: How to determine if IO redirection is occurring with the output from a Python program?

2012-04-18 Thread Dan Stromberg
On Tue, Apr 17, 2012 at 5:52 PM, Chris Angelico wrote: > > isatty() is supported on Windows (the underlying C API is different, > but the beauty of a high-level language is that you no longer need to > care), but the standard Windows console doesn't support ANSI > sequences. I think there is a wa

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Dan Stromberg
On Wed, Apr 18, 2012 at 7:02 AM, Richard Shea wrote: > On Apr 19, 1:56 am, Irmen de Jong wrote: > > On 18-4-2012 15:35, Richard Shea wrote: > > > > > ... which I think would work and be sufficiently flexible to deal with > > > alternatives to putty.exe but is there a more established (... > > >

Re: md5 check

2012-04-18 Thread Dan Sommers
cb42241d6837d20d24a814b81a1fe7f6d > gpg4win-2.1.0.exe please see :gpg4win-2.1.0.exe from > http://www.gpg4win.org/download.html Try opening the file in binary mode (untested): import md5 f=open('c:\gpg4win-2.1.0.exe','rb') # <-- look here print md5.new(f.read()).hexdigest() HTH, Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: md5 check

2012-04-18 Thread Dan Sommers
.0.exe from > http://www.gpg4win.org/download.html > > why ? Because f619313cb42241d6837d20d24a814b81a1fe7f6d is too long to be an md5 digest? According to that web page, it is an sha-1 digest. HTH, Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggest design to accomodate non-unix platforms ?

2012-04-19 Thread Dan Stromberg
On Wed, Apr 18, 2012 at 5:16 PM, Miki Tebeka wrote: > > So I'm interested in suggestions/examples where a user can update a > > config file to specify by which means they want (in this case) the ssh > > functionality to be supplied. > You can do something like that (it's called a factory): > > CO

Re: Suggest design to accomodate non-unix platforms ?

2012-04-20 Thread Dan Stromberg
On Thu, Apr 19, 2012 at 5:14 PM, Chris Angelico wrote: > The question then is whether to choose or auto-detect. Attempting to > auto-detect could be quite inefficient; imagine if you have to call on > ssh every couple of seconds, and something in $PATH is on a slow > network share (or on a floppy

Re: how many days in one year ?

2012-04-22 Thread Dan Sommers
> i can get there are 365 days in the 2003, > > is there other way,better way to calculate ? I think that this way is less prone to typos like the one above: import datetime year = 2003 d1 = datetime.date(year, 1, 1) d2 = datetime.date(year + 1, 1, 1) print (d2 - d1).days Dan --

Sort comparison

2012-04-30 Thread Dan Stromberg
A while back I did a sort algorithm runtime comparison for a variety of sorting algorithms, and then mostly sat on it. Recently, I got into a discussion with someone on stackoverflow about the running time of radix sort. I realize it's commonly said that radixsort is n*k rather than n*log(n). I'v

Re: Sort comparison

2012-05-01 Thread Dan Stromberg
On Tue, May 1, 2012 at 12:21 AM, Ian Kelly wrote: > On Mon, Apr 30, 2012 at 11:25 PM, Dan Stromberg > wrote: > > > > A while back I did a sort algorithm runtime comparison for a variety of > > sorting algorithms, and then mostly sat on it. > > > > Recently,

Re: Sort comparison

2012-05-01 Thread Dan Stromberg
On Tue, May 1, 2012 at 10:51 AM, Terry Reedy wrote: > On 5/1/2012 1:25 AM, Dan Stromberg wrote: > > Anyway, here's the comparison, with code and graph: >> http://stromberg.dnsalias.org/**~strombrg/sort-comparison/<http://stromberg.dnsalias.org/%7Estrombrg/sort-compariso

Re: Sort comparison

2012-05-01 Thread Dan Stromberg
On Tue, May 1, 2012 at 11:52 AM, Ian Kelly wrote: > On Tue, May 1, 2012 at 12:00 PM, Dan Stromberg > wrote: > > > > On Tue, May 1, 2012 at 12:21 AM, Ian Kelly > wrote: > >> > >> On Mon, Apr 30, 2012 at 11:25 PM, Dan Stromberg > >> wrote: &

Re: Lack of whitespace between contain operator ("in") and other expression tokens doesn't result in SyntaxError: bug or feature?

2012-05-03 Thread Dan Stromberg
On Thu, May 3, 2012 at 12:21 PM, Garrett Cooper wrote: > On Thu, May 3, 2012 at 12:03 PM, Ian Kelly wrote: > > On Thu, May 3, 2012 at 12:49 PM, Garrett Cooper > wrote: > >>I was wondering whether this was a parser bug or feature (seems > >> like a bug, in particular because it implicitly en

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Dan Stromberg
If you need the same ordering in two lists, you really should sort the lists - though your comparison function need not be that traditional. You might be able to get away with not sorting sometimes, but on CPython upgrades or using different Python interpreters (Pypy, Jython), it's almost certain

Re: key/value store optimized for disk storage

2012-05-04 Thread Dan Stromberg
On Thu, May 3, 2012 at 11:03 PM, Paul Rubin wrote: > > Sort of as you suggest, you could build a Huffman encoding for a > > representative run of data, save that tree off somewhere, and then use > > it for all your future encoding/decoding. > > Zlib is better than Huffman in my experience, and Py

Re: Is Python Lazy?

2012-05-05 Thread Dan Stromberg
Generators and iterators are laziness where you tend to need laziness the most. Generator expressions are tiny generators - more full fledged generators are supported. Python probably won't have laziness at its core ever, but it's nice having a dose of it. IOW, you probably won't be able to writ

Re: sorting 1172026 entries

2012-05-06 Thread Dan Stromberg
How much physical RAM (not the virtual memory, but the physical memory) does your machine have available? We know the number of elements in your dataset, but how big are the individual elements? If a sort is never completing, you're probably swapping. list.sort() is preferrable to sorted(list),

Re: indexed property? Can it be done?

2012-05-07 Thread Dan Sommers
t = downRight self.values = dict(key=value) self.parent = parent And then you don't have to remember that node[2] is the key/value pairs (note the typo (the two "3"s) in your original post). With each attribute in its own, well, attribute, you can always use node.values

Re: tee-like behavior in Python

2012-05-09 Thread Dan Stromberg
You've had some good responses already, but here're two more: 1) Easiest would be to use setvbuf in the child process, if you have access to its source. This allows you to force line-oriented buffering. 2) stdio likes to buffer to tty/pty's in a line-oriented manner, and other things in a block-

Re: bash/shell to python

2012-05-21 Thread Dan Stromberg
FWIW, I do manual argument parsing, because pylint understands how to detect typos with manual argument parsing, but not the highly dynamic modules that parse arguments. On Wed, May 16, 2012 at 7:16 PM, Rita wrote: > Hello, > > I currently build a lot of interfaces/wrappers to other applications

Re: Please use the Python Job Board for recruiting (was: Recruiting for Python Developer - Perm)

2012-05-22 Thread Dan Stromberg
On Tue, May 22, 2012 at 3:20 PM, Ben Finney wrote: > Python Recruiter writes: > > > Can any one help? I am looking for a Senior Python Developer > > Yes, please use the Python Job Board for this purpose instead > http://www.python.org/community/jobs/>. > > Good hunting! I find it more than a li

Re: install python 2.6 on Ubuntu 12.04

2012-05-22 Thread Dan Stromberg
If the pythons you require are in synaptic (sudo to root and run synaptic), you probably can just use them. If not, then you, for each release, need to: 1) download a tarball using a browser or whatever 2) extract the tarball: tar xvfp foo.tar.bz2 3) cd into the newly created, top-level directory,

Re: Please use the Python Job Board for recruiting

2012-05-23 Thread Dan Stromberg
On Wed, May 23, 2012 at 2:27 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Dan Stromberg wrote: > >> >> On Tue, May 22, 2012 at 3:20 PM, Ben Finney >> > ben+python@benfinney.**id.au >> wrote: >> >>Python Recruiter mailto:ro

Re: Please use the Python Job Board for recruiting

2012-05-23 Thread Dan Stromberg
On Wed, May 23, 2012 at 3:30 AM, Chris Withers wrote: > On 23/05/2012 00:34, Dan Stromberg wrote: > >> >> I find it more than a little disappointing that the Python Job Board >> doesn't do latitude and longitude. It's a big missed opportunity. Yes, >> i

Python Tree datastructure comparison

2012-06-05 Thread Dan Stromberg
I've put together a comparison of some tree datastructures for Python, with varied runtime and varied workload: http://stromberg.dnsalias.org/~strombrg/python-tree-and-heap-comparison/ I hope to find time to add heaps to the article at some point, but for now, it only covers trees and the treap.

Import semantics?

2012-06-08 Thread Dan Stromberg
Did the import semantics change in cpython 3.3a4? I used to be able to import treap.py even though I had a treap directory in my cwd. With 3.3a4, I have to rename the treap directory to see treap.py. -- http://mail.python.org/mailman/listinfo/python-list

Re: Import semantics?

2012-06-08 Thread Dan Stromberg
On Fri, Jun 8, 2012 at 3:16 PM, Ethan Furman wrote: > Dan Stromberg wrote: > >> >> Did the import semantics change in cpython 3.3a4? >> >> I used to be able to import treap.py even though I had a treap directory >> in my cwd. With 3.3a4, I have to rename th

Re: Import semantics?

2012-06-08 Thread Dan Stromberg
On Fri, Jun 8, 2012 at 3:48 PM, Ian Kelly wrote: > On Fri, Jun 8, 2012 at 4:24 PM, Dan Stromberg wrote: > > Am I misinterpreting this? It seems like according to the PEP, I should > > have still been able to import treap.py despite having a treap/. But I > > couldn

Re: Import semantics?

2012-06-08 Thread Dan Stromberg
And a link to the ticket: http://bugs.python.org/issue15039 > -- http://mail.python.org/mailman/listinfo/python-list

Re: How does python bytecode works?

2012-06-17 Thread Dan Stromberg
On Sun, Jun 17, 2012 at 2:54 AM, gmspro wrote: > We know python is written in C. > Yes, at least CPython is. Of course, java is written in C, as are many other languages. > C is not portable. > C gives you lots of rope to hang yourself with, but if you use C well, it's more portable than anyth

Re: Bloom Filter in 22 lines of Python (updated)

2011-06-03 Thread Dan Stromberg
FWIW, I took what I believe to have been the 2nd generation of this code, and put some of my own spin on it - mostly making it pass pylint, changing the __init__ arguments to be a little more intuitive (to me), and expanding the tests a bit. It's at http://stromberg.dnsalias.org/svn/bloom-filter/t

Re: Any Better logic for this problem..

2011-06-09 Thread Dan Stromberg
On Thu, Jun 9, 2011 at 10:55 AM, geremy condra wrote: > On Thu, Jun 9, 2011 at 4:38 AM, Dave Angel wrote: > > On 01/-10/-28163 02:59 PM, Chris Rebert wrote: > >> > >> On Thu, Jun 9, 2011 at 1:31 AM, Ganapathy Subramanium > >> wrote: > >>> > >>> Hi Guru's, > >>> I'm working on a solution to fin

Re: Python 2.6 OR 3.2

2011-06-09 Thread Dan Stromberg
If your dependencies are satisfiable with 3.2, you're better off with 3.2. If not, use 2.7, or consider porting the dependencies yourself (assuming those dependencies have code available). Both 2.x and 3.x are good, but 3.x is clearly the way forward. 3.x has some annoyances corrected: more cent

Re: Handling emails

2011-06-12 Thread Dan Stromberg
On Sun, Jun 12, 2011 at 6:46 PM, Nobody wrote: > Any message with non-ASCII characters in the headers can safely be > discarded as spam (I've never seen this bug in "legitimate" email). > Many MTAs will simply reject such messages. http://en.wikipedia.org/wiki/Email_address#Internationalization

Re: Subsetting a dataset

2011-06-12 Thread Dan Stromberg
On Sun, Jun 12, 2011 at 9:53 PM, Kumar Mainali wrote: > I have a huge dataset containing millions of rows and several dozen columns > in a tab delimited text file. I need to extract a small subset of rows and > only three columns. One of the three columns has two word string with header > “Scien

Re: What is the most efficient way to compare similar contents in two lists?

2011-06-13 Thread Dan Stromberg
On Mon, Jun 13, 2011 at 8:09 AM, Chris Angelico wrote: > On Tue, Jun 14, 2011 at 12:58 AM, Zachary Dziura > wrote: > > if set(source_headers) == set(target_headers): > >similar_headers = len(source_headers) > > Since you're making sets already, I'd recommend using set operations - > same_hea

Re: working with raw image files

2011-06-14 Thread Dan Stromberg
On Tue, Jun 14, 2011 at 1:26 PM, MRAB wrote: > On 14/06/2011 21:13, kafooster wrote: > >> >> I would like to visualize this data with PIL, but PIL works only with >> 8bit data. How could I resample my array from 16bit to 8bit? >> > > Multiply the numpy array by a scaling factor, which is > float(

Subprocess Startup Error

2011-06-15 Thread Dan Riner
unning XP (SP3) and have added python to windows firewall exceptions and then turned off the firewall all together to no avail. I was running Python 2.6 previously and never had this problem. Any suggestions would be greatly appreciated. Dan <>-- http://mail.python.org/mailman/listinfo/python-list

Re: Rant on web browsers

2011-06-20 Thread Dan Stromberg
On Tue, Jun 14, 2011 at 1:46 AM, Chris Angelico wrote: > On Tue, Jun 14, 2011 at 6:39 PM, Martin P. Hellwig > wrote: > > On 14/06/2011 07:31, Chris Angelico wrote: > > > >> > >> But if anyone feels like writing an incompatible browser, please can > >> you add Python scripting? > > > > You might

Re: writable iterators?

2011-06-23 Thread Dan Stromberg
On Wed, Jun 22, 2011 at 12:28 PM, Neal Becker wrote: > AFAICT, the python iterator concept only supports readable iterators, not > write. > Is this true? > > for example: > > for e in sequence: > do something that reads e > e = blah # will do nothing > > I believe this is not a limitation on th

Re: poll of filesystem

2011-07-02 Thread Dan Stromberg
On Sat, Jul 2, 2011 at 2:40 AM, Belisko Marek wrote: > Hi, > > just want to use poll method to get data from /proc file system. Use > simple code for it. Problem is it seems poll return POLLIN flag but > when I try to read data it's always empty. Could be a problem changes > are so fast that print

from module import * using __import__?

2011-07-02 Thread Dan Stromberg
Is there a decent way of running "from import *"? Perhaps using __import__? Does it mean using the copy module or adding an element to globals() somehow? Yes, I think I do have a good use for this: importing either pure python or cython versions of a module into a single namespace that can prov

Re: The end to all language wars and the great unity API to come!

2011-07-02 Thread Dan Stromberg
On Sat, Jul 2, 2011 at 5:21 PM, rantingrick wrote: > On Jul 2, 6:38 pm, Chris Angelico wrote: > [...] > > It takes work to suit your API to a different language. Let's take GNU > > Aspell as an example; [...] Should the Aspell team offer bindings for > every > > known language? In your post, you

Re: Problem!!

2011-07-03 Thread Dan Stromberg
You'll probably want to give more detail about what your code is doing and what it should be doing. Mindreading is hard, especially when it's accurate. Usually the main difference between *ix and windows for text files is the line endings though - on *ix, you can open a file as text or binary, an

Re: Problem!!

2011-07-04 Thread Dan Stromberg
It turned out that switching to binary I/O made seek do what he was expecting. I'm guessing the transparent crlf to lf conversions in windows text I/O get seek() a bit perplexed, because it transparently changes the number of bytes. On Mon, Jul 4, 2011 at 4:30 PM, Steven D'Aprano < steve+comp.lan

Re: write file

2011-07-05 Thread Dan Stromberg
What's date_cdr supposed to be? Is your exception handler doing unusual things with sys.exit? Did you try to run this? When I try to run it, it fails to compile. You might want to try opening your output file once and writing to it repeatedly, then close()ing it after all your writes are comple

Re: Microsoft GUIs (was: The end to all language wars and the great unity API to come!) (OT)

2011-07-05 Thread Dan Stromberg
On Tue, Jul 5, 2011 at 9:13 PM, Andrew Berg wrote: > On 2011.07.05 09:31 PM, Chris Angelico wrote: > > I've said for a while that Microsoft could do far worse than to turn > > Windows into a GUI that sits on top of a Unix-derived kernel. They > > won't do it, though, because it would be tantamount

Re: Serial & reset of the device

2011-07-07 Thread Dan Stromberg
On Thu, Jul 7, 2011 at 12:34 PM, yorick wrote: > Hello, > > I'm trying to access a hardware board of my company through a serial > connection using a Python script and the pyserial module. > > I use Python 2.7.1 with Ubuntu 11.04 (pyserial is the package python- > serial with version 2.5.2, > htt

Re: Finding duplicated photo

2011-07-08 Thread Dan Stromberg
On Fri, Jul 8, 2011 at 8:16 AM, Thomas Jollans wrote: > On 07/08/2011 01:29 PM, TheSaint wrote: > > Hello, > > > > I came across the problem that Gwenview moves the photo from the camera > > memory by renaming them, but later I forgot which where moved. > > Then I tought about a small script in p

Re: String concatenation vs. string formatting

2011-07-08 Thread Dan Stromberg
On Fri, Jul 8, 2011 at 3:50 PM, Ben Finney wrote: > * The ‘%’ string formatting operator is superseded in current Python > versions by the more flexible ‘format’ method of string objects. > AFAIK, % formatting is the only kind of formatting that works portably across all of CPythons 2.5, 2.6, 2.

Backshift mailing list create - opensource, deduplicating, compressing backups in Python

2011-07-10 Thread Dan Stromberg
I've created a google mailing list for the discussion of the backup program I've been working on, "backshift". You can find it at: backsh...@googlegroups.com And I'd be pleased if you were to choose to join, if you're interested in the subject of Python and Backups. -- http://mail.python.org/ma

Re: parsing packets

2011-07-11 Thread Dan Stromberg
On Mon, Jul 11, 2011 at 5:05 AM, Thomas Rachel < nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa...@spamschutz.glglgl.de> wrote: > Am 10.07.2011 22:59 schrieb Littlefield, Tyler: > > Hello all: >> I'm working on a server that will need to parse packets sent from a >> client, and construct it's own pac

Re: parsing packets

2011-07-11 Thread Dan Stromberg
On Sun, Jul 10, 2011 at 1:59 PM, Littlefield, Tyler wrote: > Hello all: > I'm working on a server that will need to parse packets sent from a client, > and construct it's own packets. > I like to use this module (I wrote while in the employ of UCI, so it's under a UCI - BSDesque - license, but th

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-11 Thread Dan Stromberg
On Mon, Jul 11, 2011 at 8:28 AM, Ian Kelly wrote: > On Mon, Jul 11, 2011 at 8:50 AM, Sébastien Volle > wrote: > > Could it have been made optional, like the trailing comma in list > > declaration? > > Cobra makes the colons optional, so probably yes. > -- > http://mail.python.org/mailman/listinf

Re: Please Help with vertical histogram

2011-07-11 Thread Dan Stromberg
I have a histogram script in Python at http://stromberg.dnsalias.org/svn/histogram/trunk/ It's under a UCI (BSD-like) license. Feel free to use it or borrow ideas from it. On Mon, Jul 11, 2011 at 5:42 PM, Cathy James wrote: > Please kindly help- i have a project where I need to plot dict resul

Re: What is the difference between PyPy and Python? are there lot of differences?

2011-07-13 Thread Dan Stromberg
On Wed, Jul 13, 2011 at 8:18 AM, Ian Kelly wrote: > On Wed, Jul 13, 2011 at 8:19 AM, Anthony Kong > wrote: > > One of the main difference is that pypy supports only R-Python, which > stands > > for 'Restricted Python". > > It is a subset of C-python language. > > This is wrong. The PyPy *interp

Re: Python ++ Operator?

2011-07-15 Thread Dan Stromberg
On Fri, Jul 15, 2011 at 1:06 AM, Chris Angelico wrote: > 2011/7/15 Björn Lindqvist : > > Pre and post-increments are > > almost always confusing unless they are used as the counter-variable > > inside for-loops. > > I agree that they're often confusing (i+j) but there are several > places whe

Re: Print encoding problems in console

2011-07-15 Thread Dan Stromberg
I've used the code below successfully to deal with such a problem when outputting filenames. Python2x3 is at http://stromberg.dnsalias.org/svn/python2x3/ , but here it's just being used to convert Python 3.x's byte strings to strings (to eliminate the b'' stuff), while on 2.x it's an identity func

Re: MemoryError vs malloc error

2011-07-16 Thread Dan Stromberg
Is the whole program pure python? Sometimes a reference to undefined memory or a lack of error checking elsewhere in a program, can cause innocuous code to fail later: http://stromberg.dnsalias.org/~dstromberg/checking-early.html If the program uses ctypes, or an unusual Python/C API module, I'd

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Dan Stromberg
On Sat, Jul 16, 2011 at 9:51 AM, rantingrick wrote: > > -- > Summary > -- > As we all know python allows us to use either tabs or spaces but NEVER > both in the same source file. And as we also know t

<    1   2   3   4   5   6   7   8   9   10   >