We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Do I need to switch to Go(lang) ?

00:00

Formal Metadata

Title
Do I need to switch to Go(lang) ?
Title of Series
Part Number
124
Number of Parts
169
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Max Tepkeev - Do I need to switch to Go(lang) ? Nowadays, there is a lot of buzz about Go. In this talk we'll learn the basics and most important concepts of the language, we'll further discuss differences and similarities in Go and Python and dive into the cool features of Go. Finally we'll talk about why popularity of Go is raising so fast and try to answer the most important question: Do I need to switch to Go ? ----- Nowadays, there is a lot of buzz about Go. It happened so that for the last 6 months I've been mostly programming Go, and frankly speaking I fell in love with this language. We'll first do a quick review of the language. Go doesn't have some language constructs, for example classes and exceptions and at first it may seem hard to write proper Go code, but in practice the language is so easy that I will try to teach you the basics and most important concepts of the language. We'll further discuss differences and similarities in Go and Python and dive into the cool features of Go. Finally we'll talk about why popularity of Go is raising so fast and try to answer the most important question: Do I need to switch to Go ?
11
52
79
Uniqueness quantificationLine (geometry)Mathematical analysisConcurrency (computer science)Binary fileAerodynamicsType theoryFormal languageCompilerWritingFormal languageFacebook1 (number)Source codeSemiconductor memoryBinary codeVirtual machineLatent heatMobile appProof theoryMultiplication signAxiom of choiceDatabasePower (physics)Library (computing)InterprozesskommunikationOpen sourceSoftware developerTask (computing)AuthorizationClosed setFile archiverConcurrency (computer science)Type theoryFlow separationStandard deviationDifferent (Kate Ryan album)EmailExistenceComputer programmingCodeRun time (program lifecycle phase)Slide rulePhysical systemMachine codeCylinder (geometry)NumberOraclePattern languageUsabilityProcess (computing)Line (geometry)Speech synthesisVideo gameComputer fontEnterprise architectureComputer virusState of matterMereologyCartesian coordinate systemReal numberSound effectLogic programmingDecision theoryGroup actionComputer animation
CompilerComputing platformFormal languageStack (abstract data type)Buffer overflowGoogolOpen setWikiComa BerenicesCuboidDrop (liquid)FacebookTwitterIntelSpacetimeRun time (program lifecycle phase)Compilation albumError messageMultiplication signComplete metric spaceWindowElectronic mailing listGraph (mathematics)Term (mathematics)Projective planeBitFormal languageStack (abstract data type)NumberProgrammer (hardware)Total S.A.Buffer overflowTwitterLink (knot theory)Computer programmingPlastikkarteSlide ruleAxiom of choiceGoogolIntegrated development environmentVirtual machineGraph coloringGoodness of fitForestGroup actionCuboidLecture/ConferenceMeeting/InterviewComputer animation
Binary fileComa BerenicesRepository (publishing)Computer virusObject (grammar)Source codeData managementSoftware testingDressing (medical)Pairwise comparisonSystem administratoroutputSoftware testingFunctional (mathematics)Directory serviceOcean currentData managementBranch (computer science)Computer programmingMathematicsRight angleCodeCartesian coordinate systemComputer fileStatement (computer science)Binary fileBinary codeFile formatProgrammer (hardware)Formal languageStrategy gameSource codeIntegrated development environmentSoftware developerRevision controlType theoryCodeStandard deviationDoubling the cubeDifferent (Kate Ryan album)Library (computing)SimulationBitRepository (publishing)Object (grammar)Variable (mathematics)Online helpPairwise comparisonUniform resource locatorMultiplication signError messageSingle-precision floating-point formatTheory of relativityVector spaceVideo gameProjective planeSet (mathematics)System callInferencePhysical lawPort scannerCompilerEuclidean vectorCellular automatonProduct (business)Image resolutionCondition numberFamilyGenderEvent horizonLecture/Conference
VarianceString (computer science)Interior (topology)Complex (psychology)Pairwise comparisonType theoryComa BerenicesVariable (mathematics)Lambda calculusSocial classFunction (mathematics)Range (statistics)Data typeLetterpress printingProgrammschleifeCountingWordElement (mathematics)Subject indexingVariable (mathematics)Declarative programmingElectronic mailing listMereologyStatement (computer science)Form (programming)Type theoryField (computer science)GradientIntegerString (computer science)Functional (mathematics)Different (Kate Ryan album)LengthCondition numberSoftware developerWorkstation <Musikinstrument>Formal languageWordExtension (kinesiology)MappingLevel (video gaming)RankingPattern languageLinearizationParameter (computer programming)Multiplication signFluid staticsSemantics (computer science)Program slicingNumberData structureKey (cryptography)Greatest elementComputer configurationDialectAdditionBitException handlingLoop (music)Interior (topology)Positional notationComputer programmingQuarkEmulatorLine (geometry)CodeSocial class2 (number)VarianceDot productComputer animation
Letterpress printingPairwise comparisonConditional probabilityCASE <Informatik>Default (computer science)Coma BerenicesData recoveryError messagePointer (computer programming)String (computer science)Interior (topology)File formatSocial classData typeConstructor (object-oriented programming)StrutInheritance (object-oriented programming)Computer fileConcurrency (computer science)Range (statistics)Dependent and independent variablesSynchronizationTask (computing)Loop (music)Software developerWordInheritance (object-oriented programming)Data structureException handlingParameter (computer programming)Type theoryPerformance appraisalFunctional (mathematics)AreaSlide ruleStatement (computer science)NamespaceError messageComputer fileMathematicsRepresentation (politics)IntegerString (computer science)Data managementVariable (mathematics)Musical ensembleFormal languagePointer (computer programming)Multiplication signRight angleSpeciesSocial classStudent's t-testContext awarenessCodeConcurrency (computer science)Set (mathematics)Different (Kate Ryan album)Pairwise comparisonComputer programmingElectronic mailing listForm (programming)Arithmetic meanContent (media)WebsiteRevision controlWeightCASE <Informatik>Interface (computing)MereologyProteinMessage passingFunction (mathematics)Closed setDependent and independent variablesSubject indexingAxiom of choiceView (database)Program slicingIntegrated development environmentReading (process)ChainOffice suiteUniform resource locatorPoint (geometry)Data recoveryConstructor (object-oriented programming)Embedded systemComputer fontBitClassical physicsEinbettung <Mathematik>Lecture/Conference
Array data structurePointer (computer programming)Interface (computing)Data typeStatement (computer science)Compilation albumElectronic mailing listElectric generatorException handlingMeta elementSocial classLibrary (computing)Standard deviationCodeDynamical systemConcurrency (computer science)Electric generatorAxiom of choiceStandard deviationCompilation albumCartesian coordinate systemLibrary (computing)Point (geometry)Loop (music)Computer programmingCoroutineMathematicsComputing platformArithmetic meanFunctional (mathematics)Variable (mathematics)Error messageElectronic mailing listDifferent (Kate Ryan album)Formal languageLattice (order)Concurrency (computer science)SpeicheradresseBasis <Mathematik>TypprüfungMaxima and minimaTupleSource codeGoodness of fitRevision controlExterior algebraMereologySoftware developerProxy serverData dictionaryService (economics)Multiplication signLink (knot theory)Natural numberCodeType theoryProcess (computing)Right angleBuffer solutionSelectivity (electronic)Interface (computing)Mobile appDigital photographyException handlingSoftwarePointer (computer programming)BitBinary codePerturbation theoryView (database)Rule of inferenceObject (grammar)RhombusSocial classHyperplaneProgram slicingGreatest elementStatement (computer science)CompilerWeightNumberSimplex algorithmCellular automatonLecture/ConferenceMeeting/Interview
Computer animation
Transcript: English(auto-generated)
Welcome everybody. We are going to here to Max Tepev. He will talk about Go, if we need to go and switch to this language from Python. We'll have a few questions at the ends. So welcome to Max Tepev.
Hi everyone, can you hear me well? Okay, thanks. So probably wasn't easy to get up for a lot of people and for me as well because of the Pincho party and other stuff which is going on. So thanks for coming, I really appreciate that.
Let's find out if you are still on the right talk. I mean, if you are already programming in Golang for like two or three months, then probably you won't find something new in this talk for yourself. I'm not saying that you should go away or something like that, you can stay, but just keeping you informed.
And second, if you visited the talk about Golang, yesterday you probably noticed that I will repeat some things because it's hard not to repeat facts. So just I don't know, you can post something to Facebook while I'm repeating these things or checking your email.
But we'll also discuss a lot of things that you didn't hear yesterday. So the goal of the talk is to answer the question, do I need to switch to Golang? Not me of course, but you, because I already made a decision. And you probably wondering why am I giving this talk
on the Python conference? Well because for some reason it happened so that a lot of people who program in Python are also using Go for some reason, it's really, really easy to use Go if you know Python. We'll try to figure out why during the talk. But first just a little brief introduction
about me and my company. My name is Max, I live in Moscow, Russia. I'm a Python and Golang developer. I'm the author of several Python libraries which you can see on this slide. And I'm a EuroPython speaker since 2014 in Berlin and I also give talks on other conferences
from time to time and contribute to our other open source libraries. I work for the company called ADATA. We collect and process online and offline data to get the idea, user data to get the idea of user's interests, intentions, demography and so on. We process more than one billion unique users a month
and there are more than 2,000 segments in our database like users who are interested in buying a specific car brand or users who like to travel to Spain and so on. We have partners like Google, Oracle, Microsoft, App in Access and many more. We have quite a big worldwide user coverage
and one of the biggest coverage in Russia and Eastern Europe. For example, for Russia it's about 80% of all users. And that's it, I promise it will be very brief. So let's get back to the topic. The question was do I need to switch to Golang? But let's figure out why switch from Python anyway.
So the main reason is speed. Python is just not fast enough for a lot of tasks. There are things like different ways to make Python faster like PyPy, Cython and France and so on and just the existence of these tools proves that this is a problem, it exists. Then comes concurrency.
While Python provides us with different ways to solve concurrent tasks, to make concurrent programming, there was no defacto standard until Python 3.4 when asyncio was introduced but in standard library and still it will take a lot of time for people to adapt to it, to get used to it,
to know how to do things properly with it and to switch to Python 3, of course. Gil, it's the most discussed Python problem. While you may use multi-processing to avoid Gil, still inter-process communication is slow so this leads us to problem number one. Python doesn't provide a way to make true binaries.
By, I mean, binaries with machine code, then you can just drop into the server and run. There are things like CxFreeze and so on but this is just an executable archive with Python stuff. And also you can't write close source code with Python so you can't easily distribute your commercial problems
because Python code can be easily restored. And while dynamic typing provides us with ease of use, it is also a big source of runtime errors and the proof of this is the introduction of type hinting in Python 3.5. So it's also a problem.
Okay, so let's briefly formulate language requirements for the language of choice which will solve our problem with Python. It should be modern. By modern I mean that at least it should have proper Unicode support and use all the powers of modern CPUs, right? Like multicore support and so on.
It should be blazingly fast, ideally fast like C, C++ close to its speed. It should be easy to learn and again, ideally, you shouldn't require manual working with memory. It should compile the two binaries with machine code, of course.
It should be statically typed and which together with the previous requirement will mean that we'll identify a lot of errors on compilation time and not at runtime and it should support the main platforms, of course, like Windows, Linux and Mac. So why go? I mean there are other languages, right,
which can fulfill our requirements and I believe this slide kind of answer the question because we forgot two more requirements for our language of choice in our previous slide. The community and how widespread the language is. So the first number here is the amount of questions
asked in total on Stack Overflow by Tech and as of yesterday, I took these numbers yesterday, and the second number is the amount of new questions asked for the last month. So as you can see, go is clear winner here. Also, I wanna show you this Google Trends graph which shows searching activity for term Golang.
We can clearly see here that more and more searches, search requests are done every year and popularity is constantly increasing. To a little bit of history about go, go started as an experiment in Google at 2007 to address some of the problems Google had
like slow builds, working in distributed environments and so on. There was even a myth that go was conceived during one of those slow builds while programmers were waiting for program to compile. I won't go into details about why go was designed the way it is now because we would need
another 45 minutes or even more for this. If you're interested, you can read the link at the end of the slide. I'll just tell you that go was open sourced in 2009 and it was created by a lot of smart people, people who created things like Unix, UTF-8,
Java, Hotspot, Virtual Machine and a lot of other things that we use every day as programmers. Go is already used in a lot of companies throughout the world, for example, Google, Dropbox and so on. There's a giant list of companies, again, at the link at the end of the slide so you can visit and have a look if you're interested.
Now, let's have a look at how typical your project look like. This is called the workspace. The workspace is a directory where all your go code lives. It is defined by setting a go path environmental variable. It consists of three directories,
bin, package and source. Source is where you put all your source code and your code's dependencies and bin is for binaries and package for the package objects. There is no single repository for packages in go like there is PyPI and Python.
To install a package, you simply type go get and URL to a package repository. From one side, it's simple and cool. From the other side, there is no way to specify the version of your dependencies. There are no things like requirements, .txt and something like that which can freeze your versions of your requirements. Basically, when you do go get package foo,
it downloads source files of package foo, scans them for input statements to identify dependencies, then downloads files of the current master branch of each dependency and then compiles all source files all together into binary. This is a big problem because if a backward
incompatible change was introduced to master branch of at least one dependency and you do go get, then you end up with a broken program. Go developers realized that and starting from go 1.5, enabled a so-called vendor experiment
and starting from 1.6, which is the current version of go, it's not an experiment anymore but the recommended strategy. It means that you should include a vendor folder in your project and put all your dependencies in there by copying their source code and they will be found by go compel automatically.
I know how it probably sounds to a Python programmer like vendor input, but actually it's okay because a lot of programs in Python also vendors things, for example, pip, request, which we all use and like
and I also started to vendor things. You can throw it at me if you want but actually vendor isn't that bad because if it's done properly, it can really help your users in the end. You just have to do it right. There are also two more popular ways to solve a package management problem in go,
go-packaging and go-get-debate.io but I won't talk about them. You can Google if you're interested and there are also a few other approaches to package management in go. We won't discuss them, of course, but I like the name of the last one, Johnny Depps. So go comes with a lot of helpful comments built in.
go-format, which formats your code in the only right way. If you don't like how it formats your code, then sorry, you're wrong. It's like PEP8 in Python but more strict. go-test runs your test and shows you test coverage. go-fix updates your code to use newer APIs
if they're introduced, if somehow changed in a new version of go. go-run compiles your code into binary, then immediately runs it and deletes it in the end so it's a kind of a scripting language simulation and it works really nice because go compile time is very small.
So this is why a lot of system administrators started to use go as scripting language. There is also a race detector and go-vet command which can find errors that compiler didn't see at compile time and many more. And all these things, they are built in right into the language so you don't need to install any third-party tools and so on.
It's really convenient. So let's have a look at the hello world application. Each file should start with a package definition which will be used for inputs by other packages. An executable comment must always use package main.
Then we input format package from go standard library and define a main function which just prints hello world. To compile this code, we run the following comment which produces a binary in our workspace bin directory and then we can just run it like usual binary.
Let's do a comparison of go in Python. What I want, I want to show you that some things are different but a lot of things are similar so this is one of the reasons why it's easy for a Python programmer to learn go. To, first of all, imports.
Both languages use imports to import packages. The only difference is that in go, we must surround package name with double quotes. Also, import statement differs a bit if you want to import several packages or to import a package under a different name. When you import a package, you can use names
which define inside the package in the same way in both languages. The main difference is that in go, you can only access names which starts with the capital letter and all other names are considered unexplored or private if you like that term. So they can't be accessed outside the package.
Go has same basic types as Python with a few differences because go is statically a type language. So if we have initializers, then we don't need to define types because go is smart enough to figure out it from them.
If we don't have them, then we need to define type. Also, go has signed and unsigned in types which, with different bit sizes like int 8 and 16 and so on. And also, a dict in Python is called map in go. And note that map defines types of its keys and values.
So in this example, we have a map which keys and values are signed integers. And finally, a list is called a slice in go. Variable declarations have more forms in go than in Python. In Python, we just declare variables
any way we want with the same syntax. In go, there are two syntaxes, full variable declaration with var keyword and short form of variable declaration which can be used in functions or methods but not at the package level. We can also have one line variable declarations in both languages and in go in both forms, full and short.
Both languages have first class functions. It means that the language supports passing functions as arguments to two other functions, returning them as values from other functions and assigning them to variables.
Though, as you can see, the syntax is different. Go is more verbose because of static types and C-like syntax with curly braces. Both languages also support optional positional functional arguments. In Python, we call them marks and use asterisks for them, asterisks for them.
And in go, functions that implement them are called variadic functions and use three dot syntax notation for them. And as you can see, we can also pass a slice of numbers in go and use a backend feature similar to what we have in Python. Unfortunately, go doesn't have a keyword arguments feature,
but you can kind of emulate it with structs. Python doesn't have structs, but basically just a collection of fields. Struct can be initialized only with the needed fields. All fields that are not set during initialization will be set to the zero value. So for example, for string type, it's an empty string.
This is probably not very elegant and not the idiomatic way to do things in go, but it works if you need it. So just showing you that it's possible to emulate quarks in go. Python has four in while loops. Go has only for loop, which can take several forms.
Here we initialize a list of three integers and then iterate its elements one by one. Notice that the first variable in for loop in go, this is the underscore, and this is an index of the element inside the list. And because we don't need it, we use underscore,
and this is the same convention in Python, but in Python, this is just a convention. I mean, you can use any variable name for it and just not to use it, but in go, you have to use an underscore because if you don't use your, you declare a variable and you don't use it or you have an import and you don't use it,
then the program just won't compile. Go is very, very strict about this and that leads to a cleaner code in the end. Second form of the for loop can be compared with Python's while loop with a condition. The code is simple, so I won't comment on it.
Just note that you can omit init and post statements in for loop. Also, go has variable plus plus syntax available, which Python doesn't have. And both languages have len function to get the length of the variable. And the third form is the while loop
with intimate condition. We all love Python for its list and decomprehensions. I'm sorry, but there are nothing similar in go. Whenever you want to iterate over something, you just have only one looping construct, which is available in go, a for loop.
Some people already asked to add something similar to go, but go developers took the there should be one and only one way of doing things really seriously, maybe too seriously. And it looks like that we won't see any syntactic sugar added to the language in the near time. So for loop is our only friend for ages, probably.
You can also notice that comment syntax is a little bit different in go, as you like. Let's talk about conditionals a little bit. Both languages have if statements, which look pretty much the same with one exception. Go allows you to declare variables
inside the if statement. And these variables are only available during the execution of if statement. I mean, they won't pollute your name space. This is useless in our current example, but can be very handy in a lot of situations. And really nice feature, I think.
Go also has switch statement, which can be compared to Python if le fails chain. Notice that switch statement also allows us to declare a variable inside itself. And it also won't be available after switch finishes its execution.
You can, of course, write the same if else if else chain in go, but in most cases, switch statement just looks much, much cleaner and readable. Go has the same slice and syntax available as in Python, and that is awesome. That's all you need to know about it.
Now comes error handling. This is probably one of the most discussed topics about go. So in Python, we use exceptions to handle errors, and in go, there are no exceptions. The idiomatic way in go to check for error values is the, I mean, if a function can return,
should return a variable and an error value. So if this error value is nil, then everything's fine. Everything's working fine. If it's not nil, then something is wrong, and we should act appropriately. So why is this one of the most discussed topics about go?
A lot of people think that a language from the 21st century should have exceptions. And this kind of error handling is like 70th style or something like that. So a lot of people are unhappy about that. And when you start programming in go, you will notice that a lot of,
a big part of your code is that these if statements that check for errors. It's very verbose. Anyway, go developers, they just don't agree with this. They think that it's very cool. It's the proper way of doing things. So we just have to leave with that, I think.
Actually, there are also panic and recover functions, which kind of works like exceptions, but not really in a technical sense. So I won't go into details about them. Just know that they are here. So if you are interested, just Google for them.
Okay, classes. I have bad news for you. Go doesn't have classes. It has structs, and you can attach methods to them. To make a function act as a method, you need to define a special receiver argument. This is very similar to Python, where a receiver argument is called self.
The receiver appears in its own argument list between the func keyword and the method name. In this example, p is the receiver argument of type person. Go has a convention that a receiver argument should have a one character name that is the first letter of its type.
Also note how we are magically using string methods in Go to change the string representation of a person type. So when you print it, this is kind of similar to Python's magic str method. But in Go, this is achieved using interfaces,
which we won't talk about today because this is a big topic. And actually you can attach methods not to only structs, but to any other types, to integers, to strings, to functions, to whatever. Structs in Go doesn't have constructors, but there is a convention to emulate the constructor
by creating a function that does the initialization if you need any. This is our previous person structs, initialization rewritten using the constructor function. We can also see in use syntax here, notice the asterisk near the person type at the function definition.
That means that the function will return a pointer to a person type. And also notice the ampersand inside function, that is a way to return a pointer to a type. Yes, Go does have pointers, but again we won't discuss them today. Okay, a few words about inheritance.
Go doesn't have one, again. Instead it has composition or embedding. You can embed parent struct inside a child struct and reuse its methods, like if they were defined on the child struct. Let's have a look at the example. On the left we have a classic Python inheritance,
and on the right we have Go's embedding, doctor type embeds person type and gains access to its eat method as if it was defined in doctor type. Kind of inheritance. Okay, let's switch to some cool stuff. We all know that Python has something called
context managers. Here's a well known example. We chose the usage of context manager to read a file and automatically close it in the end. Go doesn't have context managers, but does have something similar, which is called a defer. A defer keyword can be used together with any function
inside another function, and when a function inside which a defer statement is used finishes its execution, a defer statement will be called just before exiting a function. It sounds weird, but I hope the example
can clarify that a bit. We are reading a file in this function in Go, and we have a defer close, and it doesn't matter if any error will happen or something else, the file will be closed anyway.
We can also see difference in style here. In Python we name a function or a method using an underscore between words, and in Go a convention is to use camel case. Also notice how we use the result variable
inside a function definition in Go. This is called the named return value and is treated as variable defined at the top of the function with a zero value, and we already know that a zero value for a string is empty string. Okay, last comparison, concurrent programming.
I hope you're able to see the code, because I had to make a font a little bit smaller to fit everything in one slide. So let's start with the amount of code. Usually Python is the winner here. We have to type much, much less code in Python, but this is not the case.
Here we have two similar programs which can currently retrieve the content of two sites. Nothing really to discuss about the Python version. I'm using the asyncio together with ao HTTP package, which should be installed via pip and async await syntax, which is available starting from Python 3.5.
Let's talk about Go version of the code. In Go, concurrent programming is built in right into the language, which is really, really awesome. First we define a list of URLs to fetch. Then we create the channel for HTTP responses. Channels are used to communicate
between different parts of the program. Then for each URL in list, we start the goroutine, which is just the usual function that runs asynchronously and fetches response and sends it into the response channel. To create a goroutine, we just append the Go keyword,
and that's it. After that, we start to listen to messages in response channel, and as soon as new message is received, we immediately print it to standard output. Also note, we're using a defer statement here to close response body, and we have to cast body
to string because read all returns body as bytes. This is just the details. Also, I'm not doing any error handling, neither in Python nor in Go, just intentionally here because to make code shorter and to show you only what's important.
So from my point of view, concurrent programming in Go is much cleaner and understandable than in Python, even with AsyncIO. There are more, let's name some Go features that we didn't discuss, but they are here.
So making new functions that are used to initialize different types in Go, erase, which are the basis for slices, pointers that hold the memory address of the variable, interfaces, provide a way to specify a behavior of an object, if something can do this, then it can be used here kind of a duck typing in Python,
type assertions and type switches, which are used with interfaces to cast them to concrete type, advanced techniques for concurrent programming, like buffer channels and select statements, unsafe package, which allows us to bypass type safety of Go programs if needed, for example,
to interact with C or C++. And starting from Go 1.5, we can easily cross-compile our programs for different platforms just by changing a few environmental variables. Really awesome feature. Features that Go lacks, list and dig comprehensions.
There are no generators in Go, but we can use Go routines and channels to achieve the same behavior. There are no decorators in Go, but we can easily wrap a function with a function to achieve the same behavior, no exceptions.
Go also doesn't have meta classes, descriptors, and magic methods, and probably never will, but who knows, there are also no set and tuples. So conclusion, both languages have good standard library
and a lot of third-party tools for almost everything. That's not actually really true because Go doesn't have any good stuff for scientific programming, like Pandas, NumPy, and so on, but Go is relatively young, so I think that something will be created eventually.
Due to Python's syntax and syntactic sugar, we can be much, much more productive in Python because we don't need to re-implement things again and again, so for example, if we need to get dictionary's keys, we just call keys method.
If we want to check if something is contained in a list, we just write if something is in list, and so on. But in Go, every time you have to start this for loop to iterate over something and to get what you want. So this is really verbose, but again, this is what we have.
On the other hand, Go's concurrency features and it's compiled and statically typed nature are worth it. I think so. You can easily develop commercial software with Go and sell the binaries, keeping your source code secure. Also, yes, you will spend more time coding in Go,
but in the end, I believe that programs which are written in Go are more secure because a lot of errors are found at compile time. And also, if you're developing something that should benefit from concurrent execution, then Go is just a very good choice for these kind of things.
And the last point that I would like to address, maybe it sounds stupid, but I think that Go doesn't have soul. I mean, I'll try to explain. I mean, when I'm coding, programming something in Python, I feel myself like an artist
which creates some masterpiece or something, a hopefully masterpiece, and in Go, you just, I don't know, you don't feel any happiness, any satisfaction, you know, during development. You just, I don't know, you just have to try it,
maybe just me, but this is what I feel. And let's try to answer our main question, do you need to switch to Go? Of course not, Python is great, but do you need to learn Go? Yes, definitely yes, learn Go because these languages won't go away anywhere
because it's made by Google. Cool. Also, the funny thing is that a lot of companies that use Python also use Go, or vice versa. So if you are interested in getting a good job
or getting a promotion or something like that, then Go is the right language to learn. We don't have time anymore, right? No? I just want to show a few useful links. So you can make a photo if you want,
they will help you in learning Go. And yes, I think that's it. And if you're interested, I am not paid by Google to promote their language. So I've just shared my experience with it, and I hope I was able to motivate you somehow to try Go, and if at least somebody of you
will try Go, then it was worth it. Thanks. Thank you, Max. So now we have a bit of time for questions. Wait for the microphone, please.
Hi, thanks, this talk was very useful to me. I'm a Go newbie, and the most difficult thing I found when maintaining an older Go program, meaning like it was a year old, was that the standard library seems to be changing a lot.
I was wondering if you had any experience dealing with changes in the standard library and how to fix them or detect them before compiling. I don't know, it's a difficult question. I don't have really an answer to that, I don't know.
Any other question? Hi, yeah, I just wanted to say, out of what circumstances do you think
you might look to migrate from Python to Go? What kind of, is it, for instance, if you were on the Python 2 version and you were looking at implementing some of the concurrency features of Python 3, is it, do you think it's worth looking at Go as an alternative to getting used to the whole concurrency syntax
that you've got in Python 3, or do you think that that kind of leap is not really worth doing? Well, if you, I think that if you are happy with your Python code and it works okay, and you don't have any bottlenecks, then of course you don't need Go or anything else, but if you have any problems, then why not try Go, right?
So, from, I mean, you must have, I probably missed the first part of this, I'm sorry, but you, how did you get into Go? So what drove you to move towards Go and obviously kind of get experience here? Yeah, we, okay, we had, in our company, we had a service in Python,
which wasn't working really good, not because it was written badly or something, just, it just couldn't process, process the data, the amount of data we had. So we decided to try Go,
and it's working really good right now, and this is, we're really happy with this choice, so. We, I think that we will be rewriting our services in Go. Okay, thanks very much.
I wanted to ask, what is the, what would be an application that you think should not be written in Go, that should be written in Python? Like what would be a good example of an app that Python would be better?
I don't think there is this kind of application that shouldn't be ported to Go. I can't think of a way, why. You can port everything in Go. I mean, the point of porting something to Go is only if you need something to make faster,
or if you really want to benefit from concurrency, because in Python, concurrency is hard, from my point of view, so that's it. Okay, thank you. We are running out of time, so if you have any more questions, you can meet Max outside, or open an open piece.
Thank you.