Comments (4)
There is an overload in the parser which does this, Parser.ParseFile(bool makeModule, bool returnValue). Passing true for returnValue causes this behavior. If you use the SourceCodeKind.AutoDetect itβll flow true in for the returnValue and you should see the desired behavior.
From: Doug Blank [mailto:[email protected]]
Sent: Saturday, April 19, 2014 5:50 AM
To: IronLanguages/main
Subject: [main] Allow SourceCodeKind statements to return value (#190)
IronPython, similar to CPython, has modes for how to evaluate code. Expressions will return a value, but I don't think any of the statement-oriented evaluations will return a value. However, IPython has another manner of executing code that will return the last expression, even if after a set of statements. For example, if you enter this in a cell:
x = 1
y = 2
x + y
You'll get "3" as output. The way that they do that is to parse the input, and evaluate each statement, returning the result of the last one. This is really handy when doing cell-based computation as it allows the last item to be displayed/viewed/used.
It would be nice if IronPython allowed this type of evaluation.
SourceKinds:
https://github.com/IronLanguages/main/blob/master/Runtime/Microsoft.Scripting/SourceCodeKind.cs
β
Reply to this email directly or view it on GitHubhttps://github.com//issues/190.
from main.
Thank you; that worked like a charm!
from main.
Can we close out this issue then?
from main.
From my perspective, yes. I don't know if this documented anywhere... that might be the only action item from this. Thanks!
from main.
Related Issues (20)
- Python 3 HOT 2
- test_math_cpy fails in 64-bit
- Upgrade pip to 9.0.1 HOT 3
- Links in you site HOT 1
- Drop support for Microsoft.Scripting.Core HOT 1
- Drop support for Silverlight HOT 1
- Switch to using IronLanguages/dlr HOT 1
- Move IronLanguages/main to IronLanguages/ironpython2? HOT 1
- Application does not run on mono 5 runtime. HOT 2
- Crash in WeakRefTracker finalizer with mono 5 HOT 1
- json module raise error when run with -X:Python30 argument. HOT 1
- traceback.format_exc() not working HOT 4
- Misleading ArgumentTypeException message when calling C# method HOT 6
- IronPython 2.7.7 is not compatible with dotnet core 1.1 HOT 1
- Crash when using unquote_plus HOT 1
- Strange behavior of symbolic group name on regular expression module. HOT 1
- PARSINGCONTEXT can be used as ASTCONTEXT in the Expression nodes of IRony.Interpreter??Can anyone suggest please? HOT 1
- Looking to save file into AWS S3 bucket using IronPython? HOT 1
- Does not build with current Mono HOT 1
- weakref.ref object sometimes returns None in a mulithreaded scenario HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from main.