Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-03-31 Thread Mark Dufour
esis subjects in improving Shed Skin, such as transforming heap allocation into stack- and static preallocation, where possible, to bring performance even closer to manual C++. Please let me know if you are interested in helping out, and/or join the Shed Skin mailing list. Thanks! Mark Dufour. -- &qu

Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-04-01 Thread mark . dufour
ever placed a GPL > restriction on its output. Whether this is explicit or implicit doesn't > matter, so long as it's there. it's fine if people want to create non-GPL software with Shed Skin. it is at least my intention to only have the compiler proper be GPL (LICENSE states that th

Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-04-01 Thread mark . dufour
eople have managed to compile things with Visual Studio or whatever it is called. btw, the windows version of Shed Skin comes with GCC so it's easy to compile things further (two commands, 'ss program' and 'make run' suffice to compile and run some program 'progr

Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-04-01 Thread mark . dufour
VB and it has not even much to do > with what existed before in language design. I think it's more Pythonic to just profile a program to learn about actual types.. mark dufour (Shed Skin author). -- http://mail.python.org/mailman/listinfo/python-list

About Eggs

2007-04-10 Thread Mark Elston
they are some form of zip file for the distribution of modules but beyond that I cannot find *any* docs for them anywhere. Where are they documented and how do I take advantage of them? Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: About Eggs

2007-04-10 Thread Mark Elston
* Rob Wolfe wrote (on 4/10/2007 1:38 PM): > Mark Elston <[EMAIL PROTECTED]> writes: > >> This is probably a *really* stupid question but... >> I have looked at all the documentation I have for 2.4.3 >> and all the docs I can download for 2.5 and I simply cannot &

Re: combination function in python

2007-04-15 Thread Mark Dickinson
n xrange(min(k, n-k)): ntok = ntok*(n-t)//(t+1) return ntok Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: combination function in python

2007-04-15 Thread Mark Dickinson
ma function instead. That is, the natural log of n choose k can be computed much more quickly as lngamma(n+1) - lngamma(k+1) - lngamma(n-k+1) I assume that lngamma is implemented somewhere in either numpy or scipy, but right now I can't find it... Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Mark Summerfield
On 14 Sep, 02:35, Jürgen Urner <[EMAIL PROTECTED]> wrote: > Puh, what a discussion... most common use case I can think of is > > >> d = {'a': 1, 'b': 2, 'c': 3} > >> for key in d: > >> # do something that relies on order of keys as specified in the > >> constructor > > It's a bit tireing havin

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Mark Summerfield
I forgot one item in the proposed API: ordereddict.delete(index : int) Also, the API for keys() should be ordereddict.keys(firstindex : int = None, secondindex : int = None) If called with no args, returns list of all keys (in key order of course); if one arg is given, returns keys with indexes

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Mark Summerfield
On 14 Sep, 10:49, Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2007-09-14, Mark Summerfield <[EMAIL PROTECTED]> wrote: > > > > > On 14 Sep, 02:35, Jürgen Urner <[EMAIL PROTECTED]> wrote: > >> Puh, what a discussion... most common use case I can thin

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Mark Summerfield
On 14 Sep, 12:46, Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2007-09-14, Mark Summerfield <[EMAIL PROTECTED]> wrote: > > > > > On 14 Sep, 10:49, Antoon Pardon <[EMAIL PROTECTED]> wrote: > >> > # some time later > >> > d["e"]

subclass of integers

2007-09-14 Thread Mark Morss
I would like to construct a class that includes both the integers and None. I desire that if x and y are elements of this class, and both are integers, then arithmetic operations between them, such as x+y, return the same result as integer addition. However if either x or y is None, these operati

Re: subclass of integers

2007-09-14 Thread Mark Morss
On Sep 14, 10:30 am, Mark Morss <[EMAIL PROTECTED]> wrote: > I would like to construct a class that includes both the integers and > None. I desire that if x and y are elements of this class, and both > are integers, then arithmetic operations between them, such as x+y, > retu

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Mark Summerfield
On 14 Sep, 15:35, Antoon Pardon <[EMAIL PROTECTED]> wrote: [snip] > I wish you all the luck you can get. Maybe if you succeed I'll change > my mind about writing a PEP myself. > > However I think your chances will increase if you write your module > and have it available in the cheese shop. If peop

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Mark Summerfield
On 14 Sep, 20:25, James Stroud <[EMAIL PROTECTED]> wrote: > Mark Summerfield wrote: [snip] > May I also make one more suggestion, to call it a "sort_ordered_dict" > (or "sortordereddict", or even better a "sorteddict"--where the "ed" &g

Re: An ordered dictionary for the Python library?

2007-09-14 Thread Mark Summerfield
On 14 Sep, 21:23, James Stroud <[EMAIL PROTECTED]> wrote: > Mark Summerfield wrote: > > I guess I'll have to rename my module (although unfortunately, my book > > has just gone into production and I have a (simpler) example of what I > > considered to be an ordered

Re: Sets in Python

2007-09-19 Thread Mark Dickinson
nt call last): File "", line 1, in KeyError: [1, 2, 3] In other words, to repeat Sion Arrowsmith's question, what would you expect d.keys() to return after a key of d has been modified? Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: elementtree question

2007-09-21 Thread Mark T
"" tree = ET.XML(source) body = tree.find("body") newdiv = ET.Element('div', {'class':'remapped'}) for e in body.getchildren(): newdiv.append(e) newdiv.text = body.text newdiv.tail = body.tail body.clear() body.append(newdiv) ET.dump(tree) Result: Test original contents... 2&3 some text Another paragraph -Mark -- http://mail.python.org/mailman/listinfo/python-list

sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread Mark Summerfield
". If there is positive feedback I will submit the PEP to the reviewers, so if you think it is a good idea please say so. (I'm sure that if you _don't_ like it you'll tell me anyway:-) PEP: XXX Title: Sorted Dictionary Version: $Revision$ Last-Modified: $Date$ Author: Mark Summer

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread Mark Summerfield
On 25 Sep, 10:53, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2007-09-25, Mark Summerfield <[EMAIL PROTECTED]> wrote: > > > If there is positive feedback I will submit the PEP to the reviewers, > > so if you think it is a good idea please say so. (I'

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread Mark Summerfield
On 2007-09-25, Andrew Durdin wrote: > On 9/25/07, Mark Summerfield <[EMAIL PROTECTED]> wrote: > > Since the sorteddict's data is always kept in key order, indexes > > (integer offsets) into the sorteddict make sense. Five additional > > methods are pr

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread Mark Summerfield
On 2007-09-25, Andrew Durdin wrote: > On 9/25/07, Mark Summerfield <[EMAIL PROTECTED]> wrote: > > Since the sorteddict's data is always kept in key order, indexes > > (integer offsets) into the sorteddict make sense. Five additional > > methods are pr

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread Mark Summerfield
On 25 Sep, 12:11, Jeremy Sanders wrote: > Mark Summerfield wrote: > > If there is positive feedback I will submit the PEP to the reviewers, > > so if you think it is a good idea please say so. (I'm sure that if you > > _don't_ like it you'll tell me anyway

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread Mark Summerfield
On 25 Sep, 12:19, Paul Hankin <[EMAIL PROTECTED]> wrote: > Recall sorted... > sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted > list > > So why not construct sorteddicts using the same idea of sortedness? > > sorteddict((mapping | sequence | nothing), cmp=None, key=None, > re

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread Mark Summerfield
On 25 Sep, 20:28, Paul Hankin <[EMAIL PROTECTED]> wrote: > On Sep 25, 7:58 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > > > > > > Paul Hankin wrote: > > > ... > > > class sorteddict(dict): > > > "A sorted dictionary" > > > def __init__(self, arg=None, cmp=None, key=None, reverse=False):

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-26 Thread Mark Summerfield
On 25 Sep, 22:33, Paul Hankin <[EMAIL PROTECTED]> wrote: > On Sep 25, 9:55 pm, Mark Summerfield <[EMAIL PROTECTED]> > wrote: > > > ... > > class sorteddict(dict): > > > ... > > if self.__keys is None: > >

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-26 Thread Mark Summerfield
On 26 Sep, 09:51, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Duncan Booth <[EMAIL PROTECTED]> writes: > > I that's the point though: you can't write one implementation that has good > > performance for all patterns of use > > An implementation of sorted dict using a balanced tree as the > underlyin

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-26 Thread Mark Summerfield
On 26 Sep, 11:27, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Mark Summerfield <[EMAIL PROTECTED]> writes: > > On 26 Sep, 09:51, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > >> Duncan Booth <[EMAIL PROTECTED]> writes: > >> > I that's the p

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-26 Thread Mark Summerfield
On 26 Sep, 13:22, Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2007-09-26, Mark Summerfield <[EMAIL PROTECTED]> wrote: > > > > > On 26 Sep, 11:27, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > >> Mark Summerfield <[EMAIL PROTECTED]> writes: >

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-26 Thread Mark Summerfield
On 26 Sep, 14:59, Paul Hankin <[EMAIL PROTECTED]> wrote: > On Sep 26, 2:46 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > > > Paul Hankin <[EMAIL PROTECTED]> wrote: > > > More flexibly, keep a set of inserted keys that haven't yet been > > > included in the sorted list, and a set of deleted keys tha

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-26 Thread Mark Summerfield
On 26 Sep, 16:20, Paul Hankin <[EMAIL PROTECTED]> wrote: > On Sep 26, 3:24 pm, Mark Summerfield <[EMAIL PROTECTED]> > wrote: > > > On 26 Sep, 14:59, Paul Hankin <[EMAIL PROTECTED]> wrote: > > > > On Sep 26, 2:46 pm, Duncan Booth <[EMAIL PROTECTED]

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-27 Thread Mark Summerfield
nt sd.keys() = ['a'] > > try: > > del sd['b'] > > except: > > pass > > sd['b'] = 'b' > > print sd.keys() > > > The second print statement produces ['a'] rather than ['a', 'b'] &g

Re: sorteddict [was a PEP proposal, but isn't anymore!]

2007-09-27 Thread Mark Summerfield
On 26 Sep, 18:59, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Mark Summerfield] > > > Below is a PEP proposal for a sorteddict. It arises out of a > > discussion on this list that began a few weeks ago with the subject of > > "An ordered dictionary for t

Emailing the attachment created with the Quick Screenshots Script (Python + PIL)

2007-09-27 Thread Mark Bratcher
The Quick Screenshots Script (Python + PIL) is a "dream come true", and yet so simple to use reliably. Does anyone have a suggestion or know how to include in the script, the ability to email the attachment? This would make the dream perfect! Thanks! Mark Bratcher Consolidated

Re: Emailing the attachment created with the Quick Screenshots Script(Python + PIL)

2007-09-28 Thread Mark Bratcher
need from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart COMMASPACE = ', ' # Create the container (outer) email message. msg = MIMEMultipart() msg['Subject'] = 'TEST' # me == the sender's email address # family = the l

Re: Emailing the attachment created with the Quick Screenshots Script(Python + PIL)

2007-09-28 Thread Mark Bratcher
the email package; it creates a MIME message with an attachment and sends it using SMTP. <http://docs.python.org/lib/node162.html> Mark Bratcher Consolidated Citrus, LP 4210-250 Metro, Parkway Fort Myers, FL 33916 239-275-4060 ext 219 -- http://mail.python.org/mailman/li

Re: Matrix convergence

2007-09-30 Thread Mark Dickinson
lternative, quick and dirty way (quick for the human, not the computer!) would be just to compute some large power of the transition matrix and eyeball it to see if all columns are identical. If so, the process converges. > Thx! Ur wlcm! Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: slice with negative stride

2007-10-06 Thread Mark T
string, it returns the exact start,stop,step indices used: >>> mystr='my string' >>> s=slice(None,3,-1) >>> s.indices(len(mystr)) # start is the end of the string if step is >>> negative (8, 3, -1) >>> mystr[8],mystr[3] ('g

Re: Convert obejct string repr to actual object

2007-10-12 Thread English, Mark
> From: Tor Erik Sønvisen > Date: October 8th 2007 > I've tried locating some code that can recreate an object from > it's string representation... On a related note I've wondered about this: >>> class Foo(object): pass >>> f = Foo() >>> s = repr(f) >>> s '<__main__.Foo object at 0x007CBAB0>' So

Re: sorteddict PEP proposal [started off as orderedict]

2007-10-12 Thread Mark Summerfield
On 12 Oct, 09:17, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > Mark Summerfield <[EMAIL PROTECTED]> writes: > > Below is a PEP proposal for a sorteddict. ... > > Is this proposal dead? I'd been meaning to post some thoughts which I > still haven't gotte

Re: Convert obejct string repr to actual object

2007-10-15 Thread English, Mark
X-Replace-Address: [EMAIL PROTECTED] On 12 Oct, 18:14, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-10-12 at 17:41 +0100, English, Mark wrote: > > > From: Tor Erik Sønvisen > > > Date: October 8th 2007 > > > I've tried locating some code th

Re: View XMLRPC Requests/Responses?

2007-10-15 Thread Mark T
ere any way I can force these to a log or > print them to the screen? Thanks. > > Regards, > Ken > www.wireshark.org -Mark T. -- http://mail.python.org/mailman/listinfo/python-list

ANN: Shed Skin 0.0.24, 0.0.25

2007-10-16 Thread Mark Dufour
rtain default arguments -exhaustive checking of C++ keywords -fix for some combinations of arguments to min, max -several minor bug fixes As always, I could really use more help in pushing Shed Skin forward. Let me know if you'd like to help out, but are not sure where to begin. Thanks, Mark. --

Shed Skin Python-to-C++ compiler 0.0.24, 0.0.25

2007-10-21 Thread Mark Dufour
page: http://mark.dufour.googlepages.com Thanks, Mark. -- "One of my most productive days was throwing away 1000 lines of code" - Ken Thompson -- http://mail.python.org/mailman/listinfo/python-list

strange transliteration in win32com.client

2007-10-23 Thread Mark Morss
tly and that you are connected to the server on which the file resides.", None, 5003044, -2147467259), None) Please note the strange insertion of double slashes in the indicated 'not valid path.' Also the insertion of 'c:' and the strange leading double quotation mark. Whe

win32com.client documentation?

2007-10-24 Thread Mark Morss
I am a unix person, not new to Python, but new to Python programming on windows. Does anyone know where to find documentation on win32com.client? I have successfully installed this module and implemented some example code. But a comprehensive explanation of the objects and methods available is n

ANN: Learning Python 3rd Edition

2007-10-29 Thread Mark Lutz
from recent Python training sessions. For more details, see O'Reilly's web page: http://www.oreilly.com/catalog/9780596513986/ O'Reilly also has a press release about the book here: http://press.oreilly.com/pub/pr/1843 Thanks, --Mark Lutz -- http://mail.python.org/mailman/listinfo/python-list

Re: python at command prompt

2007-11-01 Thread Mark Elston
You need to set the PATH environment variable to include C:\Python24. That is where the Python executable is locate. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: File Closing Problem in 2.3 and 2.4, Not in 2.5 (Final report)

2007-01-09 Thread Mark T
to the file's close(). Is it perhaps "file.close" and not "file.close()"? Forgotten parentheses won't give an error and won't close the file. >>> f=file('blah.txt','wt') >>> f >>> f.close >>> f >>> f.close() >>> f >>> -Mark Tolonen -- http://mail.python.org/mailman/listinfo/python-list

Re: Conflicting needs for __init__ method

2007-01-15 Thread Mark Dickinson
On Jan 14, 7:49 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > Mark wrote:[a lot of valid, but long concerns about types that return > an object of their own type from some of their methods] > > I think that the best solution is to use an alternative constructor

Re: Conflicting needs for __init__ method

2007-01-15 Thread Mark Dickinson
denominator = self.denominator > return obj Thank you for this. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Conflicting needs for __init__ method

2007-01-16 Thread Mark Dickinson
> get *called by* the construction process). Sorry---I'm well aware that __init__ isn't a constructor; I wasn't being precise enough in my use of `used'. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Conflicting needs for __init__ method

2007-01-16 Thread Mark Dickinson
On Jan 16, 10:25 am, "Mark Dickinson" <[EMAIL PROTECTED]> wrote: > that is, I was working from the following two assumptions: > > (1) *Every* time a Rational is created, __init__ must eventually be > called, and > (2) The user of the class expects to call Rational(

Shed Skin Python-to-C++ Compiler

2007-01-18 Thread Mark Dufour
with Shed Skin. these can be downloaded from the Shed Skin homepage: http://mark.dufour.googlepages.com please let me know if you try out the latest release, and encounter any problems or have any wishes. thanks, mark. -- "One of my most productive days was throwing away 1000 lines of code&

test, please ignore qrm

2007-01-30 Thread Mark Harrison
test, please ignore -- http://mail.python.org/mailman/listinfo/python-list

test,please ignore 2 qrm

2007-01-30 Thread Mark Harrison
please ignore -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, readline and OS X

2007-02-02 Thread Mark Asbach
/lib does the trick. And by the way: the bash construct is far less error prone regarding quoting when used in shell scripts. Mark -- http://mail.python.org/mailman/listinfo/python-list

Shed Skin Python-to-C++ Compiler

2007-02-08 Thread Mark Dufour
of about 40 times over CPython and 11 times over Psyco on my computer), please visit the homepage at: http://mark.dufour.googlepages.com Thanks! Mark Dufour. -- "One of my most productive days was throwing away 1000 lines of code" - Ken Thompson -- http://mail.python.org/mailman/listi

cmath, __float__ and __complex__

2007-02-15 Thread Mark Dickinson
find really counter-intuitive is that the cmath functions will use __float__ if available, but completely ignore __complex__. Does anyone know of a good reason for the above behaviour? Would a patch to complexobject.c that `fixes' this be of any interest to anyone but me? Or would it likely break something else? Mark -- http://mail.python.org/mailman/listinfo/python-list

Is there any way to automatically create a transcript of an interactive Python session?

2007-02-18 Thread Jonathan Mark
Some languages, such as Scheme, permit you to make a transcript of an interactive console session. Is there a way to do that in Python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Help Required for Choosing Programming Language

2007-02-19 Thread Mark Morss
On Feb 16, 4:22 pm, [EMAIL PROTECTED] wrote: > I am VB6 programmer and wants to start new programming language but i > am unable to deciced. > > i have read about Python, Ruby and Visual C++. but i want to go > through with GUI based programming language like VB.net > > so will you please guide me

Re: how to fill many data strings from socket.recvfrom()

2007-11-03 Thread Mark T
d(("",port)) > i = 0 > while i<200: >data[i],addr = s.recvfrom(1024) >i = +1 > > data[i] is illegal. > > Any suggestion welcome! > import socket s=socket(socket.AF_INET,socket.SOCK_DGRAM) s.bind(('',5000)) data=[] for i in range(200):

Portrait of a "real life" __metaclass__

2007-11-09 Thread Mark Shroyer
e who may never have seen such a thing themselves. http://markshroyer.com/blog/2007/11/09/tilting-at-metaclass-windmills/ So what's the verdict? Incorrect? Missed the point completely? Needs to get his head checked? I'd love to hear what comp.lang.python has to (anthropomorphically) s

Re: Portrait of a "real life" __metaclass__

2007-11-10 Thread Mark Shroyer
On 2007-11-10, Jonathan Gardner <[EMAIL PROTECTED]> wrote: > On Nov 9, 7:12 pm, Mark Shroyer <[EMAIL PROTECTED]> wrote: >> I guess this sort of falls under the "shameless plug" category, but >> here it is: Recently I used a custom metaclass in a Python program

Re: Portrait of a "real life" __metaclass__

2007-11-11 Thread Mark Shroyer
ful to realize that all those years learning OO design and > design patterns just to make Java usable are wasted in the world of > Python. I understand that because I've invested years mastering C++ > and perl before discovering Python. Your solace comes when you embrace > that and see how much simpler life really is when the language gets > out of your way. It's just as harmful as to ignore the occasional usefulness of object-oriented patterns as it is to abuse them left and right. My approach on this project feels right, it produces legible and easily extensible code, it's been a breeze to test and maintain so far... if implementing different types of matching logic as classes here is "wrong" by Python convention (and that would come as a rather big surprise to me), then I don't want to be right. -- Mark Shroyer http://markshroyer.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: mpmath puzzle

2007-11-14 Thread Mark Dickinson
; or "license" for more information. >>> from decimal import Decimal, getcontext >>> getcontext().prec = 32 >>> 1234**Decimal("10.9") Decimal("4.9583278648155041477415234438717E+33") >>> Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Next float?

2007-11-21 Thread Mark T
gt;>> f2b(1.0) 1065353216 >>> hex(f2b(1.0)) '0x3f80' >>> b2f(0x3f80) 1.0 >>> b2f(0x3f81) 1.001192092896 >>> b2f(0x3f7f) 0.9994039535522 -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Next float?

2007-11-22 Thread Mark Dickinson
On Nov 22, 5:41 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Nov 21, 11:48 pm, "Mark T" <[EMAIL PROTECTED]> wrote: > > > > > Here's some functions to get the binary representation of a float. Then > > just manipulate the bits (an exercise f

Re: Next float?

2007-11-22 Thread Mark Dickinson
On Nov 21, 11:48 pm, "Mark T" <[EMAIL PROTECTED]> wrote: > Here's some functions to get the binary representation of a float. Then > just manipulate the bits (an exercise for the reader): > > import struct > > def f2b(f): > return struct.unpac

operator module isSequenceType with builtin set produces False

2007-12-18 Thread English, Mark
nceType at all ? Not particularly vital. Just implementing __str__ on some class and if one of the members was a sequence I was going to format that bit of data in brackets. Thanks, Mark __ This email is intended only for the use

Re: IronPython faster than CPython?

2007-12-18 Thread Mark Shroyer
machine code, is unimportant. Even if a significant performance difference did result from this, keep in mind that the bulk of the execution time of any Python app worth profiling is going to be after this initial Python-to-bytecode compilation, during the execution of the program's by

Re: Hexadecimal list conversion

2007-12-20 Thread Mark T
begins and ends with \x00, so it doesn't look like utf-16-be. But replace works: >>> L=['\x003\x008\x001\x004\x007\x005\x00.\x005\x000\x002\x005\x009\x009\x00','\x002\x001\x003\x006\x002\x002\x00.\x001\x007\x004\x002\x008\x002\x00'] >>> [s.replace('\x00','') for s in L] ['381475.502599', '213622.174282'] -Mark Tolonen -- http://mail.python.org/mailman/listinfo/python-list

How do I use the Proxy recipe ?

2007-12-21 Thread English, Mark
he supposed to patch the generated proxy instance (or proxy class) after it's been created ? I may have missed the point, but I ended up allowing the caller to "proxy()" to specify a base class. Code included below. Original code from the recipe, all mistakes are mine. Proxy renamed

Re: Missing interfaces in Python...

2006-04-18 Thread Mark True
This is quite possibly one of the funniest examples of how Duck Typing can break down that I have ever seen!On 4/18/06, Rene Pijlman < [EMAIL PROTECTED]> wrote: [EMAIL PROTECTED]:>If it looks like a duck, and quacks like a duck, then for all practical>purposes it supports the 'duck' interface.The p

Re: (was Re: Xah's Edu Corner: Criticism vs Constructive Criticism)

2006-04-26 Thread Mark Thomas
t;> >> http://www.spamcop.net/sc?track=72.231.179.135 posting host >> http://www.spamcop.net/sc?track=xahlee.org spamvertized >> site >> >> >> If enough people complain with both, it might stop one day. > Ooooh! (Waggles fingers beneath chin) Mark -- http://mail.python.org/mailman/listinfo/python-list

Multi-Monitor Support

2006-05-01 Thread Mark rainess
monitor. I am using wxPython. Does anyone know how to do it? Thanks Mark Rainess -- http://mail.python.org/mailman/listinfo/python-list

xml-rpc and 64-bit ints?

2006-05-02 Thread Mark Harrison
I've got an API that deals with 64 bit int values. Is there any way of handling this smoothly? Right now I'm casting the values into and out of strings for the API. If not, are there any nice alternatives to XML-RPC that support this? Many TIA! Mark -- Mark Harrison Pixar Animati

Shed Skin Python-to-C++ Compiler - Summer of Code?

2006-05-04 Thread Mark Dufour
, a simple way to also help out, is to send me bug reports of small code fragments that SS does not compile correctly, or you can just send me complete programs. Bug reports are always motivating, make my work more time-efficient, and are the best way to getting your own programs supported. Th

to thine own SELF be true...

2006-05-05 Thread Mark Harrison
elf." references, or is this just something I need to get my brain to accept? Many TIA, Mark -- Mark Harrison Pixar Animaion Studios -- http://mail.python.org/mailman/listinfo/python-list

easy way to dump a class instance?

2006-05-05 Thread Mark Harrison
Is there a way to automatically print all the instance data in a class? This is for debugging, I would like to do something like dump(self) to snapshot the state of the object. Many TIA! Mark -- Mark Harrison Pixar Animation Studios -- http://mail.python.org/mailman/listinfo/python-list

create a c++ wrapper for python class?

2006-05-10 Thread Mark Harrison
data via getters and setters, etc. It seems a first cut of this is pretty straightforward, using introspection to get the required methods. Something needs to be done to specify the C++ types of the parameters. Is there any work being done in this area? Many TIA, Mark -- Mark Harrison Pix

RE: simultaneous reading and writing a textfile

2006-05-17 Thread Mark Wilkinson
Why this: > lines = iter(infile.readline, "") > # copy one line at a time > for line in lines: Rather than this? > for line in infile: ..Mark This email and any attachment may contain confidential, privileged information for the sole use of the intended recipie

Re: Software Needs Philosophers

2006-05-21 Thread Mark Shelor
thing new out there? I would argue that software needs innovation more than it needs philosophers. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Compiling fails on Mac OS X 10.5

2008-01-12 Thread Mark Dickinson
he ./configure and compilation output? make might be rereporting an error that occurred further up. I don't see anything related on the Python bug tracker. It might be worth posting a bug report at bugs.python.org Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Compiling fails on Mac OS X 10.5

2008-01-12 Thread Mark Dickinson
Anyone else here have any ideas how to proceed? Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Exceptions - How do you make it work like built-in exceptions?

2008-01-13 Thread Mark Tolonen
except: org_type,org_value,org_traceback = sys.exc_info() raise SomeException,'had some problems with this code',org_traceback ## OUTPUT ## Traceback (most recent call last): File "exc.py", line 7, in a=1/0 SomeException: had some problems with this code --Mark -- http://mail.python.org/mailman/listinfo/python-list

Shed Skin (restricted) Python-to-C++ Compiler 0.0.26

2008-01-16 Thread Mark Dufour
for more details about the release, or visit the new Google code hosting site: http://shed-skin.blogspot.com http://shedskin.googlecode.com Thanks, Mark Dufour. -- "One of my most productive days was throwing away 1000 lines of code" - Ken Thompson -- http://mail.python.org/mailma

Re: handlers.SocketHandler and exceptions

2008-01-16 Thread Mark Tolonen
s how to handle this situation? I'd hate to > have to give up using the log.exception(...) call as it's useful to > get strack trace information in the log file. > > Thanks in advance, > Doug Farrell Check out the traceback module. It can translate the traceback into a variety of formats (such as a string) that can be pickled. --Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: When is min(a, b) != min(b, a)?

2008-01-21 Thread Mark Dickinson
a nan > under Windows, it displays as "1.#QNAN". I believe this will be fixed in Python 2.6 :) Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: When is min(a, b) != min(b, a)?

2008-01-24 Thread Mark Dickinson
rent objects, dammit! Any change to Python that made == and != checks involving NaNs raise an exception would have to consider the consequences for set, dict, list membership testing. Mark and if Python had separate operators for these two purposes it wouldn't be Python any more. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expression negate a word (not character)

2008-01-25 Thread Mark Tolonen
n\lib\re.py", line 233, in _compile raise error, v # invalid expression error: look-behind requires fixed-width pattern >>> Python doesn't support lookbehind assertions that can vary in size. This doesn't work either: >>> re.search(r'(? Here's some co

Re: Beginner String formatting question

2008-01-26 Thread Mark Tolonen
mat.FormatTime(112233) Traceback (most recent call last): File "", line 1, in File "Format.py", line 13, in FormatTime clock = Ftime.join() AttributeError: 'tuple' object has no attribute 'join' >>> Format.FormatTime('112233') Traceback (most recent call last): File "", line 1, in File "Format.py", line 13, in FormatTime clock = Ftime.join() AttributeError: 'tuple' object has no attribute 'join' Make sure to copy/paste the exact working code. Look at the 'time' and 'datetime' modules and the functions and methods 'strftime' and 'strptime' for displaying and parsing times. --Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: REALLY simple xml reader

2008-01-27 Thread Mark Tolonen
GetElement("foo/bar") > > ... to read the value of: > > > 42 > > > > Thanks > > Simon > > -- > Linux user #458601 - http://counter.li.org. > > > >>> from xml.etree import ElementTree as ET >>> tree=ET.parse('file.xml') >>> tree.find('bar').text '42' >>> --Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Some questions about decode/encode

2008-01-27 Thread Mark Tolonen
encodings can't be extended; it supports UTF-8, UTF-16, ISO-8859-1 (Latin1), and ASCII. If encoding is given it will override the implicit or explicit encoding of the document. --Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: strftime return value encoding (mbcs, locale, etc.)

2008-01-27 Thread Mark Tolonen
time.strftime('%#c').decode(locale.getpreferredencoding()) # cp1252 on >>> my system u'Sunday, January 27, 2008 12:56:30' >>> time.strftime('%#c').decode('cp932') u'Sunday, January 27, 2008 12:56:40' >>> time.strftime('%#c').decode('mbcs') u'Sunday, January 27, 2008 12:56:48' --Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: When is min(a, b) != min(b, a)?

2008-01-28 Thread Mark Dickinson
0 or 1) rather than as a boolean, and goes back into the calculation in some way. On the other hand, there are certainly situations where you want a comparison with a NaN to raise an exception. I guess this is why IEEE-754r provides two sets of comparison operators: signaling and non-signaling. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: When is min(a, b) != min(b, a)?

2008-01-28 Thread Mark Dickinson
#x27;real' mathematics: most of it is devoted to dealing correctly with infinities, NaNs, signed zeros, subnormals, `ideal' exponents, traps, flags, etc. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: extending Python - passing nested lists

2008-01-28 Thread Mark Dickinson
ay: it returns a PyObject---in this case, a PyObject corresponding to a Python tuple. As the compiler says, a PyObject is neither an array nor a pointer, so when you write dummy_list[i] the compiler doesn't know what you mean. You probably want to use PySequence_Fast_GET_ITEM. See the docu

Re: small problem with re.sub

2008-01-30 Thread Mark Tolonen
> See the help for re.sub: "Backreferences, such as "\6", are replaced with the substring matched by group 6 in the pattern." This should work: htmlStr = re.sub('(?P\d{6})','http://linky.com/\\1.html";>\\1',htmlStr) --Mark -- http://mail.python.org/mailman/listinfo/python-list

<    37   38   39   40   41   42   43   44   45   46   >