ironlanguages / ironpython3 Goto Github PK
View Code? Open in Web Editor NEWImplementation of Python 3.x for .NET Framework that is built on top of the Dynamic Language Runtime.
License: Apache License 2.0
Implementation of Python 3.x for .NET Framework that is built on top of the Dynamic Language Runtime.
License: Apache License 2.0
http://www.python.org/dev/peps/pep-0409/.
Requires PEP 3134 (#3).
As per 3.0 xrange is renamed to range and range (list) is gone.
As per 3.0 range must conform to int/long unification and return longs.
Reference: https://docs.python.org/3.4/library/stdtypes.html#ranges
http://www.python.org/dev/peps/pep-0383/
May already be implemented.
http://www.python.org/dev/peps/pep-3100/
A lot of stuff is covered in here; there really should have been multiple PEPs. More issues should be created from this.
Hi
I think the title explains it all, also a question of stability
Many thanks
in Python3, the module __builtin__
has been renamed to builtins
(out of stackoverflow)
http://docs.python.org/3.4/reference/executionmodel.html#naming-and-binding
http://docs.python.org/2.7/reference/executionmodel.html#naming-and-binding
There is nothing in PEPs or release notes I can find about it. Documentation says, it is an cpython implementation detail, but it must be an important one since StdLib has 41 hits on import builtins
Src/IronPython/Lib/iptest
Go over http://docs.python.org/3.4/whatsnew/3.4.html for anything that doesn't have a PEP and create an issue for it.
If a test case has a simple syntax error, there is no python stacktrace to track it down.
$ ./IronPythonTestConsole.exe IronPythonTest -noh -labels -full -test:IronPythonTest.Cases.IronPythonCases.test_bool
Runtime Environment -
OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
.NET Version: 4.0.30319.18444
***** IronPythonTest.DLL
***** IronPythonCases
***** IronPythonTests
***** test_bool
Tests run: 1, Passed: 0, Errors: 1, Failures: 0, Inconclusive: 0
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
Elapsed time: 00:00:00.5840000
Errors and Failures:
1) test_bool (IronPythonTest.Cases.IronPythonCases.test_bool)
Microsoft.Scripting.SyntaxErrorException : invalid syntax
at Microsoft.Scripting.ErrorSink.Add(SourceUnit source, String message, SourceSpan span, Int32 errorCode, Severity severity)
at IronPython.Compiler.Parser.ReportSyntaxError(Int32 start, Int32 end, String message, Int32 errorCode) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 375
at IronPython.Compiler.Parser.ReportSyntaxError(Int32 start, Int32 end, String message) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 367
at IronPython.Compiler.Parser.ReportSyntaxError(String message) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 363
at IronPython.Compiler.Parser.AddTrailers(Expression ret, Boolean allowGeneratorExpression) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 2296
at IronPython.Compiler.Parser.AddTrailers(Expression ret) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 2255
at IronPython.Compiler.Parser.ParsePower() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 2141
at IronPython.Compiler.Parser.ParseFactor() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 2107
at IronPython.Compiler.Parser.ParseExpr(Int32 precedence) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 2070
at IronPython.Compiler.Parser.ParseExpr() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 2066
at IronPython.Compiler.Parser.ParseComparison() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 2024
at IronPython.Compiler.Parser.ParseNotTest() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 2018
at IronPython.Compiler.Parser.ParseAndTest() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 2001
at IronPython.Compiler.Parser.ParseOrTest() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 1983
at IronPython.Compiler.Parser.ParseExpression() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 1971
at IronPython.Compiler.Parser.ParseTestListAsExpr() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 2635
at IronPython.Compiler.Parser.ParseExprStmt() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 708
at IronPython.Compiler.Parser.ParseSmallStmt() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 531
at IronPython.Compiler.Parser.ParseSimpleStmt() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 453
at IronPython.Compiler.Parser.ParseStmt() in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 447
at IronPython.Compiler.Parser.ParseFileWorker(Boolean makeModule, Boolean returnValue) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 3315
at IronPython.Compiler.Parser.ParseFile(Boolean makeModule, Boolean returnValue) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Compiler\Parser.cs:line 144
at IronPython.Runtime.PythonContext.ParseAndBindAst(CompilerContext context) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Runtime\PythonContext.cs:line 908
at IronPython.Runtime.PythonContext.CompilePythonCode(SourceUnit sourceUnit, CompilerOptions options, ErrorSink errorSink) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Runtime\PythonContext.cs:line 947
at IronPython.Runtime.PythonContext.CompileSourceCode(SourceUnit sourceUnit, CompilerOptions options, ErrorSink errorSink) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPython\Runtime\PythonContext.cs:line 956
at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)
at IronPythonTest.Cases.CaseExecuter.GetResult(ScriptEngine engine, ScriptSource source) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPythonTest\Cases\CaseExecuter.cs:line 75
at IronPythonTest.Cases.CaseExecuter.GetScopeTest(TestInfo testcase) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPythonTest\Cases\CaseExecuter.cs:line 70
at IronPythonTest.Cases.CaseExecuter.RunTest(TestInfo testcase) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPythonTest\Cases\CaseExecuter.cs:line 48
at IronPythonTest.Cases.IronPythonCases.IronPythonTests(TestInfo testcase) in c:\cygwin64\home\rejap\github\ironpython3\Src\IronPythonTest\Cases\IronPythonCases.cs:line 24
Python 3 gets rid of the distinction between int and long, with int now behaving as long. One way would be to switch everything to BigInteger, but it might be more efficient to try and use Int32 as much as possible behind the scenes, and switch to BigInteger if we have to while keeping the visible type int at all times.
Probably worth doing some benchmarks to see if it's worthwhile first.
prefix
(Lib location) and exec_prefix
(Include location, not used in IronPython) get set multiple times in multiple places, using inconsistent locations, during interpreter startup. Arguably the DLLs shouldn't even try to set the prefix and instead rely on getting it from the host, which will know where it's stdlib is stored.
Go over http://docs.python.org/3.2/whatsnew/3.2.html for anything that doesn't have a PEP and create an issue for it.
http://legacy.python.org/dev/peps/pep-0415/.
This is an extension to PEP 409 (#4).
Go over http://docs.python.org/3.1/whatsnew/3.1.html for anything that doesn't have a PEP and create an issue for it.
Go over http://docs.python.org/3.3/whatsnew/3.3.html for anything that doesn't have a PEP and create an issue for it.
Function like list
, enumerate
, etc. that are defined in C# should use in iter method on the class in preference to IEnumerable methods.
I've been struggling with the difficulty for a few days. I've read on http://www.ironpython.info/ and book 'IronPython In Action' by Michael and Christian, and DataGridView class on https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview(v=vs.110).aspx, but I'm still lack of some knowledge and skills.
My question is how to get value from one key press but without pressing 'Enter' and Move to the next cell, which means when I press one number on keyboard but without pressing 'Enter', the number is passed into the first cell such as 3, and then the next cell is active. The sequence is meander, like row 1 col 1 -> row 1 col 2 -> ... -> row 1 col 12 -> row 2 col 12 -> row 2 col 11. I tried many events of DataGridView such as 'CellEnter' and 'KeyPress', but failed.
If you could give some hints about it, I'll appreciate it very much.
The following is my code up to now:
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')
from System.Windows.Forms import Form
from System.Windows.Forms import DataGridView
from System.Windows.Forms import DataGridViewContentAlignment
from System.Windows.Forms import Application
from System.Windows.Forms import Control
from System.Windows.Forms import Clipboard
from System.Windows.Forms import DataFormats
from System.Windows.Forms import DataObject
from System.Drawing import Point
from System.Drawing import Size
from System.Drawing import Font
from System.Drawing import FontStyle
from System.Drawing import Color
from System import Text
from System.IO import MemoryStream
NUMROWS = 6
NUMCOLS = 12
data = [[-1 for x in range(NUMCOLS)] for x in range(NUMROWS)]
class DataGridForm(Form):
def init(self, numcols, numrows):
self.Text = 'DataGridView Cell Format Test'
self.ClientSize = Size(98 * (numcols + 1), 25 * (numrows + 1))
self.dgv = DataGridView()
self.numcols = numcols
self.numrows = numrows
self.setupdatagridview()
self.adddata()
self.formatheaders()
def setupdatagridview(self):
self.dgv.Location = Point(0, 0)
self.dgv.Size = Size(98 * (NUMCOLS + 1), 25 * (NUMROWS + 1))
self.Controls.Add(self.dgv)
# have to have columns defined before inserting rows
self.dgv.ColumnCount = self.numcols
# center all text in all data cells by default
self.dgv.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
#self.dgv.CellEnter += self.move
#self.dgv.CellValueChanged +=self.move
#self.dgv.Enter += self.move
#self.dgv.CellStateChanged += self.move
#self.dgv.ChangeUICues += self.move
#self.dgv.EditingControlShowing += self.move
#self.dgv.EditModeChanged += self.move
#self.dgv.GotFocus += self.move
#self.dgv.HandleCreated += self.move
#self.dgv.KeyPress += self.move
#self.dgv.KeyDown += self.move
#self.dgv.KeyUp += self.move
#self.dgv.MouseEnter += self.move
#self.dgv.Move += self.move
#self.dgv.TextChanged += self.move
# add empty rows first
for num in xrange(self.numrows):
self.dgv.Rows.Add()
# format empty cells
self.dgv.AllowUserToAddRows = False
self.dgv.AllowUserToDeleteRows = False
self.dgv.ReadOnly = False
self.dgv.ClearSelection()
def formatheaders(self):
for num in xrange(self.numcols):
col = self.dgv.Columns[num]
col.HeaderCell.Value = str(num + 1)
# slightly left of center on headers
col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
# sets font and font style
col.HeaderCell.Style.Font = Font(Control.DefaultFont, FontStyle.Bold)
col.HeaderCell.Style.ForeColor = Color.MidnightBlue
# put numbers on rows
for num in xrange(self.numrows):
row = self.dgv.Rows[num]
# get sequential numeric label on side of row
row.HeaderCell.Value = str(num + 1)
# sets font and font style
row.HeaderCell.Style.Font = Font(Control.DefaultFont, FontStyle.Bold)
row.HeaderCell.Style.ForeColor = Color.Blue
self.dgv.TopLeftHeaderCell.Value = 'Score'
self.dgv.TopLeftHeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
self.dgv.TopLeftHeaderCell.Style.Font = Font(Control.DefaultFont, FontStyle.Bold)
self.dgv.TopLeftHeaderCell.Style.ForeColor = Color.Blue
self.dgv.RowHeadersWidth = 60
def adddata(self):
for num in xrange(self.numrows):
row = self.dgv.Rows[num]
dat = (datax for datax in data[num])
for cell in row.Cells:
cell.Value = dat.next()
"""
def move(self, sender, event):
print 'move'
"""
dataGridForm = DataGridForm(NUMCOLS, NUMROWS)
Application.Run(dataGridForm)
Hi.
I've followed the instructions to run make.cmd
and failed to build the project:
Runtime\PythonDynamicStackFrame.cs(51,51): error CS1061: "System.Delegate"???"GetMethodInfo"???,???????????"System.Delegate"???????????"GetMethodInfo"(???? using ?????????) [D:\Dev2\iron\ironpython3\Src\IronPython\IronPython.csproj]
Runtime\PythonDynamicStackFrame.cs(53,52): error CS1061: "System.Delegate"???"GetMethodInfo"???,???????????"System.Delegate"???????????"GetMethodInfo"(???? using ?????????) [D:\Dev2\iron\ironpython3\Src\IronPython\IronPython.csproj]
Runtime\FunctionCode.cs(583,43): error CS1061: "System.Delegate"???"GetMethodInfo"???,???????????"System.Delegate"???????????"GetMethodInfo"(???? using ?????????) [D:\Dev2\iron\ironpython3\Src\IronPython\IronPython.csproj]
Runtime\FunctionCode.cs(583,77): error CS1061: "System.Delegate"???"GetMethodInfo"???,???????????"System.Delegate"???????????"GetMethodInfo"(???? using ?????????) [D:\Dev2\iron\ironpython3\Src\IronPython\IronPython.csproj]
Runtime\Types\PythonType.cs(797,32): error CS0117: "Microsoft.Scripting.Actions.TypeTracker"????"GetTypeTracker"??? [D:\Dev2\iron\ironpython3\Src\IronPython\IronPython.csproj]
Runtime\Types\ReflectedEvent.cs(177,49): error CS1061: "Microsoft.Scripting.Actions.EventTracker"???"GetAddMethod"???,???????????"Microsoft.Scripting.Actions.EventTracker"???????????"GetAddMethod"(???? using ?????????) [D:\Dev2\iron\ironpy thon3\Src\IronPython\IronPython.csproj]
Runtime\Types\ReflectedEvent.cs(207,52): error CS1061: "Microsoft.Scripting.Actions.EventTracker"???"GetRemoveMethod"???,???????????"Microsoft.Scripting.Actions.EventTracker"???????????"GetRemoveMethod"(???? using ?????????) [D:\Dev2\iron\ ironpython3\Src\IronPython\IronPython.csproj]
IronPythonTestConsole -> D:\Dev2\iron\ironpython3\bin\v2Debug\IronPythonTestConsole.exe
Sorry for the mysterious error messages. I'm on a localized Windows box :(
Any idea how can I get it to work? I've installed VS2013 Community Edition and I can build just IronPython 2.x fine.
Thanks in advance!
Go over http://docs.python.org/3.0/whatsnew/3.0.html for anything that doesn't have a PEP and create an issue for it.
http://www.python.org/dev/peps/pep-0420/,
Will have to see how this interacts with importlib.
$ ./ipy.exe -c 'print(1)'
Traceback (most recent call last):
File "C:\cygwin64\home\rejap\github\ironpython3\Src\StdLib\Lib\site.py", line 72, in <module>
File "C:\cygwin64\home\rejap\github\ironpython3\Src\StdLib\Lib\os.py", line 403, in <module>
NameError: global name 'supports_dir_fd' is not defined1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.