[issue7160] Crash when returning a 64-bit char pointer in Python 2.6.3 ctypes

2009-10-19 Thread Michael J. Fromberger
Michael J. Fromberger michael.j.fromber...@gmail.com added the comment: Thank you for setting me straight. I see now that I misunderstood the scope of `CFUNCTYPE`, as I was using it as a general wrapper when in fact it's only needed for callbacks. Mistakenly, I inferred from reading section

[issue7160] Crash when returning a 64-bit char pointer in Python 2.6.3 ctypes

2009-10-17 Thread Michael J. Fromberger
New submission from Michael J. Fromberger michael.j.fromber...@gmail.com: A segmentation fault is generated in _ctypes.so when calling a function that returns a char pointer on a system with 64-bit pointer types. The attached crash dump is from a Python 2.6.3 built from MacPorts (port

[issue7160] Crash when returning a 64-bit char pointer in Python 2.6.3 ctypes

2009-10-17 Thread Michael J. Fromberger
Changes by Michael J. Fromberger michael.j.fromber...@gmail.com: Added file: http://bugs.python.org/file15155/crash-report.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7160

[issue7160] Crash when returning a 64-bit char pointer in Python 2.6.3 ctypes

2009-10-17 Thread Michael J. Fromberger
Michael J. Fromberger michael.j.fromber...@gmail.com added the comment: I believe this error occurs because a pointer value is being truncated to 32 bits. The exception code is KERN_INVALID_ADDRESS at 0x002fe020 If you add a diagnostic printout to the body of get_message(), you

[issue5809] No such file or directory with framework build under MacOS 10.4.11

2009-05-08 Thread Michael J. Fromberger
Michael J. Fromberger michael.j.fromber...@gmail.com added the comment: Ned Deily writes: --enable-framework and --enable-shared are mutually exclusive options. Aha, I did not realize that, though I suppose in retrospect it should have been obvious. Removing --enable-shared from my build

[issue5809] No such file or directory with framework build under MacOS 10.4.11

2009-04-21 Thread Michael J. Fromberger
New submission from Michael J. Fromberger michael.j.fromber...@gmail.com: Checkout: http://svn.python.org/projects/python/tags/r262 Configure: env CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib sh ./configure --enable-framework --enable-shared --enable-readline Build: make

[issue5809] No such file or directory with framework build under MacOS 10.4.11

2009-04-21 Thread Michael J. Fromberger
Michael J. Fromberger michael.j.fromber...@gmail.com added the comment: Sorry, I managed to not copy the error message. It is: i686-apple-darwin8-gcc-4.0.1: Python.framework/Versions/2.6/Python: No such file or directory make: *** [python.exe] Error 1

Re: Python Exponent Question

2007-12-17 Thread Michael J. Fromberger
means 2 ** (2 ** (2 ** 2)) ... and not ((2 ** 2) ** 2) ** 2 ... as you seem to expect. As usual, you can enforce different associations by explicitly including the parentheses. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu

Re: Loop three lists at the same time?

2007-11-14 Thread Michael J. Fromberger
near the bottom of the page. Example: zip([1,2,3], [4,5,6], [7,8,9]) == [(1, 4, 7), (2, 5, 8), (3, 6, 9)] Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org

Re: Iteration for Factorials

2007-10-22 Thread Michael J. Fromberger
? Once you have done so, you will also be able to get rid of the extra accumulating parameter, and then you will have what you wanted. I hope this helps. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College

Re: Last iteration?

2007-10-19 Thread Michael J. Fromberger
marked(self): | return self._mark Generally speaking, you should only have to override .next() and .marked() to make a useful subclass of marker -- and possibly also __init__ if you need some additional setup. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer

Re: sorting a list numbers stored as strings

2007-09-24 Thread Michael J. Fromberger
it in place. Also, you should probably read about the sorted function here: http://docs.python.org/lib/built-in-funcs.html Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http

Re: frange() question

2007-09-21 Thread Michael J. Fromberger
://docs.python.org/ref/genexpr.html Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing problems: A journey from a text file to a directory tree

2007-09-19 Thread Michael J. Fromberger
specification did not constrain this case. To call this, pass a file-like object to parse_folders(), e.g.: test1 = ''' [New client]. Won't work with the dot on the end. My mistake. The period was a copy-and-paste artifact, which I missed. Cheers, -M -- Michael J. Fromberger

Re: Parsing problems: A journey from a text file to a directory tree

2007-09-18 Thread Michael J. Fromberger
''' from StringIO import StringIO result = parse_folders(StringIO(test1)) As the documentation suggests, the result is a nested dictionary structure, representing the folder structure you encoded. I hope this helps. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept

Re: fcntl problems

2007-08-31 Thread Michael J. Fromberger
have multiple names (e.g., EAGAIN and EWOULDBLOCK) so that this lookup may not return exactly the name you're expecting. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http

Re: tempfile.mkstemp and os.fdopen

2007-08-28 Thread Michael J. Fromberger
-- these expose a file-like API, including a .name attribute. Assuming tempfile.mkstemp() is implemented properly, I think what you are doing should be sufficient to avoid the obvious file-creation race condition. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science

Re: Image manipulation

2007-08-28 Thread Michael J. Fromberger
/gdmodule.html I do not know, however, whether or not the Python wrapper supports the animated GIF portions of the library. You'll probably have to do some digging. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth

Re: Regular Expression Grouping

2007-08-12 Thread Michael J. Fromberger
are after. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list

Re��: ��get wikipedia source failed�� (��urrlib2��)

2007-08-07 Thread Michael J��. ��Fromberger
In article‭ [EMAIL PROTECTED],‬ ‭ [EMAIL PROTECTED] wrote‭:‬ ‭ ‬Hi‭,‬ ‭ ‬I'm trying to get wikipedia page source with urllib2‭:‬ ‭ ‬usock‭ = ‬urllib2‭.‬urlopen‭(‬http‭://‬en.wikipedia.org/wiki‭/‬ ‭ ‬Albert_Einstein‭)‬ ‭

Re: boolean operations on sets

2007-08-06 Thread Michael J. Fromberger
and its descendants also behave in this manner, as do the AND and OR of Lisp or Scheme. It is possible that beginners may find it a little bit confusing at first, but I believe such confusion is minor and easily remedied. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept

Re: a dict trick

2007-08-02 Thread Michael J. Fromberger
to the dictionary, you may also use the following: value = d.setdefault('sex', 'unknown') This returns the same value as the above, but also adds the key 'sex' to the dictionary as a side-effect, with value 'unknown'. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer

Re: How to initialize a table of months.

2007-04-16 Thread Michael J. Fromberger
the hard work be somebody else's problem. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove multiple occurrences of a string within a list?

2007-04-04 Thread Michael J. Fromberger
properties that: 1. It works on lists of any hashable type, not just strings, 2. It preserves the order of the unfiltered items, 3. It makes only two passes over the input list. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting

Re: How to sort list

2006-11-23 Thread Michael J. Fromberger
key from each element in the source list. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list

Re: +1 QOTW

2006-09-24 Thread Michael J. Fromberger
. In the state of the onion address? http://www.perl.com/pub/a/2006/09/21/onion.html There is also this: 'But I think the basic Perl paradigm is Whatever-oriented programming.' But what this really means, in practise, is dis-oriented programming. -M -- Michael J. Fromberger | Lecturer

Python 2.5 and Unicode on MacOS

2006-09-21 Thread Michael J. Fromberger
build of Python 2.5. For reference, I have done a framework build of Python, and it seems to work fine for everything else I have tried. Do you have any idea what might be causing this trouble? I'd be grateful for your insights. Cheers, -M -- Michael J. Fromberger | Lecturer

Re: Semantics of propagated exceptions

2006-07-21 Thread Michael J. Fromberger
of the existing exception types, then perhaps you can catch the exceptions from functions called by f, within f itself, and raise some other error (or suppress the errors, if appropriate). Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http

Re: Dispatch with multiple inheritance

2006-07-19 Thread Michael J. Fromberger
In article [EMAIL PROTECTED], Michele Simionato [EMAIL PROTECTED] wrote: Michael J. Fromberger ha scritto: Consider the following class hierarchy in Python: snip Is there a better (i.e., more elegant) way to handle the case marked (**) above? Curious, -M -- Michael J

Re: Dispatch with multiple inheritance

2006-07-19 Thread Michael J. Fromberger
for the imprecision. However, for the purposes of this example, the distinction is irrelevant. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python

Re: Dispatch with multiple inheritance

2006-07-19 Thread Michael J. Fromberger
, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list

Dispatch with multiple inheritance

2006-07-18 Thread Michael J. Fromberger
down the names of) the ancestors of C in order to dispatch to superclass methods in D, since C and D share no common ancestors south of object. Is there a better (i.e., more elegant) way to handle the case marked (**) above? Curious, -M -- Michael J. Fromberger | Lecturer, Dept

Re: Arrghh... Problems building Python from source on OS X --

2006-06-28 Thread Michael J. Fromberger
/local/lib so that the build could use the version of GNU readline I installed via Darwin ports. The Tk headers allow pythonw to build properly. Having configured, I built and installed via: make sudo make frameworkinstall I hope this may be helpful to you. -M -- Michael J. Fromberger

Re: Finding yesterday's date with datetime

2006-05-15 Thread Michael J. Fromberger
) # See the .month, .day, and .year fields of yesterday Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list

Re: Enumerating Regular Expressions

2006-05-09 Thread Michael J. Fromberger
regular expressions from language theory. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list

Re: Splice two lists

2006-05-06 Thread Michael J. Fromberger
but I can't seem to find a good example. Here's one possibility: list(reduce(lambda s, t: s + t, zip(L1, L2), ())) -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org

Re: How to do an 'inner join' with dictionaries

2006-02-27 Thread Michael J. Fromberger
] in dict2) Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list

Re: can't solve an exercise-help me with it

2006-01-11 Thread Michael J. Fromberger
will converge more quickly for atan(1/5) and atan(1/239). (LaTeX: \mathrm{atan}(x) = \sum_{i=0}^\infty\frac{(-1^i)x^i}{2i+1}) Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http

Re: Burrows-Wheeler (BWT) Algorithm in Python

2005-11-03 Thread Michael J. Fromberger
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Michael J. Fromberger: I can send you a Python implementation I wrote, if you like; but if you're interested in better understanding how the transform works, I would recommend you try writing your own implementation. I'd like

Re: Burrows-Wheeler (BWT) Algorithm in Python

2005-11-02 Thread Michael J. Fromberger
/bwt/bwt.htm I hope this helps you get started. -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to find python c-sources

2005-09-29 Thread Michael J. Fromberger
of the Python source tree. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list

Re: Parser suggestion

2005-09-29 Thread Michael J. Fromberger
://pages.cpsc.ucalgary.ca/~aycock/spark/ You might also find the following an interesting read, if this sort of thing interests you: http://www.python.org/sigs/parser-sig/towards-standard.html Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http

Re: Crypto.Cipher.ARC4, bust or me doing something wrong?

2005-09-20 Thread Michael J. Fromberger
confusion. Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list

Re: encryption with python

2005-09-07 Thread Michael J. Fromberger
be great if there exists a library already written to do this, and if there is, can somebody please point me to it?? I recommend you investigate PyCrypto: http://www.amk.ca/python/code/crypto http://sourceforge.net/projects/pycrypto Cheers, -M -- Michael J. Fromberger | Lecturer

Re: Proposal: add sys to __builtins__

2005-09-06 Thread Michael J. Fromberger
of detecting and automatically handling this kind of substitution. Naturally, you might well ask, why would you do such a fool thing? To this I can only respond: Never underestimate the ingenuity of fools. -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http

Re: Proposal: add sys to __builtins__

2005-09-05 Thread Michael J. Fromberger
modules! Where do you draw the line? Do you really want to hard-code user opinions into the language? Right now, we have a nice, simple yet effective mechanism for controlling the contents of our namespaces. I don't think this would be a worthwhile change. -1. -M -- Michael J. Fromberger

Re: Replacing large number of substrings

2005-09-04 Thread Michael J. Fromberger
in . which each key is a substring of s to be replaced and the . corresponding value is the string to replace it with. . . exp = re.compile('|'.join(re.escape(x) for x in r.keys())) . return exp.sub(lambda m: r.get(m.group()), s) Cheers, -M -- Michael J. Fromberger

Re: Permutation Generator

2005-08-12 Thread Michael J. Fromberger
, 2, 3])) == [[1, 2, 3], [2, 3, 1], [1, 3, 2], [3, 2, 1]] Notably absent from this list are [2, 1, 3] and [2, 3, 1]. The problem gets worse with longer lists. The basic problem is that x needs to be able to occur in ALL positions, not just the beginning and the end. Cheers, -M -- Michael J

Re: Loop until condition is true

2005-06-18 Thread Michael J. Fromberger
. Personally, I'd be pretty suspicious of the quality of a compiler that produced radically different code for these two constructs without some damned good reason. -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College

Re: Unique Elements in a List

2005-05-09 Thread Michael J. Fromberger
the input sequence exactly once, and requires storage proportional to the length of the input. -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python

Re: variables exist

2005-04-17 Thread Michael J. Fromberger
') ## == True print isset('varname') ## == False print isset('lloc')## == False lloc = foo! print isset('lloc')## == True Perhaps this is not the most elegant solution, but I believe it handles scoping correctly. -M -- Michael J. Fromberger | Lecturer, Dept