[IronPython] Execfile in IronPython 2.0 slower then 1.1

2009-05-14 Thread Cenovsky, Lukas
I was playing yesterday with something and found that execfile is about
10 times slower in Ironpython 2.0 then in 1.1.
Does anyone have an idea why?

Here is the snippet:

from time import time
f = open('test.txt', 'w')
f.write('res = []\n')
f.write("res.append({'1': 'one', '2': 'two'})\n"*1)
f.close()
t = time()
execfile('test.txt')
print 'Execfile took:', time() - t

Ironpython 1.1:
Execfile took: 5.37503814697

Ironpython 2.0:
Execfile took: 50.3440628052

PS: I know the example is stupid - I'm just wondering why such
difference?

--
-- Lukas

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] IronPython 2.6 CodePlex Source Update

2009-05-14 Thread merllab
This is an automated email letting you know that sources 
have recently been pushed out.  You can download these newer 
sources directly from 
http://ironpython.codeplex.com/SourceControl/changeset/view/50318.

ADDED SOURCES
$/IronPython/IronPython_Main/Src/IronPython/Runtime/ModuleGlobalCache.cs
$/IronPython/IronPython_Main/Doc/IronPython.css
$/IronPython/IronPython_Main/Doc

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Ast/DebugViewWriter.cs

DELETED SOURCES

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Ast/ExpressionWriter.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Runtime/ModuleGlobalWrapper.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Runtime/ModuleGlobalCache.cs

MODIFIED SOURCES
$/IronPython/IronPython_Main/Src/IronPython/Runtime/ModuleGlobalCache.cs
$/IronPython/IronPython_Main/Doc/IronPython.css

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Ast/DebugViewWriter.cs
$/IronPython/IronPython_Main/Src/Tests/Modes/ConsoleHelp.out

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Microsoft.Scripting.Core.csproj

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Properties/AssemblyInfo.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Properties/ExtensionAssemblyInfo.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Dynamic/Properties/AssemblyInfo.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Utils/ThreadLocal.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Microsoft.Scripting.csproj

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Actions/NestedTypeTracker.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Expressions.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Ast/Expression.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Properties/AssemblyInfo.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Runtime/LanguageContext.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting/Actions/TypeGroup.cs

$/IronPython/IronPython_Main/Src/Runtime/Microsoft.Scripting.Core/Actions/CallSiteRule.cs
$/IronPython/IronPython_Main/Src/Tests/pyc/test_pyc.ps1

$/IronPython/IronPython_Main/Src/IronPython/Runtime/PythonFunction.Generated.cs
$/IronPython/IronPython_Main/Config/Unsigned/App.config
$/IronPython/IronPython_Main/Config/Signed/App.config
$/IronPython/IronPython_Main/Src/IronPython/Runtime/Bytes.cs
$/IronPython/IronPython_Main/Src/Tests/test_bytes.py

$/IronPython/IronPython_Main/Src/IronPython/Runtime/Binding/PythonGetMemberBinder.cs
$/IronPython/IronPython_Main/Src/IronPython/Runtime/PythonOptions.cs
$/IronPython/IronPython_Main/Src/App.config

$/IronPython/IronPython_Main/Src/IronPython/Runtime/Binding/MetaPythonFunction.cs

$/IronPython/IronPython_Main/Src/IronPython/Runtime/Binding/PythonBinder.cs

$/IronPython/IronPython_Main/Src/IronPython/Runtime/Operations/ScopeOps.cs

$/IronPython/IronPython_Main/Src/IronPython/Compiler/PythonCallTargets.cs

$/IronPython/IronPython_Main/Src/IronPython/Compiler/PythonCompilerOptions.cs
$/IronPython/IronPython_Main/Src/IronPython/Runtime/Types/TypeInfo.cs
$/IronPython/IronPython_Main/Src/IronPython/Runtime/sys.cs

$/IronPython/IronPython_Main/Src/IronPython/Runtime/Types/ConstructorFunction.cs

$/IronPython/IronPython_Main/Src/IronPython/Runtime/Operations/TypeGroupOps.cs
$/IronPython/IronPython_Main/Src/Tests/test_sys.py
$/IronPython/IronPython_Main/Src/AssemblyVersion.cs

$/IronPython/IronPython_Main/Src/IronPython/Runtime/Exceptions/TraceBack.cs

$/IronPython/IronPython_Main/Src/IronPython/Runtime/Operations/PythonOps.cs
$/IronPython/IronPython_Main/Src/IronPython/Runtime/Generator.cs
$/IronPython/IronPython_Main/Src/IronPython/Runtime/PythonContext.cs
$/IronPython/IronPython_Main/Src/Tests/test_tuple.py
$/IronPython/IronPython_Main/Src/Tests/test_function.py
$/IronPython/IronPython_Main/Src/Tests/test_file.py
$/IronPython/IronPython_Main/Src/Tests/test_cStringIO.py
$/IronPython/IronPython_Main/Src/Tests/test_builtinfunc.py
$/IronPython/IronPython_Main/Src/Tests/test_buffer.py

$/IronPython/IronPython_Main/Src/IronPython/Hosting/PythonOptionsParser.cs

$/IronPython/IronPython_Main/Src/IronPython/Compiler/Ast/SuiteStatement.cs
$/IronPython/IronPython_Main/Src/Scripts/generate_calls.py
$/IronPython/IronPytho

Re: [IronPython] Sympl Language Sample and Walkthrough Document

2009-05-14 Thread Dino Viehland
One of the really cool things about Sympl that I think is worth emphasizing is 
the version that's implemented in IronPython.  Not only is it the 1st language 
I know if implemented in IronPython but it's able to do cool stuff like create 
IDynamicMetaObjectProvider implementation from Pythons objects which are 
already dynamic objects!  Now we just need to get some interested in writing 
IpyIpy :)

From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Bill Chiles
Sent: Wednesday, May 13, 2009 5:00 PM
To: d...@discussions.codeplex.com
Cc: users@lists.ironpython.com
Subject: [IronPython] Sympl Language Sample and Walkthrough Document

There's a new DLR sample to which I wanted to draw folks' attentions.  There is 
a small language implementation sample, implemented in both IronPython and C#, 
with an accompanying walkthrough document.  The code is now on the DLR Codeplex 
site under ...\Languages\Sympl, and the document is on the "Documents and 
Specs" page which you can get to from the list of links on the home page.  
Under the Sympl directory is also an examples directory with some code written 
in Sympl, which all runs when you execute Main in program.cs.  The code and 
document will be in zip files we will produce to go along with the VS Beta1 
release coming soon.

Sympl demonstrates how to implement a very simple language using the Dynamic 
Language Runtime (DLR) as it ships in .NET 4.0.  The goal is to make you aware 
of how to get started building a language on the DLR.  Sympl does not show 
production quality rich .NET interoperability and binding logic.  It does walk 
you through the following:

 *   Using DLR Expression Trees (which include LINQ Expression Trees v1) for 
code generation
 *   Using DLR dynamic dispatch caching
 *   Building runtime binders
 *   Building dynamic objects and dynamic meta-objects
 *   Supporting dynamic language/object interoperability
 *   Very simple hosting with application supplied global objects
 *   Basic arithmetic and comparison operators with fast DLR dispatch caching
 *   Control flow
 *   Name binding within Sympl
 *   Method and top-level function invocation with fast DLR dispatch caching
 *   Very simple .NET interoperability for runtime method and operation binding
 *   Using the DLR's built-in COM binding
 *   Closures
 *   Assignment with various left-hand-side expressions
Sympl does not yet demonstrate using any Codeplex-only DLR code such as the 
DefaultBinder, the faster and nicer .NET reflection trackers (Sympl's is 
painfully slow and simple), or the common DLR hosting (yet).

A few caveats on the documentation.  First, the walk through document still 
needs some polishing, but I wanted to get it out to people.  Feel free to send 
me comments or ask questions.  Second, the document refers to a couple of other 
documents on our Codeplex site, but we haven't updated some of them since DEC 
08.  Those will be updated in the next couple of weeks.  I think the sympl.doc 
walkthrough is very readable on its own and has all the relevant code snippets 
included in it as well.  Lastly, while the example is overall reasonably 
simple, it does demonstrate all the basic concepts of building a language on 
the DLR with explanations, and therefore, is quite long.  However, the document 
unfolds in the same way the Sympl language implementation evolved, so it 
progresses well for incrementally increasing your awareness of how to build a 
language on the DLR.

Hope you enjoy and find this code and doc helpful!

Cheers,
Bill


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Execfile in IronPython 2.0 slower then 1.1

2009-05-14 Thread Dino Viehland
I believe there's a code gen issue here w/ the DLR.  In 1.x we generate 
3 local variables in the gigantic method that this ends up generating. 

In 2.0 we generate a bigger method but more importantly we're generating
10002 local variables which causes the JIT to spend a long time analyzing
those locals (nearly 60% of the time is spent in one function in the JIT
doing variable analysis while over 80% of the time is spent JITing).

In the 2.6 branch this issue is already mitigated because we will no 
longer compile modules (unless they're pre-compiled of course) - we now 
interpret them instead.  That makes a lot more sense for top level code
which only executes once but you'd still hit this problem if you put
it into a method and then executed that method several times.  But I'll
report this issue to the DLR team as they should be able to share
locals instead of creating new ones over and over again.

Thanks for bringing this up it's a nice scenario we're handling quite
poorly.

> -Original Message-
> From: users-boun...@lists.ironpython.com [mailto:users-
> boun...@lists.ironpython.com] On Behalf Of Cenovsky, Lukas
> Sent: Thursday, May 14, 2009 2:36 AM
> To: users@lists.ironpython.com
> Subject: [IronPython] Execfile in IronPython 2.0 slower then 1.1
> 
> I was playing yesterday with something and found that execfile is about
> 10 times slower in Ironpython 2.0 then in 1.1.
> Does anyone have an idea why?
> 
> Here is the snippet:
> 
> from time import time
> f = open('test.txt', 'w')
> f.write('res = []\n')
> f.write("res.append({'1': 'one', '2': 'two'})\n"*1)
> f.close()
> t = time()
> execfile('test.txt')
> print 'Execfile took:', time() - t
> 
> Ironpython 1.1:
> Execfile took: 5.37503814697
> 
> Ironpython 2.0:
> Execfile took: 50.3440628052
> 
> PS: I know the example is stupid - I'm just wondering why such
> difference?
> 
> --
> -- Lukas
> 
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Doing Simple Math In Silverlight

2009-05-14 Thread Andrew Evans
Hello

I am trying to perform some math operations in Silverlight

inputNum1 and inputNum2 are of TextBox

inputNum1 = TextBox()
inputNum2 = TextBox()

result0 = int(inputNum1) + int(inputNum2)
res0.Text = str(result0)

I get the following error


TypeError: expected int, got TextBox

Any ideas
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Doing Simple Math In Silverlight

2009-05-14 Thread Dino Viehland
I think you want something like:

result0 = int(inputNum1.Text) + int(inputNum2.Text)


From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Andrew Evans
Sent: Thursday, May 14, 2009 3:19 PM
To: Discussion of IronPython
Subject: [IronPython] Doing Simple Math In Silverlight

Hello

I am trying to perform some math operations in Silverlight

inputNum1 and inputNum2 are of TextBox

inputNum1 = TextBox()
inputNum2 = TextBox()

result0 = int(inputNum1) + int(inputNum2)
res0.Text = str(result0)

I get the following error

TypeError: expected int, got TextBox

Any ideas
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Doing Simple Math In Silverlight

2009-05-14 Thread Michael Foord

Andrew Evans wrote:

Hello

I am trying to perform some math operations in Silverlight

inputNum1 and inputNum2 are of TextBox

inputNum1 = TextBox()
inputNum2 = TextBox()

result0 = int(inputNum1) + int(inputNum2)

That's because you can't cast text boxes to integers!

You need something like:

   result0 = int(inputNum1.Text) + int(inputNum2.Text)

You'll probably want to strip whitespace and also handle the error case 
where what the user has entered is not a valid integer.


HTH

Michael

res0.Text = str(result0)

I get the following error

 
TypeError: expected int, got TextBox


Any ideas


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
  



--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Doing Simple Math In Silverlight

2009-05-14 Thread Andrew Evans
Hey guys thank you

and thanks Michael will look into whitespace and error handling :-)

just wanted it to work :-P



On Thu, May 14, 2009 at 3:21 PM, Michael Foord wrote:

> Andrew Evans wrote:
>
>> Hello
>>
>> I am trying to perform some math operations in Silverlight
>>
>> inputNum1 and inputNum2 are of TextBox
>>
>> inputNum1 = TextBox()
>> inputNum2 = TextBox()
>>
>>result0 = int(inputNum1) + int(inputNum2)
>>
> That's because you can't cast text boxes to integers!
>
> You need something like:
>
>   result0 = int(inputNum1.Text) + int(inputNum2.Text)
>
> You'll probably want to strip whitespace and also handle the error case
> where what the user has entered is not a valid integer.
>
> HTH
>
> Michael
>
>>res0.Text = str(result0)
>>
>> I get the following error
>>
>>  TypeError: expected int,
>> got TextBox
>>
>> Any ideas
>> 
>>
>> ___
>> Users mailing list
>> Users@lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>>
>
>
> --
> http://www.ironpythoninaction.com/
> http://www.voidspace.org.uk/blog
>
>
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Doing Simple Math In Silverlight

2009-05-14 Thread Andrew Evans
Just a quick question also

is it possible to connect to a mysql database through silverlight and Iron
Python

And if so anyone have an example


*cheers

On Thu, May 14, 2009 at 3:34 PM, Andrew Evans wrote:

> Hey guys thank you
>
> and thanks Michael will look into whitespace and error handling :-)
>
> just wanted it to work :-P
>
>
>
>
> On Thu, May 14, 2009 at 3:21 PM, Michael Foord 
> wrote:
>
>> Andrew Evans wrote:
>>
>>> Hello
>>>
>>> I am trying to perform some math operations in Silverlight
>>>
>>> inputNum1 and inputNum2 are of TextBox
>>>
>>> inputNum1 = TextBox()
>>> inputNum2 = TextBox()
>>>
>>>result0 = int(inputNum1) + int(inputNum2)
>>>
>> That's because you can't cast text boxes to integers!
>>
>> You need something like:
>>
>>   result0 = int(inputNum1.Text) + int(inputNum2.Text)
>>
>> You'll probably want to strip whitespace and also handle the error case
>> where what the user has entered is not a valid integer.
>>
>> HTH
>>
>> Michael
>>
>>>res0.Text = str(result0)
>>>
>>> I get the following error
>>>
>>>  TypeError: expected int,
>>> got TextBox
>>>
>>> Any ideas
>>> 
>>>
>>> ___
>>> Users mailing list
>>> Users@lists.ironpython.com
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>
>>>
>>
>>
>> --
>> http://www.ironpythoninaction.com/
>> http://www.voidspace.org.uk/blog
>>
>>
>> ___
>> Users mailing list
>> Users@lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>
>
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Doing Simple Math In Silverlight

2009-05-14 Thread Jimmy Schementi
Not directly, you can use Silverlight to connect to a web service which uses a 
database.

db40 got my attention a while ago for somehow hearing that it worked in SL, and 
stores everything in IsolatedStorage, but I never investigated it.

From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Andrew Evans
Sent: Thursday, May 14, 2009 3:59 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Doing Simple Math In Silverlight

Just a quick question also

is it possible to connect to a mysql database through silverlight and Iron 
Python

And if so anyone have an example


*cheers
On Thu, May 14, 2009 at 3:34 PM, Andrew Evans 
mailto:andrew.ca...@gmail.com>> wrote:
Hey guys thank you

and thanks Michael will look into whitespace and error handling :-)

just wanted it to work :-P



On Thu, May 14, 2009 at 3:21 PM, Michael Foord 
mailto:fuzzy...@voidspace.org.uk>> wrote:
Andrew Evans wrote:
Hello

I am trying to perform some math operations in Silverlight

inputNum1 and inputNum2 are of TextBox

inputNum1 = TextBox()
inputNum2 = TextBox()

   result0 = int(inputNum1) + int(inputNum2)
That's because you can't cast text boxes to integers!

You need something like:


  result0 = int(inputNum1.Text) + int(inputNum2.Text)
You'll probably want to strip whitespace and also handle the error case where 
what the user has entered is not a valid integer.

HTH

Michael
   res0.Text = str(result0)

I get the following error
 TypeError: expected int, got 
TextBox

Any ideas


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] adding image to simple GUI

2009-05-14 Thread Vadim Khaskel

It should take a second or two, but I see this message:

Value cannot be null.
Parameter name docData

it happens when I select BackgroundImage control for any gui component in 
IronPython Visual Studio.

What do I do wrong?

thanks for help,

V.

_
HotmailĀ® goes with you. 
http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Add Image to Button Silverlight

2009-05-14 Thread Andrew Evans
Hi I am wondering how I can add an image to my button with out using a xaml
File

also before I go further

I notice there are two different ways for doing things using xaml files and
Loading them or using pure Python which one would you recommend

*cheers
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com