Pull to refresh
306.27
Rating

Python *

Interpreted high-level programming language for general-purpose programming

Show first
Rating limit

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 5.5K
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 5.6K
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 1.2K
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.9K
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.6K
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.7K
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.5K
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 80K
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.8K
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.7K
Comments 0

A selection of Datasets for Machine learning

Python *Data Mining *Open data *Machine learning *Artificial Intelligence
Hi guys,

Before you is an article guide to open data sets for machine learning. In it, I, for a start, will collect a selection of interesting and fresh (relatively) datasets. And as a bonus, at the end of the article, I will attach useful links on independent search of datasets.

Less words, more data.

image

A selection of datasets for machine learning:


Read more →
Total votes 12: ↑11 and ↓1 +10
Views 6.4K
Comments 2

Even more secret Telegrams

Information Security *Instant Messaging *Python *Algorithms *Development of communication systems *

We used to think of Telegram as a reliable and secure transmission medium for messages of any sort. But under the hood it has a rather common combination of a- and symmetric encryptions. Where’s fun in that? And why would anyone trust their private messages to a third-party anyway?
Spy vs Spy by Antonio Prohías
TL;DR — inventing a private covert channel through users blacklisting each other.

Read more →
Total votes 12: ↑8 and ↓4 +4
Views 4.5K
Comments 0

Python in Visual Studio Code – April 2019 Release

Microsoft corporate blog Python *Visual Studio *

We are pleased to announce that the April 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. You can learn more about Python support in Visual Studio Code in the documentation.


In this release we made a series of improvements that are listed in our changelog, closing a total of 84 issues including:


  • Variable Explorer and Data Viewer
  • Enhancements to debug configuration
  • Additional improvements to the Python Language Server

Keep on reading to learn more!  


Read more →
Total votes 7: ↑7 and ↓0 +7
Views 3.2K
Comments 0

Google News and Leo Tolstoy: visualizing Word2Vec word embeddings using t-SNE

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

Everyone uniquely perceives texts, regardless of whether this person reads news on the Internet or world-known classic novels. This also applies to a variety of algorithms and machine learning techniques, which understand texts in a more mathematical way, namely, using high-dimensional vector space.

This article is devoted to visualizing high-dimensional Word2Vec word embeddings using t-SNE. The visualization can be useful to understand how Word2Vec works and how to interpret relations between vectors captured from your texts before using them in neural networks or other machine learning algorithms. As training data, we will use articles from Google News and classical literary works by Leo Tolstoy, the Russian writer who is regarded as one of the greatest authors of all time.

We go through the brief overview of t-SNE algorithm, then move to word embeddings calculation using Word2Vec, and finally, proceed to word vectors visualization with t-SNE in 2D and 3D space. We will write our scripts in Python using Jupyter Notebook.

Read more →
Total votes 28: ↑28 and ↓0 +28
Views 10K
Comments 0

How to generate a huge financial graph with money laundering patterns?

Abnormal programming *Python *Big Data *Open data *
image

Couple of years ago my team (compliance in one of Swiss banks) and I had an interesting task to implement — we had to generate a huge random graph of financial transactions between clients, companies and ATMs. Moreover, we wanted this graph to contain some money-laundering and other financial crime patterns alongside with nodes description such as names, addresses, currencies etc. Obviously, all data should be randomly generated from scratch as long as we could not use any real data for obvious reasons.

As a solution we wrote a generator that I’d love to share with you. This article explains why we needed it and how this generator is working, but if you don’t want to read and want to try it on your own here is the code: https://github.com/MGrin/transactions-graph-generator. I hope that our experience will be helpful to any of you.
Read more →
Total votes 3: ↑3 and ↓0 +3
Views 2.5K
Comments 0

Dog Breed Identifier: Full Cycle Development from Keras Program to Android App. on Play Market

Python *Java *Development for Android *Image processing *Artificial Intelligence
With the recent progress in Neural Networks in general and image Recognition particularly, it might seem that creating an NN-based application for image recognition is a simple routine operation. Well, to some extent it is true: if you can imagine an application of image recognition, then most likely someone have already did something similar. All you need to do is to Google it up and to repeat.

However, there are still countless little details that… they are not insolvable, no. They simply take too much of your time, especially if you are a beginner. What would be of help is a step-by-step project, done right in front of you, start to end. A project that does not contain «this part is obvious so let's skip it» statements. Well, almost :)

In this tutorial we are going to walk through a Dog Breed Identifier: we will create and teach a Neural Network, then we will port it to Java for Android and publish on Google Play.

For those of you who want to see a end result, here is the link to NeuroDog App on Google Play.

Web site with my robotics: robotics.snowcron.com.
Web site with: NeuroDog User Guide.

Here is a screenshot of the program:

image

Read more →
Total votes 11: ↑11 and ↓0 +11
Views 15K
Comments 6

Authors' contribution