Pull to refresh
212.6
Rating

Python *

Interpreted high-level programming language for general-purpose programming

Show first
  • New
  • Top
Rating limit
  • All
  • ≥0
  • ≥10
  • ≥25
  • ≥50
  • ≥100

How to Write a Smart Contract with Python on Ontology? Part 3: Runtime API

Cryptography *Python *Programming *DevOps *Cryptocurrencies
Tutorial
image

Introduction


Earlier, I have introduced the Ontology Smart Contract in
Part 1: Blockchain & Block API and
Part 2: Storage API
Now when you have an idea about how to call the relevant API for persistent storage when developing Python smart contract on Ontology, let’s go on to Runtime API (Contract Execution API). The Runtime API has 8 related APIs that provide common interfaces for contract execution and help developers get, convert, and validate data. Here’s a brief description of these 8 APIs:
Read more →
Rating 0
Views 643
Comments 0

How to Write a Smart Contract with Python on Ontology? Part 2: Storage API

Python *Programming *DevOps *Distributed systems *Cryptocurrencies
Tutorial
image
This is an official tutorial published earlier on Ontology Medium blog
Excited to publish it for Habr readers. Feel free to ask any related questions and suggest a better format for tutorial materials

Foreword


Earlier, in Part 1, we introduced the Blockchain & Block API of Ontology’s smart contract. Today we will discuss how to use the second module: Storage API. The Storage API has five related APIs that enable addition, deletion, and changes to persistent storage in blockchain smart contracts. Here’s a brief description of the five APIs:
Read more →
Rating 0
Views 662
Comments 0

Machine Learning for your flat hunt. Part 2

Python *Programming *Data Mining *Data visualization Machine learning *


Have you thought about the influence of the nearest metro to the price of your flat? 
What about several kindergartens around your apartment? Are you ready to plunge in the world of geo-spatial data?


The world provides so much information…



Read more →
Total votes 4: ↑4 and ↓0 +4
Views 1.3K
Comments 0

A new video series for beginners to learn Python programming

Microsoft corporate blog Python *Programming *Studying in IT
Probably the largest hurdle when learning any new programming language is simply knowing where to get started. What’s important? What do I need to know to be proficient? It’s hard to follow docs when you’re not even sure what you’re reading.

You might be taking a look at Python. Maybe you’re drawn because of its popularity. Maybe you’re drawn to its flexibility. With Python you can create solutions of all shapes and sizes. You can dig into web development. Simplify your life through automation. Or maybe begin building the future with machine learning.

Picking up a new language is a common situation for modern-day developers. The days of going your entire career focused on one language are long since gone.

Fortunately, concepts typically don’t change as you move from one programming language to the next. Sure, the syntax might be different, but an if statement is still an if statement even when it’s written using { } or End If. So, we don’t need to learn how to program, but rather how to program in a new language.

This is why Susan and I created this series of videos! You might know how to write code, for example in JavaScript, Java or C# (or COBOL, or Bash, or… it doesn’t matter, really). Maybe you learned in a college course, online, or reading a book. So, you don’t need to be taught what an if statement is, but rather what an if statement looks like in Python.

Read more →
Total votes 7: ↑6 and ↓1 +5
Views 1.2K
Comments 0

Python in Visual Studio Code – September 2019 Release

Microsoft corporate blog Python *Programming *Visual Studio *
We are pleased to announce that the September 2019 release of the Python Extension for Visual Studio Code is now available. You can download the Python extension from the Marketplace, or install it directly from the extension gallery in Visual Studio Code. If you already have the Python extension installed, you can also get the latest update by restarting Visual Studio Code. You can learn more about  Python support in Visual Studio Code in the documentation.

This was a short release where we closed 35 issues, including improvements to the Python Language Server and to Jupyter Notebook cell debugging, as well as detection of virtual environment creation. The full list of enhancements is listed in our changelog

Read more →
Total votes 8: ↑8 and ↓0 +8
Views 2.1K
Comments 0

How to Write a Smart Contract with Python on Ontology? Part 1: the Blockchain & Block API

Python *Distributed systems *Cryptocurrencies
Sandbox
image

This is an official tutorial published earlier on Ontology Medium blog
Excited to publish it for Habr readers. Feel free to ask any related questions and suggest a better format for tutorial materials

Foreword


In this article, we will begin to introduce the smart contract API of Ontology. The Ontology’s smart contract API is divided into 7 modules:


In this article, we will introduce the Blockchain & Block API, which is the most basic part of the Ontology smart contract system. The Blockchain API supports basic blockchain query operations, such as obtaining the current block height, whereas the Block API supports basic block query operations, such as querying the number of transactions for a given block.

Let’s get started!

First, create a new contract in SmartX and then follow the instructions below.

1. How to Use Blockchain API


References to smart contract functions are identical to Python’s references. Developers can introduce the appropriate functions as needed. For example, the following statement introduces GetHeight, the function to get the current block height, and GetHeader, the function to get the block header.
Read more →
Total votes 20: ↑18 and ↓2 +16
Views 1.9K
Comments 0

Tips and tricks from my Telegram-channel @pythonetc, August 2019

VK corporate blog Python *Programming *


It is a new selection of tips and tricks about Python and programming from my Telegram-channel @pythonetc.

Previous publications


If an instance of a class doesn’t have an attribute with the given name, it tries to access the class attribute with the same name.

>>> class A:
...     x = 2
...
>>> A.x
2
>>> A().x
2
Read more →
Total votes 29: ↑27 and ↓2 +25
Views 1.4K
Comments 1

Yet Another Android snake with Kivy, Python

Python *Game development *
Tutorial
Hello, there.

[UPD from 2021: I highly recommend following this tutorial with an utmost caution]

A lot of people want to start programming apps for Android, but they prefer not to use Android Studio and/or Java. Why? Because it's an overkill. «I just wanna create Snake and nothing more!»



Let's snake without java! (with a bonus at the end)
Read more →
Total votes 3: ↑3 and ↓0 +3
Views 4.3K
Comments 2

Typechecking Django and DRF

Website development *Python *Django *
Tutorial

As you have already know I love optional static typing. The thing is that sometimes it is not optional, but impossible. Because we have plenty of big untyped projects in Python's ecosystem.


Django and Django-Rest-Framework were two of them. Were. Because now they can be typed! Let me introduce TypedDjango organisation and stubs for django and drf.


This is going to be a concise tutorial and getting started guide.

Read more →
Total votes 2: ↑2 and ↓0 +2
Views 3.5K
Comments 0

Tips and tricks from my Telegram-channel @pythonetc, July 2019

VK corporate blog Python *Programming *

It is a new selection of tips and tricks about Python and programming from my Telegram-channel @pythonetc.

Previous publications


You can’t mutate closure variables by simply assigning them. Python treats assignment as a definition inside a function body and doesn’t make closure at all.
Read more →
Total votes 22: ↑21 and ↓1 +20
Views 1K
Comments 1

Contextual Emotion Detection in Textual Conversations Using Neural Networks

VK corporate blog Python *Data Mining *Big Data *Machine learning *

Nowadays, talking to conversational agents is becoming a daily routine, and it is crucial for dialogue systems to generate responses as human-like as possible. As one of the main aspects, primary attention should be given to providing emotionally aware responses to users. In this article, we are going to describe the recurrent neural network architecture for emotion detection in textual conversations, that participated in SemEval-2019 Task 3 “EmoContext”, that is, an annual workshop on semantic evaluation. The task objective is to classify emotion (i.e. happy, sad, angry, and others) in a 3-turn conversational data set.
Read more →
Total votes 37: ↑37 and ↓0 +37
Views 2.4K
Comments 0

Python Vs R — Data Science

Python *Programming *R *Learning languages
Tutorial
When mulling over the best programming language to use for data science, Python and R ring a bell (very quickly). While there are a lot of languages like C, C++, Java, Julia, Perl, and Scala, it's protected to state that Python and R are the harbingers in data science.

While a great deal of data researchers will discuss the customary shortcomings like data wrangling in R or data representation in Python, ongoing improvements like Altair for Python or R have adequately reacted to these shortcomings.

So which one would it be a good idea for you to decide for your next data investigation venture?

R has been ruling this space for a long time now. This bodes well as this programming language was explicitly intended for analysts.
Read more →
Total votes 11: ↑11 and ↓0 +11
Views 3.4K
Comments 0

Take your Linux development experience in Windows to the next level with WSL and Visual Studio Code Remote

Microsoft corporate blog Python *Visual Studio *Development for Linux *Development for Windows *
Using VS Code Remote and the Windows Subsystem for Linux (WSL) gives you a fully featured Linux development environment on a Windows laptop or desktop. Let’s look at how using these tools will completely change how you develop with Linux tools in Windows.

image
Total votes 12: ↑10 and ↓2 +8
Views 1.3K
Comments 1

Tips and tricks from my Telegram-channel @pythonetc, June 2019

VK corporate blog Python *Programming *

It is a new selection of tips and tricks about Python and programming from my Telegram-channel @pythonetc.

Previous publications


The \ symbol in regular string have special meaning. \t is tab character, \r is carriage return and so on.

You can use raw-strings to disable this behaviour. r'\t' is just backslash and t.

You obviously can’t use ' inside r'...'. However, it still can be escaped by \, but \ is preserved in the string:
Read more →
Total votes 24: ↑20 and ↓4 +16
Views 2.4K
Comments 1

Python consumes a lot of memory or how to reduce the size of objects?

Python *

A memory problem may arise when a large number of objects are active in RAM during the execution of a program, especially if there are restrictions on the total amount of available memory.


Below is an overview of some methods of reducing the size of objects, which can significantly reduce the amount of RAM needed for programs in pure Python.


Note: This is english version of my original post (in russian).

Read more →
Total votes 15: ↑13 and ↓2 +11
Views 71K
Comments 3

Python in Visual Studio Code – June 2019 Release

Microsoft corporate blog Python *Programming *Visual Studio *
We are pleased to announce that the June 2019 release of the Python Extension for Visual Studio Code is now available. You can download the Python extension from the Marketplace, or install it directly from the extension gallery in Visual Studio Code. If you already have the Python extension installed, you can also get the latest update by restarting Visual Studio Code. You can learn more about Python support in Visual Studio Code in the documentation.

In this release we made improvements that are listed in our changelog, closing a total of 70 issues including a plot viewer with the Python Interactive window, parallel tests with pytest, and indentation of run selection in the terminal.

Read more →
Total votes 9: ↑9 and ↓0 +9
Views 1.4K
Comments 0

Who put Python in the Windows 10 May 2019 Update?

Microsoft corporate blog Python *Programming *Development for Windows *

Some days ago the Windows team announced the May 2019 Update for Windows 10. In this post we’re going to look at what we, the Python team, have done to make Python easier to install on Windows by helping the community publish to the Microsoft Store and, in collaboration with Windows, adding a default “python.exe” command to help find it. You may have already heard about these on the Python Bytes podcast, at PyCon US, or through Twitter.


The header of the Python 3.7 page in the Microsoft Store
Read more →
Total votes 10: ↑9 and ↓1 +8
Views 1.4K
Comments 0

Authors' contribution