首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 140 毫秒
1.
作为动态语言,Python与其他静态编译语言有很大差别,其对象与型式的概念及关系非常让人迷惑。文章讨论Python程序设计语言中对象、型式与量的基本概念和关系,阐释这些概念的内涵与外延,指出初学者容易混淆之处,并给出教学过程中的一点心得体会。  相似文献   

2.
Python是一门解释性的、面向对象的、动态语义特征的高层语言。它的高层次的内建数据结构,以及动态类型和动态绑定,这一切使得它非常适合于快速应用开发。Python的简单而易于阅读的语法强调了可读性,因此降低了程序维护的费用。Python支持模块和包,并鼓励程序模块化和代码重用。Python的解释器和标准扩展库的源码和二进制格式在各个主要平台上都可以免费得到.而旦可以免费分发。  相似文献   

3.
元组容器在C++中的设计与实现   总被引:1,自引:1,他引:0  
C 是一种静态类型语言,这就使实现可以容纳不同种类型元素的容器——元组变得十分困难。C 的标准容器库STL虽然提供了丰富的容器,但其都只能容纳相同类型的元素,没有提供对元组容器的支持。其实C 的模板机制为它的静态类型系统增加了很大的灵活性,再使用一些其它的技巧,使得实现元组容器成为可能。wyf::tuple就是如此实现的一个元组容器的程序库。wyf::tuple不但可以保证类型安全,并且是高效的。测试数据表明,它要比一些动态语言如Python中的类似容器高效得多。  相似文献   

4.
为了提高学生在翻转课堂模式下对Python语言进行自主学习的兴趣,开发一个基于Python Turtle库的图形动画案例库集成软件.在软件中可以直观地看到图形案例、动画程序、小游戏程序的运行效果及其实现代码.案例内容从简单到复杂,从静态到动态,有助于学生通过案例自主学习,在教学中取得了良好的应用效果.该软件可以应用于高职、高专Python翻转课堂教学中,也可以应用于Python爱好者的自学.  相似文献   

5.
《程序员》2010,(8):128-129
Python基础教程(第2版),Python源码剖析:深度探索动态语言核心技术,Python源码剖析:深度探索动态语言核心技术  相似文献   

6.
通过物联网传感器和数据分析技术,机器人可以获得更广泛的态势感知,从而更好地执行任务。文中根据机器人大赛动态避障赛程的集体要求,搭建了基于ROS平台工业机器人开源平台,应用Python语言进行Gazebo虚拟现实系统的搭建,基于双目视觉完成了静态避障与动态避障功能,完成了机器人大赛的具体比赛。  相似文献   

7.
适合于科学计算的脚本语言Python   总被引:2,自引:0,他引:2  
Python是面向对象的脚本语言,它有高级的数据类型和简单但却有效的面向对象的程序设计方法,其精炼的语法,动态类型及其自动的解释器,使它适合于大部分平台上编写脚本和快速开发应用程序。Python语言结合C语言编写的Numpy(数值扩展程序模式)或与系统语言C/C++,Fortran结合用于开发科学计算软件。  相似文献   

8.
在芝加哥举办的PyCon 2008大会上,Python之父Guido为开发者带来Python 3000及其新特性的主题演讲,并为开发者如何适应语言新特性,及迎接Python 3000应该做的准备提供了建议。值得注意的是,同样在PyCon上,来自微软的动态语言运行时DLR首席  相似文献   

9.
介绍了动态开发语言Python,并和传统的编程语言如C语言做了一个比较。  相似文献   

10.
介绍一种新型的动态系统描述语言,PDSDL.它比SystemC更加高效和灵活.(1)PDSDL使用了Python面向对象动态语言,(2)PDSDL创新性地提出了动态系统的概念.系统的建模、验证和综合全都依赖于运行时动态系统特性,而非传统的存储在非易失记忆体(例如文件)的静态描述.因此设计者能使用程序和高级人工智能方式来进行更高效的结构探索.本文的重点在于探讨动态系统描述语言的特性和实现机理.文末给出简要试验结果.  相似文献   

11.
The development of service robots has gained more attention over the last years. Advanced robots have to cope with many different situations emerging at runtime, while executing complex tasks. They should be programmed as dynamically adaptive systems, capable of adapting themselves to the execution environment, including the computing, user, and physical environment. Recently, dynamic languages are becoming widely used because of the high runtime adaptability they offer. Therefore, we have analyzed the suitability of these languages to implement robotic systems with high runtime adaptability requirements, using Python as case study because of its maturity. To evaluate their suitability, we have implemented a reflective robotics framework that can be programmed in both Java and any dynamic language supported by the standard Java Scripting API. An example scenario has been developed using Python to show how its distinguishing meta‐programming features have facilitated the development of runtime‐adaptable robotics services. Copyright © 2012 John Wiley & Sons, Ltd.  相似文献   

12.
Most languages fall into one of two camps: either they adopt a unique, static type system, or they abandon static type-checks for run-time checks. Pluggable types blur this division by (i) making static type systems optional, and (ii) supporting a choice of type systems for reasoning about different kinds of static properties. Dynamic languages can then benefit from static-checking without sacrificing dynamic features or committing to a unique, static type system. But the overhead of adopting pluggable types can be very high, especially if all existing code must be decorated with type annotations before any type-checking can be performed. We propose a practical and pragmatic approach to introduce pluggable type systems to dynamic languages. First of all, only annotated code is type-checked. Second, limited type inference is performed on unannotated code to reduce the number of reported errors. Finally, external annotations can be used to type third-party code. We present TypePlug, a Smalltalk implementation of our framework, and report on experience applying the framework to three different pluggable type systems.  相似文献   

13.
The flexibility offered by dynamically typed programming languages has been appropriately used to develop specific scenarios where dynamic adaptability is an important issue. This has made some existing statically typed languages gradually incorporate more dynamic features to their implementations. As a result, there are some programming languages considered hybrid dynamically and statically typed. However, these languages do not perform static type inference on a dynamically typed code, lacking those common features provided when a statically typed code is used. This lack is also present in the corresponding IDEs that, when a dynamically typed code is used, do not provide the services offered for static typing. We have customized an IDE for a hybrid language that statically infers type information of dynamically typed code. By using this type information, we show how the IDE can provide a set of appealing services that the existing approaches do not support, such as compile-time type error detection, code completion, transition from dynamically to statically typed code (and vice versa), and significant runtime performance optimizations. We have evaluated the programmer׳s performance improvement obtained with our IDE, and compared it with similar approaches.  相似文献   

14.
15.
There is tension between programming language design for modularity and flexibility of programming and the amenability of the resulting programs to static analysis. At the start of Software Practice and Experience in 1971, most languages in commercial use were procedural (e.g., FORTRAN, ALGOL, PL/I) and on the whole were easier to analyze than languages of today such as JavaScript and Python. Modern languages include dynamic features, which enhance prototyping of approaches, often resulting in programs that are difficult for software tools or humans to understand. Starting with this perspective, we explore the relationship between language features and the ability of static analysis to precisely determine control flow and data flow in programs, thus enabling program optimization, transformation and understanding. Copyright © 2011 John Wiley & Sons, Ltd.  相似文献   

16.
Dynamic features in programming languages support the modification of the execution status at runtime, which is often considered helpful in rapid development and prototyping. However, it was also reported that some dynamic feature code tends to be change-prone or error-prone. We present the first study that analyzes the changes of dynamic feature code and the roles of dynamic features in bug-fix activities for the Python language. We used an AST-based differencing tool to capture fine-grained source code changes from 17926 bug-fix commits in 17 Python projects. Using this data, we conducted an empirical study on the changes of dynamic feature code when fixing bugs in Python. First, we investigated the characteristics of dynamic feature code changes, by comparing the changes between dynamic feature code and non-dynamic feature code when fixing bugs, and comparing dynamic feature changes between bug-fix and non-bugfix activities. Second, we explored 226 bug-fix commits to investigate the motivation and behaviors of dynamic feature changes when fixing bugs. The study results reveal that (1) the changes of dynamic feature code are significantly related to bug-fix activities rather than non-bugfix activities; (2) compared with non-dynamic feature code, dynamic feature code is inserted or updated more frequently when fixing bugs; (3) developers often insert dynamic feature code as type checks or attribute checks to fix type errors and attribute errors; (4) the misuse of dynamic features introduces bugs in dynamic feature code, and the bugs are often fixed by adding a check or adding an exception handling. As a benefit of this paper, we gain insights into the manner in which developers and researchers handle the changes of dynamic feature code when fixing bugs.  相似文献   

17.
Gradual type systems offer a smooth continuum between static and dynamic typing by permitting the free mixture of typed and untyped code. The runtime systems for these languages, and other languages with hybrid type checking, typically enforce function types by dynamically generating function proxies. This approach can result in unbounded growth in the number of proxies, however, which drastically impacts space efficiency and destroys tail recursion.  相似文献   

18.
A structural operational semantics for Edison. 1—an Edison-like language—is given. The static and dynamic (operational) semantics for various declarations and statements contained in this type of languages have been carefully studied by using a structural operational approach. The method used here can be generalised to cover more complicated concurrent programming languages. The paper is divided into two parts. In the first part, an abstract syntax of Edison. 1 is introduced and the static semantics of it is studied. In the second part, an operational (dynamic) semantics of Edison. 1 is given.  相似文献   

19.
Part 1 of this paper is an analysis of problems concerning type systems and static semantics relevant to designing and implementing new programming languages. Part 2 proposes and exemplifies a way to derive a static semantics from a language's dynamic semantics, using a technique known as binding time analysis known from partial evaluation (Ershov's “mixed computation”) [20, 21]. The goal is to analyze the language's type structure during the design process without the need for hand construction of a type system. Ideally, one might automate the construction of a type checker, given only the dynamic semantics as input. In particular, binding time analysis of the interpreter program can be used to distinguish statically detectable errors from dynamic ones, and a static semantics is seen as a mechanism for deciding whether the program to be interpreted can give rise to any of the static errors. Our basic viewpoint is operational: to see how and where in the interpreter immediately observable type errors manifest themselves; to classify them as static or dynamic; and to design the static semantics to detect all static errors in a given program.  相似文献   

20.
We propose FMJ (Featherweight Multi Java), an extension of Featherweight Java with encapsulated multi-methods thus providing dynamic overloading. Multi-methods (collections of overloaded methods associated to the same message, whose selection takes place dynamically instead of statically as in standard overloading) are a useful and flexible mechanism which enhances re-usability and separation of responsibilities. However, many mainstream languages, such as, e.g., Java, do not provide it, resorting to only static overloading.The proposed extension is conservative and type safe: both “message-not-understood” and “message-ambiguous” are statically ruled out. Possible ambiguities are checked during type checking only on method invocation expressions, without requiring to inspect all the classes of a program. A static annotation with type information guarantees that in a well-typed program no ambiguity can arise at run-time. This annotation mechanism also permits modeling static overloading in a smooth way.Our core language can be used as the formal basis for an actual implementation of dynamic (and static) overloading in Java-like languages.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号