Re: python to exe

2010-03-14 Thread Mark Lawrence
Steven D'Aprano wrote: On Sun, 14 Mar 2010 11:20:15 +1300, Gib Bogle wrote: Mark Lawrence wrote: I'm certain that members of the Guinea Pig Club might have something to say on that one, see :- http://en.wikipedia.org/wiki/Guinea_Pig_Club You mean, something like: "That

Re: "Breaking" the __main__ script

2010-03-14 Thread Mark Lawrence
can I use? Vicente Soler Something like import sys sys.exit()? HTH. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Re: Python unicode and Windows cmd.exe

2010-03-14 Thread Mark Tolonen
M serves to indicate both that it is a Unicode file, and which of the formats it is in. Examples: BytesEncoding Form 00 00 FE FF UTF-32, big-endian FF FE 00 00 UTF-32, little-endian FE FFUTF-16, big-endian FF FEUTF-16, little-endian EF BB BF UTF-8 -Mark -- http://mai

Re: iterator/generator

2010-03-15 Thread Mark Lawrence
): if j: etc... If there's a better method for some definition of better I'm certain we'll quickly get told. Please see the python docs for the enumerate built-in. HTH. Mark Lawrence. [snip the rest] -- http://mail.python.org/mailman/listinfo/python-list

Re: import antigravity

2010-03-16 Thread Mark Lawrence
ld be from __past__ import __future__ as future But the question is, have we yet got to 1984, are we currently there or have we already gone past it? Who actually *IS* running the time machine? Are there any bugs?? Regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to add a library path to pythonpath ?

2010-03-16 Thread Mark Hammond
e the sub-keys in all cases. HTH, Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: using DictionaryServices module to get work with python2.6 #OSXspecific

2010-03-17 Thread Mark Lawrence
out of bounds Ofcourse it doesnt work with python2.7 too. Is this OSX specific issue ? Can I make it work with my compiled version of python ? Is there any workaround ? Are you thinking of this? http://pypi.python.org/pypi/pyobjc-framework-DictionaryServices/2.2 HTH. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Install 2.6.4 as non-admin on Windows

2010-03-18 Thread Mark Carter
How do I install python 2.6.4 on Windows without admin privileges? Can I install it on a machine I control, zip up the contents, copy it across to an admin-restricted machine, and set up a couple of environemtn variables? Does python install files to system directories, making this impossible? --

Re: Install 2.6.4 as non-admin on Windows

2010-03-18 Thread Mark Carter
On 18 Mar, 15:23, "[email protected]" wrote: > The only file written to a system folder is python2x.dll (I think it's > not true for python2.6 any longer), so your approach is perfectly > valid if you can put this dll into a folder where it can be found by > the system. Thanks. That sounds easy en

Re: Writing tests for the Python bug tracker

2010-03-20 Thread Mark Dickinson
hannel: a good few of the people interested in testing (esp. Michael Foord, Ezio Melotti) can often be found there. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing tests for the Python bug tracker

2010-03-20 Thread Mark Dickinson
7;Surprise!') > > def test_main(): >     test.test_support.run_unittest(UnicodeInterpolationTest) > > if __name__ == "__main__": >     test_main() This looks like a fine start to me. I have a feeling that the current fashion is for assertEqual rather than assertEquals, but I might be wrong. :) -- Mark -- http://mail.python.org/mailman/listinfo/python-list

the Python Foundation

2010-03-24 Thread Mark Tarver
ith Python. Could somebody explain 'what holding the intellectual property rights' means in this context and in what sense PSF manages the licensing and protects the trademarks associated with Python? This is for my education. thanks Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: the Python Foundation

2010-03-29 Thread Mark Tarver
emarks, which you can read at > >  http://www.python.org/psf/trademarks/ > > regards >  Steve > -- > Steve Holden        Chairman, Python Software Foundation > See PyCon Talks from Atlanta 2010  http://pycon.blip.tv/ > Holden Web LLC                http://www.holdenweb

ANN: Shed Skin 0.4

2010-03-31 Thread Mark Dufour
Hi all, I have just released Shed Skin 0.4, an experimental (restricted) Python-to-C++ compiler. Please see my blog for more details about the release: http://shed-skin.blogspot.com/ Thanks, Mark Dufour. -- "Overdesigning is a SIN. It's the archetypal example of what I call

Re: WinXP, Python3.1.2, dir-listing to XML - problem with unicode file names

2010-04-03 Thread Mark Tolonen
uld be: writer.endElement('dir') break if __name__ == '__main__': directory = 'c:\\_TEST\\' out = open('C:\\_TEST.xml','w') The above line opens the file in the default file system encoding 'mbcs' (cp850 on

Re: strange behavor....

2010-11-15 Thread Mark Wooding
Steven D'Aprano writes: > > def foo(): > > l = [] > > for i in xrange(10): > > (lambda j: l.append((lambda: i, lambda: j)))(i) > > print [(f(), g()) for f, g in l] > > Here's a slightly less condensed version that demonstrates the same > behaviou

Re: strange behavor....

2010-11-15 Thread Mark Wooding
Arnaud Delobelle writes: > >>> exec "a=2" in d > assigning 2 to 'a' > >>> d['a'] > 2 > > >>> exec "global a; a = 3" in d > >>> d['a'] > 3 Oooh, now isn't that an interesting wrinkle? I've been careful (without drawing attention) to restrict my arguments to variables inside functions, largely be

Re: Some syntactic sugar proposals

2010-11-15 Thread Mark Wooding
Dmitry Groshev writes: > First of all: how many times do you write something like > t = foo() > t = t if pred(t) else default_value > ? Of course we can write it as > t = foo() if pred(foo()) else default_value > but here we have 2 foo() calls instead of one. Why can't we write just >

Re: [Python-Dev] [RELEASED] Python 3.2 alpha 3

2010-11-16 Thread Mark Summerfield
might add: "The xml.etree.ElementTree now raises an xml.etree.ElementTree.ParseError when a parse fails; previously it raised a xml.parsers.expat.ExpatError." It would also be nice to mention this in the ElementTree module's documentation for the

Re: how to use socket to get packet which destination ip is not local?

2010-11-17 Thread Mark Wooding
Hans writes: > I tried socket bind to 0.0.0.0, but it only binds to any local ip, not > any ip which may not be local. therefore the socket cannot get that > dhcp offer packet even I can use wireshark to see that packet did come > to this pc. You must use a raw socket for this. Raw sockets are

Re: Some syntactic sugar proposals

2010-11-17 Thread Mark Wooding
Christopher writes: > i don't like magic names. what about: > > t = foo() as v if pred(v) else default_value This is an improvement on `it'; anaphorics are useful in their place, but they don't seem to fit well with Python. But I don't think that's the big problem with this proposal. The real

simple(?) Python C module question

2010-11-17 Thread Mark Crispin
OO or Pythonish; and more to the point other people will have to use it. I hate when people inflict quick, dirty, stupid, ugly, lazy programmer abominations on me; and so I feel obligated to do it right rather than inflict an abomination on others... :) Thanks in advance for any pointers

Re: simple(?) Python C module question

2010-11-17 Thread Mark Crispin
thod. Then to get the stream, I'd do something like stream = [self getStream]; Have you looked at ctypes? It's not suitable for all libraries, but it can often obviate the need to write any C code: http://docs.python.org/release/2.6.6/library/ctypes.html#module-ctypes

Re: simple(?) Python C module question

2010-11-17 Thread Mark Wooding
Mark Crispin writes: > I have a Python module written in C that interfaces with an external C > library. Basically, the project is to make it possible to use that > library from Python scripts. If you know who I am, you can guess > which library. :) You have your very own Wikipe

Re: Program, Application, and Software

2010-11-17 Thread Mark Wooding
Alexander Kapps writes: > Application: Usually a large(er), complex program I'd say that an `application' is specifically a program intended for direct human use. Other things are servers, daemons and utilities. But I might just be weird. -- [mdw] -- http://mail.python.org/mailman/listinfo/p

Re: simple(?) Python C module question

2010-11-17 Thread Mark Crispin
On Thu, 18 Nov 2010, Mark Wooding posted: [snip] Whoo-hoo! That's exactly what I was looking for. If we ever meet in person, I owe you a beer, sir. And by that I mean real beer (from what we call a "microbrew"), not Budweiser... :) -- Mark -- http://panda.com/mrc Democrac

Re: Some syntactic sugar proposals

2010-11-18 Thread Mark Wooding
Steven D'Aprano writes: > On Wed, 17 Nov 2010 16:31:40 +0000, Mark Wooding wrote: > > > But I don't think that's the big problem with this proposal. The real > > problem is that it completely changes the evaluation rule for the > > conditional expression.

Re: Is Unladen Swallow dead?

2010-11-18 Thread Mark Wooding
John Nagle writes: > Python is defined by what a naive interpreter with late binding > and dynamic name lookups, like CPython, can easily implement. Simply > emulating the semantics of CPython with generated code doesn't help > all that much. Indeed. > Because you can "monkey patch"

Re: Some syntactic sugar proposals

2010-11-18 Thread Mark Wooding
Steven D'Aprano writes: > >> Not everything needs to be a one liner. If you need this, do it the > >> old- fashioned way: > >> > >> t = foo() > >> if not pred(t): t = default_value > > > > I already explained how to write it as a one-liner: > > > > t = (lambda y: y if pred(y) else defau

Re: Program, Application, and Software

2010-11-18 Thread Mark Wooding
Steven D'Aprano writes: > On Thu, 18 Nov 2010 14:21:47 +, Martin Gregorie wrote: > > > I use 'script' to refer to programs written in languages that don't have > > a separate compile phase which must be run before the program can be > > executed. IOW Python and Perl programs are scripts aloin

Re: what's the precision of fractions.Fraction?

2010-11-20 Thread Mark Dickinson
ust use the existing Fraction.limit_denominator method (which does indeed use some number theory and continued fractions): >>> from fractions import Fraction >>> from math import pi >>> Fraction.from_float(pi).limit_denominator(1000) Fraction(355, 113) -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Weibull distr. random number generation

2010-11-20 Thread Mark Dickinson
ariate(12345.0, 6.0) for _ in xrange(10)] >>> print samples [10355.396846416865, 14689.507803932587, 11491.850991569485, 14128.56397290655, 12592.739991974759, 9076.7752548878998, 11868.012238422616, 12016.784656753523, 14724.818462506191, 13253.477389116439] Is this the sort of thing you were looking for? -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: inverse of a matrix with Fraction entries

2010-11-24 Thread Mark Wooding
Daniel Fetchinson writes: > So after all I might just code the inversion via Gauss elimination > myself in a way that can deal with fractions, shouldn't be that hard. I wouldn't do it that way. Let M be your matrix. Work out the LCM l of the denominators, and multiply the matrix by that to mak

Re: inverse of a matrix with Fraction entries

2010-11-25 Thread Mark Wooding
Daniel Fetchinson writes: > > I wouldn't do it that way. Let M be your matrix. Work out the LCM l of > > the denominators, and multiply the matrix by that to make it an integer > > matrix N = l M. Then work out the determinant d of that integer matrix. > > Next, the big step: use Gaussian elim

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-25 Thread Mark Wooding
John Nagle writes: >Multiple inheritance in Python is basically what fell out of > CPython's internals, not a design. It's one of those areas where > order of execution matters, and that wasn't well worked out. I'm not sure about the history, but this doesn't sound right to me. > Allowing

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-26 Thread Mark Wooding
John Nagle writes: > I'd argue that a better implementation would require that when there's > a name clash, you have to specify the class containing the name. In > other words, if A is a subclass of B, then B.foo() overrides > A.foo(). But if C is a subclass of A and B, and there's an A.foo() an

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-27 Thread Mark Wooding
John Nagle writes: > On 11/26/2010 4:21 PM, Mark Wooding wrote: > > John Nagle writes: > >> @This catches the case where two classed both inherit from, say > >> "threading.thread", each expecting to have a private thread. > > > > Why on earth wou

Re: inverse of a matrix with Fraction entries

2010-11-27 Thread Mark Wooding
casevh writes: > I coded a quick matrix inversion function and measured running times > using GMPY2 rational and floating point types. For the floating point > tests, I used a precision of 1000 bits. With floating point values, > the running time grew as n^3. With rational values, the running tim

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-28 Thread Mark Wooding
Steve Holden writes: > It isn't. Even inheritance itself isn't as useful as it at first > appears, and composition turns out in practice to be much more useful. > That goes double for multiple inheritance. Composition /with a convenient notation for delegation/ works fairly well. Indeed, this c

Re: Catching user switching and getting current active user from root on linux

2010-12-01 Thread Mark Wooding
Grant Edwards writes: > On 2010-11-30, mpnordland wrote: > > and catch user switching eg user1 locks screen, leaves computer, > > user2 comes, and logs on. basically, when there is any type of user > > switch my script needs to know. > > What do you do when there are multiple users logged in? I

Re: Some syntactic sugar proposals

2010-12-02 Thread Mark Dickinson
gt;> 5 in range(0, 10**100, 2) False >>> 10**99 in range(0, 10**100, 2) True IIRC, there wasn't sufficient interest to get it backported to Python 2.7 in time for its release. Though as a pure optimization, one could argue that it would still be possible to get this into Python 2.7.2. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparison with False - something I don't understand

2010-12-02 Thread Mark Wooding
Harishankar writes: > There are some reasons why I hate exceptions but that is a different > topic. However, in short I can say that personally: > > 1. I hate try blocks which add complexity to the code when none is > needed. Try blocks make code much more unreadable in my view and I use it >

Re: Comparison with False - something I don't understand

2010-12-03 Thread Mark Wooding
Steven D'Aprano writes: > On Thu, 02 Dec 2010 16:35:08 +0000, Mark Wooding wrote: > > There are better ways to handle errors than Python's exception system. > > I'm curious -- what ways would they be? The most obvious improvement is resumable exceptions.

Re: Assigning to __class__ attribute

2010-12-03 Thread Mark Wooding
kj writes: > >>> class Spam(object): pass > > Now I define an instance of Spam and an instance of Spam's superclass: > >>> x = Spam() > >>> y = Spam.__mro__[1]() # (btw, is there a less uncouth way to do this???) There's the `__bases__' attribute, which is simply a tuple of the class's direct su

Re: Comparison with False - something I don't understand

2010-12-06 Thread Mark Wooding
Paul Rubin writes: > You know, I've heard the story from language designers several times > over, that they tried putting resumable exceptions into their languages > and it turned out to be a big mess, so they went to termination > exceptions that fixed the issue. That seems very surprising to m

Re: Resumable exceptions bad:

2010-12-06 Thread Mark Wooding
John Nagle writes: > Resumable exceptions were a popular idea in the early days of > programming. LISP, PL/I, and early COBOL had constructs which could > be considered resumable exceptions. They didn't work out well, > because the exception handler gets control in an ambiguous situation, > per

Re: Comparisons of incompatible types

2010-12-06 Thread Mark Wooding
Terry Reedy writes: > And indeed, code like this that has not been updated does break in > 3.x. to some people's annoyance. We really really cannot please > everyone ;-). The problem is that there are too many useful properties that one might expect from comparison operators. For example, it's

Re: Exception handling in Python 3.x

2010-12-06 Thread Mark Wooding
John Nagle writes: > Right. You're not entitled to assume that StopIteration is how a > generator exits. That's a CPyton thing; generators were a retrofit, > and that's how they were hacked in. Other implementations may do > generators differently. This is simply wrong. The StopIteration exc

Re: Comparison with False - something I don't understand

2010-12-06 Thread Mark Wooding
Carl Banks writes: > On Dec 6, 12:58 pm, [email protected] (Mark Wooding) wrote: > >         def toy(x, y): > >           r = restart('use-value') > >           with r: > >             if y == 0: > >               error(ZeroDivisionError()) > >

Re: Exception handling in Python 3.x

2010-12-07 Thread Mark Wooding
John Nagle writes: >PEP 255, like too much Python literature, doesn't distinguish > clearly between the language definition and implementation detail. It > says "The mechanics of StopIteration are low-level details, much like > the mechanics of IndexError in Python 2.1". Applications should

Re: Comparisons of incompatible types

2010-12-07 Thread Mark Wooding
John Nagle writes: [Stepanov] > makes the point that, for generic programs to work right, the basic > operations must have certain well-defined semantics. Then the same > algorithms will work right across a wide variety of objects. > > This is consistent with Python's "duck typing", but inconsis

Re: Comparisons of incompatible types

2010-12-07 Thread Mark Wooding
Carl Banks writes: > I think that feeling the need to sort non-homogenous lists is > indictative of bad design. Here's a reason you might want to. You're given an object, and you want to compute a hash of it. (Maybe you want to see whether someone else's object is the same as yours, but don't

Re: Comparison with False - something I don't understand

2010-12-08 Thread Mark Wooding
"OKB (not okblacke)" writes: > This is an interesting setup, but I'm not sure I see why you need > it. If you know that, in a particular context, you want toy(x, 0) to > result in 42 instead of ZeroDivisionError, ... and that's the point. You don't know whether you'll need it at the c

packaging python code in zip file

2010-12-09 Thread mark jason
ycode and zipping it without the __init__.py file . I am not sure which is the correct way. Can somebody advise me as to how I can package it better? thanks, mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparisons of incompatible types

2010-12-09 Thread Mark Wooding
John Nagle writes: > >>> NaN = float("nan") > >>> arr = [1.0, 4.0, 3.0, 2.0, 5.0, NaN, 6.0, 3.0, NaN, 0.0, 1.0, 4.0, > 3.0, 2.0, 5.0, NaN, 6.0, 3.0, NaN, 0.0] > >>> sorted(arr) > [0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 5.0, nan, 5.0, 6.0, > nan, 4.0, nan, 6.0, nan] > > The sorted

Re: win32 design pattern: COM localserver?

2010-12-09 Thread Mark Hammond
cess until everything is complete - the host program would then call this method just before it terminates. Also note there is a [email protected] mailing list where you might get better or more advice... Cheers, Mark On 8/12/2010 8:03 PM, [email protected] wrote: Greetings gurus.

printing error message from an Exception

2010-12-09 Thread mark jason
ocalError: local variable 'f' referenced before assignment Is there a way to overcome the DeprecationWarning? I wanted to print the error message from the IOError.How do I do this? Also ,what should I do about the UnboundLocalError? thanks and regards , mark -- http://mail.python.org/mailman/listinfo/python-list

Re: printing error message from an Exception

2010-12-10 Thread mark jason
) except Exception,e: display_message(e.args) handle_exception(e) thanks, mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparisons of incompatible types

2010-12-10 Thread Mark Wooding
Steven D'Aprano writes: > On Thu, 09 Dec 2010 12:21:45 +0000, Mark Wooding wrote: > > > John Nagle writes: > > >> "sort" has failed because it assumes that a < b and b < c implies a < > >> c. But that's not a valid assumption here

Re: ctypes question

2010-12-10 Thread Mark Tolonen
code, but I think you should pass the original "sn" pointer from smiGetNode() and not a pointer(sno). The values are not the same and the library probably relies on passing the original pointer back into smiGetNextNode. sn.contents returns a new SmiNode object so its pointer wi

PyArg_ParseTuple question

2010-12-13 Thread Mark Crispin
on all the data types), but I've been able to get a tremendous amount of work done in a very short period of time. Oh, I've made it SEGV a few times, but these were all blunders in my C module, such as a C method returning self to indicate success (oops!). Python is the best d

Re: PyArg_ParseTuple question

2010-12-14 Thread Mark Wooding
Mark Crispin writes: > In a C module, I want to pick up the arguments for a Python call like: > module.call("string1",["string2a", "string2b", "string2c"], "string3") > and stash these into: > char *arg1; > char

Re: ctypes question

2010-12-14 Thread Mark Tolonen
strings can be passed directly to c_char_p arguments. SmiGetNode = clibsmi.smiGetNode SmiGetNode.argtypes = [POINTER(SmiModule),c_char_p] SmiGetNode.restype = POINTER(SmiNode) oid = "1.3.6.1.2.1.2.2" sn=SmiGetNode(None,oid) Give these fixes a try... -Mark -- http://mail.python.org/mailman/listinfo/python-list

ANN: Shed Skin 0.7

2010-12-16 Thread Mark Dufour
see my blog for the full announcement: http://shed-skin.blogspot.com Or go straight to the homepage: http://shedskin.googlecode.com Please have a look at the tutorial, try it out, and report issues at the homepage. Thanks, Mark Dufour -- http://www.youtube.com/watch?v=E6LsfnBmdnk -- http

ANN: Shed Skin 0.7

2010-12-17 Thread Mark Dufour
oth has a GUI and uses the multiprocessing module in combination with a shedskin-generated extension module. thanks, mark. -- http://www.youtube.com/watch?v=E6LsfnBmdnk -- http://mail.python.org/mailman/listinfo/python-list

Re: If/then style question

2010-12-17 Thread Mark Wooding
Steve Holden writes: > I think the choice of keyword is probably not Guido's crowning > language achievement, I remember the behaviour by considering a typical application: for thing in things: if shinyp(thing): break else: raise DullError, 'nothi

Question regarding Higher-Order-Programming in Python

2010-12-22 Thread Mark Fink
I am about to learn Higher-Order-Programming with Lisp, Haskell, and Python. Some people who have gone completely out of their mind call this FP. In Haskell I learned that when I use map on a list it starts nesting as soon as I start adding elements. If I do not like the nesting I use ConcatMap.

Re: Question regarding Higher-Order-Programming in Python

2010-12-22 Thread Mark Fink
> >>> list(chain.from_iterable(starmap(product, izip(izip(dims.iterkeys()), > > dims.itervalues() > [('special', '+'), ('special', '-'), ('number', 1), ('number', 2), > ('number', 3), ('letter', 'a'), ('letter', 'b')] > > Peter so far I have never noticed chain.from_iterable, but many thanks t

Re: Regular expression for "key = value" pairs

2010-12-22 Thread Mark Wooding
Ciccio writes: > suppose I have: > > s='a=b, c=d' > > and I want to extract sub-strings a,b,c and d from s (and in general > from any longer list of such comma separated pairs). [...] > In [12]: re.findall(r'(.+)=(.+)', s) > Out[12]: [('a=b, c', 'd')] I think there are two logically separate job

Re: Regular expression for "key = value" pairs

2010-12-22 Thread Mark Wooding
André writes: > How about the following: > > >>> s = 'a=b,c=d' > >>> t = [] > >>> for u in s.split(','): > ... t.extend(u.split('=')) s = 'a = b = c, d = e' => ['a ', ' b ', ' c', ' d ', ' e'] Ugh. -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list

Re: How can a function find the function that called it?

2010-12-24 Thread Mark Wooding
kj writes: > But OrderedDict's functionality *requires* that its __init__ be > run, and this __init__, in turn, does part of its initialization > by calling the update method. > > Therefore, the update method of the new subclass needs to be able > to identify the calling function in order to make

Re: string u'hyv\xe4' to file as 'hyvä'

2010-12-26 Thread Mark Tolonen
s in your string constants (ä instead of \xe4). Make sure to use a text editor that can save in UTF8, or use the correct coding comment for whatever encoding in which you save the file. # coding: utf8 import codecs item=u'hyvä' F=codecs.open('finnish.txt', 'w+', 'utf8') F.write(item) F.close() -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: round in 2.6 and 2.7

2010-12-27 Thread Mark Dickinson
t of the example the OP gave would be 9.9 exactly. But since 9.9 isn't exactly representable as a Python float, we necessarily get an approximation. The language above is intended to convey that it's the 'correctly rounded' approximation---that is, the closest Python float to the true value of 9.9 (with halfway cases rounded to even, as usual). Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: round in 2.6 and 2.7

2010-12-29 Thread Mark Dickinson
its values are positive. It's also slightly unsettling usage for me, not least because the statement 'f is correctly rounded' for a floating-point function f is really a statement about *two* functions: namely, f (a function from floating-point numbers to floating-point numbers) and the true mathematical function that it's based on; the identity of the underlying mathematical function is left implicit. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

wx Just Print!

2011-01-14 Thread Mark Carter
I'm using Python 2.6.5. I would like to be able to print an RTF file, with no prompts for printers or anything like that. Here's the code so far: import wx.richtext rtp = wx.richtext.RichTextPrinting() rtp.PrintFile('C:\\path\\to\\file.rtf') When I run it, it says: ... assert "(wxThePrintPaperDat

Re: [python-committers] [RELEASED] Python 3.2 rc 1

2011-01-16 Thread Mark Summerfield
ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='a' encoding='UTF-8'> which looks pretty good:-) However, I hit a problem with relative imports not working (compared with 3.1). I have to go now but will try to produce a small example if I can.

Re: [python-committers] [RELEASED] Python 3.2 rc 1

2011-01-17 Thread Mark Summerfield
2011, 08:32:59) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from Graphics.Vector import * Traceback (most recent call last): File "", line 1, in File "Graphics/Vector/Sv

Re: [Python-Dev] [python-committers] [RELEASED] Python 3.2 rc 1

2011-01-17 Thread Mark Summerfield
On Mon, 17 Jan 2011 09:23:39 -0500 "R. David Murray" wrote: > On Mon, 17 Jan 2011 08:33:42 +, Mark Summerfield > wrote: > > from ..Graphics import Xpm > > SVG = 1 > > > > I can do the relative import with Python 3.0 and 3.1 but not with > > 3.2

Re: Tkinter: The good, the bad, and the ugly!

2011-01-18 Thread Mark Roseman
If you guys spent 1/10th as much time articulating the problems you see with Tkinter (and being willing to listen when people offer solutions) as you do trying to convince everyone else you're right, you'd probably have ... well, anyway, no sense in being practical. -- http://mail.python.org/ma

Re: Tkinter: The good, the bad, and the ugly!

2011-01-19 Thread Mark Roseman
and significant limitation of Tk. I will attempt to find out if there has been any work done in this area with Tk, and what it would take to address this important issue. Thanks again Mark -- http://mail.python.org/mailman/listinfo/python-list

Printing RTF file under win32

2011-01-21 Thread Mark Carter
I'm using Python 2.6.5 on win32. I would like to print a batch of RTF files on a printer. I don't want to use the win32api.ShellExecute command because that invokes Word, and Word has been configured in a strange way by one of our admins, making it inconvenient to use. What should I do? -- http:/

Re: WxPython versus Tkinter.

2011-01-24 Thread Mark Roseman
nt requirements and priorities, the "best" solution will be different. I don't object and in fact commend you for advocating for accessibility. I do feel you are not acknowledging and fully respecting that others may be in situations where accessibility may not be the primar

Re: WxPython versus Tkinter.

2011-01-24 Thread Mark Roseman
lkits would be very receptive to people who could help make developing accessible applications with their toolkits feasible. (And if/when this does get done for Tk, I promise at least to make sure that the tutorial at http:///www.tkdocs.com covers this topic). Mark -- http://mail.python.org/mail

Re: Which is the best book to learn python

2011-01-25 Thread Mark Summerfield
On Jan 24, 5:09 pm, santosh hs wrote: > Hi All, > i am beginner to python please tell me which is the best available > reference for beginner to start from novice If you want to learn Python 3 and have some prior programming experience (in any modern procedural or object oriented language), you m

Re: Decorator question

2011-01-27 Thread Mark Summerfield
his class (A.foo, for instance) should not > >execute as long as this boolean is false, but should instead raise an > >exception. > > >Can I use a decorator to implement this functionality?  More exactly, > >could I define a function called 'checker' that

Re: WxPython versus Tkinter.

2011-01-27 Thread Mark Roseman
Python including a Tcl interpreter to use Tk, I'd be happy to try to explain or address them. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: WxPython versus Tkinter.

2011-01-27 Thread Mark Roseman
that are used everywhere inside Tk. But none of those calls mean a trip through the Tcl interpreter per se. Every dynamic language would have similar internals of course, though with slight differences and different API's. Mark -- http://mail.python.org/mailman/listinfo/python-list

wx.Frame hidden, and customising the close button

2011-02-11 Thread Mark Carter
Is there a way of testing whether a frame (suppose I have it as a variable my_frame) is hidden in wxPython? Also, is there a way that I can over-ride the close button so that the frame becomes hidden rather than destroyed, and perform supplementary tests? -- http://mail.python.org/mailman/listinf

Re: wx.Frame hidden, and customising the close button

2011-02-11 Thread Mark Carter
On Feb 11, 1:39 pm, Vlastimil Brom wrote: > (wxPython-specific questions may be rather discussed  on that > maillist:http://groups.google.com/group/wxpython-users/topics?pli=1 Just the ticket! Many thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: [python-committers] [RELEASED] Python 3.2 rc 3

2011-02-14 Thread Mark Summerfield
les" in What's New in alphabetical order? -- Mark Summerfield, Qtrac Ltd, www.qtrac.eu C++, Python, Qt, PyQt - training and consultancy Programming in Python 3" - ISBN 0321680561 http://www.qtrac.eu/py3book.html -- http://mail.python.org/mailman/listinfo/python-list

Re: An amazing one-minute bit of fun at the interactive prompt

2011-02-21 Thread Mark Dickinson
not, do you have any references? Maybe you should have saved this for March 14th... Mark -- http://mail.python.org/mailman/listinfo/python-list

upcoming Python training in Florida, April 27-29

2010-04-06 Thread Mark Lutz
ation instructions, please visit the class web page: http://learning-python.com/2010-public-classes.html If you are unable to attend in April, our next Sarasota class is already scheduled for July 13-15. Thanks, and we hope to see you at a Python class in Florida soon. --Mark Lutz (lutz at lea

Re: Why these don't work??

2010-04-08 Thread Mark Dickinson
.org/ The best method for installing numpy would depend on your system, and on where you got Python from. On OS X, the system Python comes with numpy as standard, for example. On Linux, there's probably a python26- numpy package (or something with a similar name) that you can install. On Windows: no idea. :) Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Line Intersection

2010-04-09 Thread Mark Tolonen
should not have forgotten that precondition). And parallel lines, where m and n are equal (divide-by-zero)... -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.7 beta 1

2010-04-12 Thread Mark Lawrence
it gets me there in the end. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Re: Tempering Client Expectations (OT)

2010-04-12 Thread Mark Lawrence
st a brick wall. Democracy, please don't make me laugh. Oh, and see this http://www.computerweekly.com/Articles/2010/01/14/239954/ faulty-safety-critical-software-changed-after-fatal-mull.htm Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes question

2010-04-14 Thread Mark Dickinson
) >>> libc >>> printf = libc.printf >>> printf.argtypes = [c_char_p, c_int] >>> printf("%d\n", 53) 53 3 >>> printf("%d\n", "asdf") Traceback (most recent call last): File "", line 1, in ctypes.ArgumentError: argument 2: : wrong type -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: user rights and python com servers

2010-04-15 Thread Mark Hammond
2com doesn't support that directly it shouldn't be hard to support this with a few changes to win32com\server\register.py HTH, Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe saga continues...

2010-04-15 Thread Mark Hammond
e dirs holding things. Spambayes has a complicated setup file which may offer some insights - find the spambayes source at sourceforge then look for the spambayes/spambayes/windows/py2exe/setup_all.py file for inspiration... HTH, Mark. -- http://mail.python.org/mailman/listinfo/python-list

Re: python wia and RegisterEvent

2010-04-15 Thread Mark Hammond
manager = win32com.client.DispatchWithEvents("WIA.DeviceManager", MgrHandlerClass) manager.RegisterEvent(EventID=constants.wiaEventDeviceConnected,DeviceID=u'*') manager.RegisterEvent(EventID=constants.wiaEventDeviceDisconnected,DeviceID=u'*') And magically your OnEvent

<    45   46   47   48   49   50   51   52   53   54   >