[IronPython] import this

2006-10-18 Thread Gary Stephenson
At the risk of appearing flippant, I'd like to suggest that the following should be considered an error in need of correction. <0.5wink> IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> import this Traceback (most recent call last

Re: [IronPython] true division?

2006-09-21 Thread Gary Stephenson
Hi John > The difference in this case is that IronPython has special-cased the > "from __future__ import whatever" caper -- there is no module called > __future__ in IronPython. Note the different error messages below: > > | >>> from __future__ import somerubbish > | Traceback (most recent call la

Re: [IronPython] true division?

2006-09-21 Thread Gary Stephenson
uot;John Machin" <[EMAIL PROTECTED]> To: "Discussion of IronPython" Sent: Friday, September 22, 2006 10:05 AM Subject: Re: [IronPython] true division? > On 22/09/2006 8:10 AM, Michael Foord wrote: >> Gary Stephenson wrote: >>> Thanks John (and Seo), >>

Re: [IronPython] true division?

2006-09-21 Thread Gary Stephenson
mber 22, 2006 8:10 AM Subject: Re: [IronPython] true division? > Gary Stephenson wrote: >> Thanks John (and Seo), >> >> When I attempt the same thing I get: >> > Of course. The correct syntax is: >>>> from __future__ import division > > ;-) > >

Re: [IronPython] true division?

2006-09-21 Thread Gary Stephenson
n? > On 21/09/2006 7:27 PM, Sanghyeon Seo wrote: >> 2006/9/21, Gary Stephenson <[EMAIL PROTECTED]>: >>> Is there a way to get true division in ipy without using the -Qnew >>> command >>> line option? On a per-module or per-instance basis? >>>

[IronPython] true division?

2006-09-21 Thread Gary Stephenson
Is there a way to get true division in ipy without using the -Qnew command line option? On a per-module or per-instance basis? "from __future__ import true_division" returns "SyntaxError: future feature is not defined: true_division" I see in the Issue Tracker for work item 2206 it says f

Re: [IronPython] How to dynamically define and call a function?

2006-09-18 Thread Gary Stephenson
d'oh! I knew there must have been a straightforward way. I'm still curious as to how to use the IronPython.Hosting stuff though, as I thinkultimately it might prove to be more what I'm really after. thanks, gary > This works for me: > > IronPython 1.0.2449 on .NET 2.0.50727.42 > Copyright (

[IronPython] How to dynamically define and call a function?

2006-09-18 Thread Gary Stephenson
hi, I confess to being a newbie at this sort of thing in Python or IronPython, so I'm hoping that there is a simple answer to the subject question. I started off trying to use standard "compile()" function and "exec" statement, but was unable to make it work, although I'm sure there must be a

[IronPython] Descriptor/metaclass problems

2006-09-14 Thread Gary Stephenson
Hi, The following code works perfectly in CPython, but is all over the shop in ipy :-( Any ideas on how I might make it work in ipy? class valueDescriptor(object): def __init__(self,x=None): self.value = x def __get__(self,ob,cls): return self.value def __set__(self,

Re: [IronPython] Traceback Objects?

2006-09-05 Thread Gary Stephenson
maybe it is a bug, or you can use traceback for simple things but not printing the stack or maybe it only affects Australians like you and me. Regards Mark On 9/5/06, Gary Stephenson <[EMAIL PROTECTED]> wrote: > My third attempt at asking this question (as the previous two went through > to th

[IronPython] Traceback Objects?

2006-09-04 Thread Gary Stephenson
My third attempt at asking this question (as the previous two went through to the 'keeper) ... Is the following considered a bug in IronPython, or am I doing something wrong? import sys def test(): try: raise Exception() except Exception, oErr: print sys.exc_info()[2]

Re: [IronPython] Traceback support?

2006-09-03 Thread Gary Stephenson
I got no response from this the first time, so, at the risk of appearing rude, I will ask again: How do I get a hold of a Traceback object, or is it not currently possible? thanks, gary - Original Message - From: "Gary Stephenson" <[EMAIL PROTECTED]> To: "Dis

[IronPython] Traceback support?

2006-09-01 Thread Gary Stephenson
In the release notes for Beta 4 it mentions "Traceback support", but try as I might I can't seem to get my hands on a Traceback object. Am I doing something wrong? thanks in advance, gary import sys def test(): try: raise Exception() except Exception, oErr: print sy

[IronPython] Convert Byte[] to string?

2006-08-28 Thread Gary Stephenson
What is the best way to convert a Byte[] to a string? The best I've been able to come up with is "".join( [chr(x) for x in bytearr] ) but I just know there are better ways than that - surely .. thanks in advance, gary ___ users mailing list us

[IronPython] locals() usage

2006-08-19 Thread Gary Stephenson
I discovered in my playing that ipy allows the following use (abuse?) of locals(): def test2( dic, nm ): dic[nm] = 5 def test() x = 10 test2( locals(), "x" ) print x # prints 5 in ipy and 10 in CPython 2.4 test() My question is, is this by design? Can it be relied upon, or wi

[IronPython] Callstack inspection

2006-08-15 Thread Gary Stephenson
I would like to adapt the following code to IronPython, but there appears to be no inspect module available. Any clues on how I might proceed? many tias, gary # code begins # a hack to support something like dynamically scoped variables import inspect class _gsDynamicVars( object ): def