Go for Python Programmers

Video thumbnail (Frame 0) Video thumbnail (Frame 707) Video thumbnail (Frame 1448) Video thumbnail (Frame 2726) Video thumbnail (Frame 4058) Video thumbnail (Frame 4851) Video thumbnail (Frame 5883) Video thumbnail (Frame 6821) Video thumbnail (Frame 7606) Video thumbnail (Frame 8591) Video thumbnail (Frame 9241) Video thumbnail (Frame 10299) Video thumbnail (Frame 12266) Video thumbnail (Frame 12876) Video thumbnail (Frame 13625) Video thumbnail (Frame 14632) Video thumbnail (Frame 15351) Video thumbnail (Frame 15994) Video thumbnail (Frame 17009) Video thumbnail (Frame 17894) Video thumbnail (Frame 18846) Video thumbnail (Frame 19858) Video thumbnail (Frame 20663) Video thumbnail (Frame 21789) Video thumbnail (Frame 22908) Video thumbnail (Frame 23820) Video thumbnail (Frame 24588) Video thumbnail (Frame 25536) Video thumbnail (Frame 27109) Video thumbnail (Frame 27800) Video thumbnail (Frame 28720) Video thumbnail (Frame 29340) Video thumbnail (Frame 30229) Video thumbnail (Frame 31914) Video thumbnail (Frame 33395) Video thumbnail (Frame 34203) Video thumbnail (Frame 35033) Video thumbnail (Frame 36120) Video thumbnail (Frame 36961) Video thumbnail (Frame 37860) Video thumbnail (Frame 38567) Video thumbnail (Frame 40546) Video thumbnail (Frame 41979) Video thumbnail (Frame 42757) Video thumbnail (Frame 44099) Video thumbnail (Frame 44847)
Video in TIB AV-Portal: Go for Python Programmers

Formal Metadata

Go for Python Programmers
Title of Series
Part Number
Number of Parts
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 license.
Release Date

Content Metadata

Subject Area
Shahriar Tajbakhsh - Go for Python Programmers A side-by-side walkthrough of basic Go history, syntax, semantics and tools compared to Python. ----- There's been quite a bit of hype around Go for some time. In particular within the Python community, we've seen some engineers moving their stack from Python to Go or starting their new project in Go. This talk is **not** about whether you should move from Python to Go. Instead, this talk is for those who've been hearing all about all the hype but haven't yet had a chance to take a proper look at Go. We'll first very briefly look at Go and Python's history. Then we'll go through a high-level side-by-side walkthrough of basic Go syntax and semantics compared to Python. Finally, we'll have a brief look at a subset of the ecosystem and tools available to Go and Python programmers for certain tasks such as testing, code formatting, documentation generation etc. By the end, you will not be a Go programmer but you'll have a high- level feel for how the Go language operates.
Programmer (hardware) Demon Computer animation Constructor (object-oriented programming) Shared memory Right angle
Computer animation Code Multiplication sign Adaptive behavior Resultant
Computer animation Code Right angle Data structure Formal language
Point (geometry) Expected value Pairwise comparison Computer animation Coroutine Video game Semantics (computer science) Semantics (computer science) Data compression Data structure God
Concurrency (computer science) Computer animation Multiplication sign Graph (mathematics) Set (mathematics) Endliche Modelltheorie Computer programming Formal language
Web 2.0 Computer animation Divisor Computer file Right angle Line (geometry) Directory service Declarative programming
Standard deviation Computer animation Statement (computer science)
Functional (mathematics) Computer animation Function (mathematics) String (computer science) Electronic mailing list Marginal distribution Declarative programming Formal language
Type theory Pairwise comparison Cross-correlation Computer animation Personal digital assistant Speech synthesis Mereology Compiler
Type theory Type theory Computer animation Interface (computing) Instance (computer science) Multilateration Data structure Category of being Metropolitan area network
Multiplication sign Interior (topology) Electronic mailing list Bit Event horizon Food energy Sequence Element (mathematics) Type theory Category of being Type theory Computer animation Different (Kate Ryan album) String (computer science) Right angle Physical system
Type theory Computer animation Data structure System call Field (computer science) Sinc function Social class
Point (geometry) Type theory Computer animation Hash function Mapping Quantum state Surface Program slicing Electronic mailing list
Type theory Pairwise comparison Group action Process (computing) Type theory Computer animation Interface (computing) Multiplication sign Universe (mathematics) Interface (computing) Declarative programming
Point (geometry) Type theory Computer animation String (computer science) Multiplication sign
Default (computer science) Randomization Standard deviation Functional (mathematics) Mapping Multiplication sign Counting Similarity (geometry) Number Type theory Computer animation String (computer science) output Resultant
Functional (mathematics) Computer animation Function (mathematics) String (computer science) Electronic mailing list Integer Damping Event horizon Tuple Resultant Hypothesis
Mathematics Functional (mathematics) Context awareness Computer animation Personal digital assistant Function (mathematics) Instance (computer science) Recursion Resultant Local ring Mathematical optimization
Type theory Functional (mathematics) Computer animation Function (mathematics) String (computer science) output Student's t-test Variable (mathematics) Sequence Electronic signature Social class
Functional (mathematics) Multiplication Error message Computer animation Different (Kate Ryan album) Logic Modal logic Bit Insertion loss Error message Exception handling
Latent heat Word Functional (mathematics) Error message Computer animation 1 (number) Basis <Mathematik> Formal language
Point (geometry) Functional (mathematics) Message passing Error message Computer animation Personal digital assistant Multiplication sign Universe (mathematics) Bit Pressure Computer programming Demoscene
Complex (psychology) Server (computing) Game controller Functional (mathematics) Data recovery Client (computing) Computer programming Connected space Web 2.0 Process (computing) Error message Computer animation Personal digital assistant
Computer animation Object-oriented programming Multiplication sign Bit
Type theory Functional (mathematics) Computer animation Inheritance (object-oriented programming) Object (grammar) Position operator
Point (geometry) Computer animation Multiplication sign Data structure Distance Field (computer science) Social class
Point (geometry) Functional (mathematics) Inheritance (object-oriented programming) Strut Bit Instance (computer science) Line (geometry) Distance Variable (mathematics) Mereology Formal language Arithmetic mean Computer animation Different (Kate Ryan album) Einbettung <Mathematik> Einbettung <Mathematik> Reading (process) Social class
Wave Computer animation Inheritance (object-oriented programming) Interface (computing) Einbettung <Mathematik>
Concurrency (computer science) Computer animation Interface (computing) Interface (computing) Expert system Similarity (geometry) Data structure Reading (process)
Process (computing) Computer animation Semiconductor memory Concurrency (computer science) Multiplication sign Shared memory Protein Formal language
System call Computer animation Multiplication sign Authorization Letterpress printing Coroutine
Type theory Functional (mathematics) Computer animation Operator (mathematics) Multiplication sign Execution unit Letterpress printing Right angle Software testing Protein Local ring 2 (number)
Type theory Functional (mathematics) Computer animation Term (mathematics) File format Software testing Software testing Unit testing Quicksort Benchmark Local ring
Data management Computer animation Envelope (mathematics) File format Multiplication sign Source code File format Bus (computing) Code Planning Control flow Line (geometry)
Revision control Data management Radical (chemistry) Data management Electric generator Computer animation Visualization (computer graphics) Projective plane Integrated development environment
Medical imaging Programmer (hardware) Word Group action Computer animation Analogy Multiplication sign Computer programming Physical system
so let's welcome sharing we sold the goal for right in the middle because the you few that you throw away and took about goal for Python programmers as the construction and when inside your I'm a cell bridge near based in London I work elsewhere of Australia is a pretty good company that we can talk about of to talk if you're
interested and before I start I think I 1 apology but have less than
1 or more times preparing the soul I realize it's probably not a great idea and it's not a great here because it
implies that which used go either reduced prices and that results in an adaptive go code it's just not it's just not a good idea and and then I thought about
it more and those documents about it this morning uhm but then now but my intention here is not right go go codes like like Python right Python like right go I think it's just as a way to compare the 2 languages
uh more so I think this is probably more appropriate medical conference not sure what prudent Python by Europe like but you must have this high now and then you might as well have a it is quite interesting regarded as long as we know the intention is not to write good code like quite uh because what you do and the talk structure is going to quickly go over some history very broad basically history of the 2 languages then talk about general syntax and
semantics compression and finally the 1 thing that is quite interesting because point of a strong talked about the ecosystems and tools available to develop and to set the expectation this kind of this expected that you have
some knowledge of life and it needs to be able to make the comparison no particular knowledge of go required and the yeah at which we discussed go it's not necessarily something intense standing very brief very high level and if if there was ever deep dive into for example comparing a single we go routines and that's horizontal it's not going to be here but is there some history so God well as the Python Python 1st appeared around 1991 and we know it was influenced a
lot ways see which was by the name it was meant simple programming is learn a set of Python appointments philosophy is from ABC and a bunch of stuff 68 Haskell model 3 etc. go on the other hand very young 2009 was around the 1st time it appears what's this language is that influence there still go way back so there is self landless it's impossible
see a big influence on but there is also 1 of the key things about to about later is the concurrency and that was interspersed CSP which is not a certain language also by the latent undirected graphs and both goes quite young uh has been quite popular but Python also huge history has been going on for while he knew 1991 that to start that's semantic the most boring thing to do which I've done would be to just a simple Hello world I'm going over the basics and then like trying to get the people so we can see on the 3rd your
rights the hello world in Python we do we caveat that have 1 an extra with depletion that's just to show the example declaration assignments and on the left is to go 1 and the thing about who is every gold has have a and for example so the 1st line of the Gulf of is user factors and it should be a common so that after the the 1st real line of an eagle fly would be a package and that is pretty explicit is interesting in Python participatory differently from the north from the directory if the director is a package of web
continues but in gold that is super explicit you have to have the package that question at the beginning of each file
every single follow go for the living standards we have the same package again very explicit if everything's directly to every finding that the will have package from the top of it so when you're working with just the right itself in exactly packages I quite like being explicit so those that is the point in
going against the and the next thing typically like most welcome 5 of our import statements and it is a a
the import packages there's no concept of impacts and marginal so you don't see from something put something else generally for the whole package and then you can use that and if you have multiple lectures you could answer provides it doesn't matter how it works because it's quite simple you can't use a parentheses and then you just say import 170 just list everything in the string that doesn't and then there are also functions yeah
like there would be in language I will talk about that later and there's weird thing that I put there which is a kind of declaration and assignment that is not necessarily just go over
how that works of example text this this is a strange and now 1 thing I did mention so go is statically typed we present parts the dynamic time but in this case you haven't really set text the string but
the compiler can infer that that when talking about that later this speaking of the correlation of and types so we can do a quick comparison types in go on Python
generally speaking the kind of 4 types in so we have the normal basic thought and we look at of the so yeah we look at this in the that which is the other instance and stuff have to aggregate types like the structure and again we'll look at later reference types like man and there is 1 thing that an interface on that hi
that doesn't exist in Python and as a kind of because we'll see conceptually by from users and there we do have the a and stuff but they work with different I was single so we'll get to that and shortly as well but as far as the basic expected concerned go gives you a
bit more in the types of which is what you would expect because it's that at the time so you kind of wonder it was what we what you choose to have many different bits events and an on-site inspection Python the oldest long but you have again different sized floats in parking disclosed that really need to care about how in its own right and we can watch to and then the other public school and strange uh bikers who string of pretty standard of compositional so that the insinuations all as you were not specify how many bits are in the best system energy 32 or 64 bits but depends on the system where you're compiling that nothing we need to worry about for the purpose of this tool the other category of types were added to that
1 of them is an array in which an array eraser just sequence of 0 more elements of a particular type and then all reading lists and Python there really more Python erase that you can also use you know because they have to we show that there is a concept that is something similar to listen Python
as well and go but they're not rare and stop structures is just you know the thing used as to contain certain fields inside the could classes since mental call which is really a class but what but it isn't know it's not the apple but need typically
structure where you will probably is classified and or a digital you know that kind of having fields and but not to
create a certain concept and then we have to reference
um slices or that things are versus the lists and generally speaking you would want work with rays in go you have slices and slices aid and the heart of an array and can do all of the stuff that you would live with them to pretty powerful a not so basically dates the hash maps there are very similar and different is also the surface of all the channels bingo that's a problem there is no equivalent points really the
channels and talk about later on the way more you crises and for like 2 processes took each other but yeah and there an action type who took him later channels of type and there's also point to talk on the actual like this doesn't really matter the following matters encoded method for the purposes of discussing this comparison finally I said an interface time bingo Our
adding into this is used for generalization approaches and as you would expect for an interface it's there's this thing I will mention a little quite later which is being built into this is satisfied explicitly and that is what the university to how things work in Python again until quite later we can go back to the Declaration
usage so there are really 3 ways you can declare an assigned
stuff and world for example the first one is the that you create a variable of type String Bean on some text now
at the point where the variable is declared Cervantes strings text is an empty string and 1 of the things we know is that when you declare variable with automatic takes a 0 value of its time for example in the 0 fluids with different 0 as reference starts with the new and that is quite interesting this is meant to be used and have some
funding for example if we wanted to take on the way to do this we don't take random input from user from standard input and count the number of times a type 2 type something would you create a map called counts and that's and that's that's going to you know the cheese string and values in you'll be account you take input of another 1 in how we do it in the scanner and then you go through every time don't try something new you read that and what we can do indicate that text as the key into the but initially
because it doesn't exist the default value 0 value for returned to the value of the man and in the interest of laughter from and you have to look at doing something similar in Python will produce counter but it's not this particular behavior results in something similar to the full text and what again every other type as a random seeds so intense relative fruits of the relative red that so functions Our research Python that thing is because it goes back to the types kind of declaring the types matter um you give your time we
will can example in approximate this Gilson said result list for example you might say taken into mutant strain were taken into the target tuple of string and float to you would want to specify that every crack example would be you know take a and and added to each other and if there MacIver of a hypothesis the mission was no you promise that i'm because that's could pretty soon anyways but anyway so so that function you will take 2 events will return an integer sense 1 thing could also be
which is kind of so it is that you could name your
results can say in this is policy and inconsistently assigned to the new stuff with and again in this case it doesn't make sense because of just I mean I forgot change intensity as instances so what you can do stuff like that that and you know just like you can do recursion with functions like Python isn't a
local optimization awareness that was not so much as a the idea being that if your function can be optimized like to um that and it
type of a function is a signature and it's just the sequence of inputs and they're actually was about the signature for dysfunction any any function that thanks to its and 1 and has the same signature and that is useful because like as functions of 1st class citizens in go as well so you can pass them around so you can add variables that point to them so you know you want 1 variable that points to function that the students and there's a string and that would be this signature of your I
said that the 0 value
for functions of male we don't really care about that but again it's this sense that things have 0 values and you can return multiple values from functions like the top elected in Python and we should all 1 1 of them they can be it didn't work similarly an honest or a throwing and take it out but this is interesting because of the ability to return multiple values from a function leads us necessity how error and error handling is done in the which is quite a bit different Python that in Python you
would typically the strikes that was finally and will catch exceptions and do things with them in go there what is the concept of an exception and in that sense what you do is usually the loss being returned by the function is an error and then you checked for that yeah check to see if it's snail if is male then you know if it's not if it's not know then you know that's incorrect that but but you can do the same logic up with with the errors in sometimes 1
has a particular 1 for example the ideal package for you know return and the father of so you can check it stays there because people like the US once you can't use specific ones as well that now so you might say well what would you do it was finally had which something it's wrong will have this concepts of the fair and the fairies often use words use finally or an insurer another language and what it
does it says OK so great as a matter have of those that and the the focal spot and what that says is wrong closer whenever on and leaving the scope of this function basis so you can do that immediately after you open resource you immediately said the proposal later and this all in 1 place and you won't forget
it will probably get like this in a bit as well again but that is kind of interesting history of dealing with them and they're wrong however sometimes where there are genuinely exceptional circumstances
you know dereferencing nail point or after bouncing around and in those cases go just hundreds and you can also panic is actually function that you can call yourself you can make a little bit of time and the thing up Hank is that the idea is that it will stop the execution of the program and it will run all the different functions and the beginning last in 1st out so if like through the 1st thank do that last 1st and and then the program pressures would love message if you don't do anything with it and the the idea as far as by scene used and understood is that you don't really wanna stop Hayek's you really want on them if there's there's been a situation where growth have then you kind of want you know you don't but it is sometimes used to recover from 100 thousand to do that for example university
web server and something bad happens you don't want to the connection of you know for ever met you might wanna recover from that and I even medicine there that's a client and then then maybe you can close can recover from we can take a quick example for example in the course sometimes you know even if everything's appears to work fine the complexity of the job is in their whereabouts and silicon and generally
speaking but what you can is going to those cases this and 1 panic so there is this this possible recover so what you do right and top function differed function and because of when you go Japan all the very contrastive goal so when this 1st watching book after and recovery will return and if there was a and if there was a case in you deal with it and by the diet or try and control in Canada on the program so in this case is a faster but and you can just like the carry on or you know whatever
I took this example there from the global and recover will will return this there has been no so that it's not really a problem you also shouldn't on to Appendix and where they exist that money and time and so what object-oriented programming Python is free
object-oriented but everything is an object and go is also apparently considered the interval goes definition of it is a bit
so goes as an object is simply a value of variable that has methods and the methods of function associated with different types so you you know you could
yes you have but and another frightened users in the sense that there there is no inheritance and I don't particularly enjoy inheritance usually that's a pumpkin position is the way to do things and let
me know if you go through crude again
for this example pointless because points on I didn't realize that that wasn't the time then you define a class but you know point has x and y coordinates states that in go you the same structure of the union find time points it has an X. and Y. The flows 64 so those are called field so they have an excellent field and and we all know how that methods in Python just add another death on their itself and then the dust and stuff example wanted to take the distance between 2 points well in goal the kind of attached they function on the left side and to do this to basically and any time any user-defined so although the it looks a bit different it's not in the same scope you know that I want see that in the current methods that and both of those you know
that the distance between 2 lines and in different languages but as I mentioned earlier there are no there's no inheritance and but the way goes handle that in the circumstances where you wouldn't inheritance is by struct embedding and when I 1st read this few months ago it would said the composer's touchpoints stopped embedding unifil what what what what in that it was a bit of a mouthful but but when 2nd example we proceed imagine we had point class now have a name . class and the point is that has an IQ crossing points when talking about the so we have pointless and names point of an unnamed point of have also has a name for a particular point and in Python to do that you would probably create a new name when class subclass point just add a new instance variables in can we you would have the point strike would create
a name . struck and you can and that point inside what does that mean is that when you create named points you already have access to x and you would have access to you just which actually so named points in the plus at that point and you can access named point of X as its X was part of a new name because it it is embedded inside an opinion of all the functions and things like and so that's the way utterance into
inheritances handle but that's the way you you embeddings to for those come circumstances and obviously there is 1 more 0 OPS thing and go as well uh which are interfaces conceptually they're actually
very similar to dutch thing in Python you know when we shipped under an land then something that is done the lenders notes afterward that you really have to march or the on the equal or whatever but it's really same go on and to the wave
of quot earlier mentioned the dissatisfied implicitly that's what that's what I meant you don't really have to do anything as long as a structure example has all the methods that into the is expected to have been a couple of things that satisfies that an example kind of from the actual package is like writers and readers and read writers so you know and right interface as long as something of the right method that takes some bytes and returns internet that satisfies that interfere and you can also makes it up and this like that read writer who takes the writer and reader but for example all experts to that
conforms to some of those those problems with status was close interface and similar in some ways is in Python as well although I don't like things just the way that things are the strengthening of woman unless that's that's a the goal 1 of its main strength is concurrency and that's kind of what everyone bounds on about that was the most of us think of
and comprising go is mainly done in 2 ways either proteins which is the thing that is quite prominent or traditional shared-memory not aware that that's interesting and just to welcoming and communicating sequential processes that mention CSP earlier on it something it's something so was working on a 19 seventies and it is really programming language more informal for language for defining how a concurrent things interact and the thing that I don't know if it came from little where there was a for what people do go off
and say do not communicate by sharing memory and search a share memory but communicating so the whole idea is that you don't we share memories but have these things and topical channels that talk to each other and the proteins are just like with like which threats manage go time
and the proceeds from just prepay and go to function and that's 1 in separate that the true
quick example because we have the authority that's works since they go with time and it does that in the background and it carries prints and the named 1st then we will print time was because that's been delayed for he thousand millisecond that and way I don't do that but still uh and
then there's the tons of the channels and and channels or the way you communicate between 2 proteins that but we always have longer the which is the main routine that's when you start a program and and another basic example of channel you created channels alike types in units for example but the types because put anything in the you type is to get the channel type in then we have an anonymous function which is you know that that like anything else you could do that the book for example and those but the work anyway and you can write a channel so that function rights 2 2 channel when both right rights and receding from channel of Brookings operations and then over the phone we can read from the channel so basically we like print 42 which and major
and how do these things 30 seconds over which I have more time but the ecosystem and tools in Python acting up pretty solid of it the same goes for gold but proconsul of local that stuff for example for testing there is you know
terms of test and you can take the certain conventions that you follow him just as the local unit test is pretty good practices proceeding type of that they're already mature stuff and we go you know anything that ends with on school test or tests follows you get any any method that starts with test is a test method and the method that starts benchmark is a benchmark test method and so that's pretty interesting is any method that sort of example there is a example function that provides machine check documentation so that's pretty interesting to and so really there is
1 way to do these things that go defined and he was restricted for gold formatting or cultural don't go from think of you just again use
external go format your source and just formatted so that if you saw this as a planning to write the every time you save does that every goal looks the same and by some bus 1 the novel we split placates of corporate envelopment and it doesn't do you know where to put a line break
if you along the lines 2 long lack and stuff while we got the money to through that so so that doesn't happen because go does that is 1 way to do it and will take care of it again for package management is quite a few different ways to point that anything thing that keeping as as it is being the most common in my lifetime
goal has constant again from terminal comes with the package and just get to and another thing a package management visual and this but was used in Python to manage different versions of the project requirements of use go often by unbearable and working but it's it could be annoying but if you end up having a nice way of dealing with then if you respond to quite like personal the way it works and who
was fast finally goal comes with a dolphin generation and just to go
images of images of program that there are quite a few tools again that the that Python and um but I think it's you know in the standard way thank you know 1 way of doing it and just does it will everything that's the same of so those are private ecosystems and that I use the conclusion
is that but will not understand you know as supply planet disempowered group programmers but I'm not saying we should all moved to go over all they required but the idea was just to get a feel for what's there and go and that's the other thing that knew nothing nothing to concrete just get to forgo analog of a moving to whatever if that's we want that there are so thank you few will be sold for so would build here we need more time for the questions of those words but you can't use him as a system personally and now we enjoy because the great