IronPython

IronPython

Тип Python Programming Language Interpreter
Разработчик Jim Hugunin
Написана на C# и Python
Дата выпуска 5 сентября 2006
Аппаратные платформы .NET Framework, Mono
Последняя версия 3.4.2 (19 декабря 2024)
Репозиторий github.com/IronLanguages…
Лицензия Apache License version 2.0[1]
Сайт ironpython.net
Логотип Викисклада Медиафайлы на Викискладе

IronPython — одна из основных реализаций языка Python, предназначенная для платформы Microsoft .NET или Mono. Полностью написан на C#, и является транслятором компилирующего типа.

В IronPython можно использовать типы .NET. Также можно из .NET кода использовать IronPython код, посредством хостинга IronPython системы или предварительной сборки IronPython кода.

На сегодняшний день возможность программировать на IronPython есть в IDE Visual Studio, SharpDevelop и других.

Сравнение IronPython и C # для «Hello World»

C#:

using System;
class Program 
{ 
    static void Main(string[] args) 
    { 
        Console.WriteLine("Hello World");
    }
}

IronPython:

print "Hello World"

Пример: программа Hello World

Простейший пример использования графического инструмента GTK+ в окружении IronPython:

#!/usr/bin/env ipy
#-*- coding: UTF-8 -*-

import clr
clr.AddReference('gtk-sharp')
import Gtk

def button_clicked(button, args):
    print('Привет Мир!')

def main():
    Gtk.Application.Init()

    window = Gtk.Window('Окно Приветствия')
    window.SetDefaultSize(240, 180)
    window.DeleteEvent += lambda w, a: Gtk.Application.Quit()

    button = Gtk.Button('Нажми Меня')
    button.Clicked += button_clicked
    button.Show()

    window.Add(button)
    window.Present()

    Gtk.Application.Run()

if __name__ == '__main__':
    main()

Примечания

  1. IronPython license (ironpython.codeplex.com). Дата обращения: 18 июля 2010. Архивировано из оригинала 8 июля 2011 года.

См. также

Ссылки

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.