Pull to refresh
503.94

Python *

Interpreted high-level programming language for general-purpose programming

Show first
Rating limit
Level of difficulty

How to Write a Smart Contract with Python on Ontology? Part 4: Native API

Reading time4 min
Views1.8K
image

Earlier, I have introduced the Ontology Smart Contract in
Part 1: Blockchain & Block API and
Part 2: Storage API
Part 3: Runtime API
Today, let’s talk about how to invoke an Ontology native smart contract through the Native API. One of the most typical functions of invoking native contract is asset transfer.
Read more →
Total votes 5: ↑5 and ↓0+5
Comments0

Python vs JavaScript: Which One Can Benefit You The Most?

Reading time10 min
Views23K


The web development arena is moving at a fast pace and has reached an advanced stage today. Python and Javascript making some significant contributions for almost three decades. Now, being a developer or a business if you are planning to pick one of these, then it’s going to be tough just because both are too good to avoid. Hence, this brings up the topic ‘Python vs JavaScript: Which One Can Benefit You The Most?’

These two languages are supported by various trending web frameworks and libraries which are the real game-changers. The introduction of these frameworks and libraries to the web ecosystem has brought new paradigms, traditional notions, and standards of software development.
Read more →
Total votes 12: ↑10 and ↓2+8
Comments3

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

Reading time3 min
Views1.3K
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 →
Rating0
Comments0

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

Reading time3 min
Views1.3K
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 →
Rating0
Comments0

Machine Learning for your flat hunt. Part 2

Reading time9 min
Views1.6K


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
Comments0

A new video series for beginners to learn Python programming

Reading time2 min
Views1.4K
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
Comments0

Python in Visual Studio Code – September 2019 Release

Reading time3 min
Views2.8K
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
Comments0

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

Reading time5 min
Views3.1K
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
Comments0

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

Reading time4 min
Views1.6K


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
Comments1

Yet Another Android snake with Kivy, Python

Reading time20 min
Views6.5K
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
Comments2

Typechecking Django and DRF

Reading time5 min
Views9.5K

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
Comments0

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

Reading time4 min
Views1.4K

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
Comments0

Contextual Emotion Detection in Textual Conversations Using Neural Networks

Reading time10 min
Views3.8K

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
Comments0

Python Vs R — Data Science

Reading time3 min
Views3.8K
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
Comments0

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

Reading time2 min
Views2.1K
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
Comments0

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

Reading time3 min
Views2.7K

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
Comments0

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

Reading time7 min
Views86K

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
Comments3

Python in Visual Studio Code – June 2019 Release

Reading time2 min
Views2.3K
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
Comments0

Authors' contribution