Python: An Amazing Second Language for .NET Developers

Video thumbnail (Frame 0) Video thumbnail (Frame 6722) Video thumbnail (Frame 16126) Video thumbnail (Frame 19283) Video thumbnail (Frame 29366) Video thumbnail (Frame 34920) Video thumbnail (Frame 42208) Video thumbnail (Frame 43763) Video thumbnail (Frame 44975) Video thumbnail (Frame 53725) Video thumbnail (Frame 62424) Video thumbnail (Frame 65538) Video thumbnail (Frame 71279) Video thumbnail (Frame 74810) Video thumbnail (Frame 80687)
Video in TIB AV-Portal: Python: An Amazing Second Language for .NET Developers

Formal Metadata

Title
Python: An Amazing Second Language for .NET Developers
Title of Series
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 license.
Identifiers
Publisher
Release Date
2016
Language
English

Content Metadata

Subject Area
Abstract
The modern software development landscape is a terrain of many platforms and technologies. Gone are the days where simply knowing one technology really really well is sufficient to stay on the cutting edge. We are expected to write web-based applications, mobile applications, cross-platform applications and so on. Even as we know we should learn more and branch out, that choice is increasingly difficult as the technology options explode. This talk will give you one very solid choice that is familiar to .NET developers: Python. It may seem like a very different language and ecosystem when compared to .NET but just below the surface, there are many more similarities than there are differences. For .NET's Entity Framework, Python has SQLAlchemy. For .NET's ASP.NET MVC, Python has The Pyramid Web Framework. The list goes on and on. Come learn why your team should learn Python as a complementary language to .NET.
Dataflow Group action Run time (program lifecycle phase) Service (economics) Beta function Software developer Code Weight Multiplication sign Mereology Semantics (computer science) Computer programming Formal language Computer configuration Analogy Software framework Compilation album Form (programming) Physical system Just-in-Time-Compiler Touchscreen Assembly language Inheritance (object-oriented programming) Moment (mathematics) High-level programming language Parallel port Semantics (computer science) Software maintenance Cartesian coordinate system Computer programming Formal language Type theory Pointer (computer programming) Network topology Computer network Revision control Point cloud Right angle Object (grammar) Quicksort Window
Application service provider Group action Run time (program lifecycle phase) Drag (physics) Code Multiplication sign Visual system Perspective (visual) Formal language Usability Web 2.0 Data management Graphical user interface Type theory Algebraic closure Core dump Cuboid Software framework Social class Exception handling Programming paradigm Electric generator Cross-platform Block (periodic table) Electronic mailing list Price index Category of being Type theory Process (computing) Compilation album Software framework Right angle Text editor Quicksort Block (periodic table) Freeware Programmschleife Spacetime Functional (mathematics) Game controller Link (knot theory) Open source Letterpress printing 2 (number) Number Revision control Term (mathematics) Internetworking Integrated development environment Compilation album Addition Pairwise comparison Just-in-Time-Compiler Inheritance (object-oriented programming) Suite (music) Military base Code Letterpress printing Line (geometry) Shape (magazine) Equivalence relation Subject indexing Word Computer network Statement (computer science) Speech synthesis Video game Social class Object (grammar) Library (computing)
Context awareness Scripting language Installation art Code Weight Multiplication sign Demo (music) Insertion loss Software bug Neuroinformatik Formal language Type theory Analogy Sanitary sewer Social class Point cloud Source code View (database) Block (periodic table) File format Concurrency (computer science) Computer file Moment (mathematics) Bit Determinism Bookmark (World Wide Web) Formal language Tablet computer Type theory Sample (statistics) Repository (publishing) Software repository Software framework System identification output Text editor Right angle Quicksort Cycle (graph theory) Spacetime Ocean current Random number Service (economics) Random number generation Computer file Letterpress printing Control flow Code Number Inclusion map Goodness of fit Term (mathematics) Profil (magazine) String (computer science) Navigation Divisor Game theory Quicksort Default (computer science) Data type Window Pairwise comparison Dot product Military base Forcing (mathematics) Projective plane Information and communications technology Code Plastikkarte Line (geometry) Multilateration System call Template (C++) VisualBASIC Factory (trading post) Statement (computer science) Game theory Diagram Window Active contour model Extension (kinesiology)
Tuple Presentation of a group State of matter Debugger 40 (number) Equaliser (mathematics) Multiplication sign Thermal expansion Set (mathematics) Parameter (computer programming) Formal language Word Array data structure Different (Kate Ryan album) Object (grammar) Damping Resource allocation Social class Decision tree learning File format Real number Constructor (object-oriented programming) Keyboard shortcut Interior (topology) Electronic mailing list Bit Type theory Data model Numeral (linguistics) Oval Right angle Quicksort Glass float Programmschleife Speicheradresse Spacetime Implementation Decision tree learning Computer file Letterpress printing Field (computer science) Revision control Writing Iteration Operator (mathematics) String (computer science) Software testing Data structure Immersion (album) Default (computer science) Generic programming Plastikkarte Client (computing) Letterpress printing System call Compiler Number Word Loop (music) Personal digital assistant String (computer science) Object (grammar)
Execution unit Greatest element Sine Decision tree learning Plastikkarte Menu (computing) Total S.A. Letterpress printing Total S.A. Neuroinformatik Formal language Category of being Different (Kate Ryan album) Website Video game console Right angle Category of being Programmschleife
Total S.A. Mereology Total S.A.
Complex (psychology) Installation art Fibonacci number Run time (program lifecycle phase) Code Multiplication sign Range (statistics) Set (mathematics) Price index Water vapor Food energy Formal language Software bug Data management Coefficient of determination Mathematics Computer cluster Semiconductor memory Repository (publishing) Videoconferencing Endliche Modelltheorie Series (mathematics) Library (computing) Lambda calculus Social class Exception handling Link (knot theory) Touchscreen Fibonacci number Dreizehn Web page Moment (mathematics) Electronic mailing list Data storage device Variable (mathematics) Formal language Category of being Type theory Message passing Process (computing) Order (biology) Software framework Website Right angle Quicksort Regular expression Annihilator (ring theory) Electric current Filter <Stochastik> Ocean current Point (geometry) Functional (mathematics) Link (knot theory) Open source Letterpress printing Virtual machine Device driver Control flow Electronic mailing list Number 2 (number) Crash (computing) Population density Natural number Software Video game console Software testing Regular expression Mobile Web Installation art Inheritance (object-oriented programming) Forcing (mathematics) Projective plane Code Database Letterpress printing Line (geometry) Predicate (grammar) Limit (category theory) System call Equivalence relation Performance appraisal Word Loop (music) Password Revision control Finite-state machine Object (grammar)
Webcam Sequel Relational database Multiplication sign Dreizehn Drop (liquid) Computer icon Element (mathematics) Web 2.0 Goodness of fit Googol Computer network Software framework Website Cuboid Software framework Quicksort Table (information) Spacetime Social class
Point (geometry) Web page Overhead (computing) Machine code Link (knot theory) Scaling (geometry) View (database) Device driver Web browser Template (C++) 2 (number) Formal language Web 2.0 Frequency Software testing Software framework Endliche Modelltheorie Extension (kinesiology) Metropolitan area network Social class Physical system Pairwise comparison Mapping Key (cryptography) Database Query language Computer network Volumenvisualisierung Website Speech synthesis Right angle Table (information) Row (database)
Default (computer science) Implementation Just-in-Time-Compiler Run time (program lifecycle phase) Arm Cross-platform Multiplication sign Projective plane Virtual machine Drop (liquid) Mereology System call Graphical user interface Loop (music) Computer configuration Mixed reality Compilation album Cuboid Quicksort Extension (kinesiology) Bounded variation Compilation album Library (computing)
Point (geometry) Group action Building Mobile app Computer file Sequel Java applet Code Debugger Weight Patch (Unix) Source code 1 (number) Online help Coma Berenices Mereology Equivalence relation Formal language Web 2.0 CAN bus Graphical user interface Robotics Core dump Software framework Plug-in (computing) Form (programming) Social class Presentation of a group Source code Addition Structural load Electronic mailing list Mereology Formal language Visualization (computer graphics) Repository (publishing) Function (mathematics) Software testing Convex hull Right angle Quicksort Higgs mechanism Freeware Freezing Window Library (computing) E-learning
Server (computing) Mobile app Thread (computing) Run time (program lifecycle phase) Sequel Computer file State of matter Multiplication sign Execution unit 1 (number) Mereology Pi Web service Goodness of fit Software testing Software framework Endliche Modelltheorie Physical system Area Installation art Injektivität Multiplication Host Identity Protocol Projective plane Moment (mathematics) Electronic mailing list Parallel port Database Unit testing Cartesian coordinate system System call Type theory Process (computing) Integrated development environment Software repository Computer network Right angle Quicksort Virtual reality Directed graph Library (computing)
the. everyone thinks coming. some cool stuff to share with you just maybe take one more minute let people get situated and it will get started. and screen much to. the. right looks like the flow has stopped off almost so welcome to my talk what ask you guys how many of you would consider yourselves the shark that developers historians art so for the camera that everyone basically everyone here said more or less you're doing dot net. and i'm like you in this regard i don't see sharpen dot net for very long time i was doing dot net programming back in two thousand and one when dot net was still in beta before is even a thing so i really like c. sharp i like the ecosystem. and like to take you on this journey. yes out what is at fifteen years or so i've been doing done that and. that is great but there's a lot of drawbacks tutors well right there are not many options for doing dot net outside of windows right but if you want to work on mac what's the story for a long time with mano it kind of sort of worked so much for the service side applications and you want to do. ploy to the cloud to appoint a linux has a much better devolve story a much better to plummet and maintenance story as well as its over half the price cheaper than a lot of reasons you might want to look beyond windows and one of them may just be to diversify your careers. so about four years ago or so i really started looking around this is that steven sinofsky so what is dead time frame of the guy was if they screw this up enough what would i go do other than say c. sharp and i came across python and the more i look at our might why this is a really wonderful ecosystem. wonderful language and it's actually really comfortable place to transition to so what i'd like to do today is go through a sort of start out by introducing some of the basics of the python language and think of action a switch or of will talk about the shop a little bit first but what about c. sharp as awesome dot net it's because. system i was about little studio like what are the things that you really miss if you weren't doing the sharper done it and they're going to go and just quickly look at the python language enough that you guys who maybe have not seen it are able to fall on you see that's really really simple it takes like and of ten minutes tops maybe five and. then we'll go through all the things that we decided we're cool about the sharp and will look at the parallel or their analogous feature in python and i think you'll be surprised at the moment of this compares to an art so what is python well first of all it's a language the high level programming language. just like c. sharp it's also an ecosystem it's also run time and it's interpreted so it has by could much like c. sharp as i'll but instead of taking our last up and doing just compilation on it it just takes that by could interpret it interprets it in a sea run time however. it also can be just compiled as wealthy. it's very object oriented. it's strongly typed people think of python is a dynamic language there are parts of it that are strongly tight everything that is a everything that is a variable is a pointer imposed on everything that points to has a type has a an object of some form as an inheritance tree to actually. but the actual semantics of the language are dynamic right you don't say the type but out there there really are types and the syntax those or history of this language was to create very readable language that turns out to be super important because most of the time we are reading code not writing code right so. you see pythons a joy to read once you get control the and finally it has a very similar idea to and what you guys haven't got met with assembly's with these things called packages came.
you often hear the term that python comes with batteries included ryan this sort of a a theme in the language the standard library comes with batteries include this web frameworks a jingle is the web framework with batteries included with that means is it really has a lot of rich features baked into a very much like the base class library. the and dot net there's a rich class library and of course there's a broader ecosystem as well.
are so that's all really nice and and did the one thing that you're going to have to get used to have not seen this before is how python the fines code blocks and sort of control flown in from actions and so on now. if you work with us for just a few days you'll find it is super comfortable it's actually i think nicer than was the star does from a type in perspective at least probably reading as well but you don't have to stay in the first hour to the work of the actors are suspended or your belief that this is a huge seems were something i suspect it would if you're coming from. he shot to the way python defines blocks of code is with white space. so here we have are two methods there in these blue boxes and we haven't if and else statement and each one another no curly braces the way that we know that these are could block sure what political could sweets are indications are here we have a method there's no indication that we intend for spaces and everything. and for spaces is within this method when you stop inventing now you're in another block to find in a class or method or something similarly we have and if he was in comparison knows there's no parentheses around it. we really have to type the print this is all the time it feels like you do could you do it every day but in fact there's really no benefit you can type of men python if they add some value but other not required to write so will see that there's no cynical and at the end the line of the code blocks in the end of the method at the end. now at the end of the first line the method and of the first line of the if statement always start with colin to say now here comes a block and dent right white space really matters in this language everything should be intended for space is not a tab as equivalent for spaces not three spaces things like that now that sounds like a challenging requirements a t.v.. this requirement but you'll see the editors make this like entirely transparent you so no curly races know from the seas tab deny your friend tabs are so much disliked him python that there's an exception type this as i found the tab and are so i said what what about dot net is it that if if you were to go. can some other language like somebody said hey you have to go back and were conceived know what what would you miss right so here's here's my list i'm sure you guys have a a list as well it probably has a pretty strong intersection or so one of the things that's cool about c. sharp is everything derived from a common object so you can through a tree every. thing is an object if nothing else right. the ability to not care about index ease when you're on your looping around stuff like for i equals zero five plus plus that you don't have to do that c. sharp you can just go through a collection anything that is i knew mobile you can just for each other that's really awesome right so of didn't have that would miss it. i'm entirely over the concept of writing get age set ages two functions like he was flustered job or something like that and so the properties that let you do that encapsulate invalidation like you need to but don't make the consumers of the class pretend it's a method i was really nice with class properties. anonymous types new get any new get how did you get now for five years some like this it really changed the way that we interact with open source with extra libraries are basically of the builders a bad reference to something on the internet and its days and think that's fantastic. orams and the framework that you can debate whether or under a good idea but if you like them you would really like to keep using i think the bugging little studio is definitely one of the better to begin tools out there was no ideas it's a really great tool so that i would be something about a speech on. that n.b.c. find what framework link the number back things two thousand and eight when it came out seizure of three that was a fantastic addition to the language right just declared of programming model really nice some kind of rich id often you see people working in python and them or emacs. for some no very sort of show based editor right that's probably something you would not want to go to use a little studio i'm guessing that some kind of isolation write this multiple versions the run time you know the whole thing with gotten a core and basically installing the run time as a really large now. get package and that's that's a really cool feature but also the previous years builder have a different version the run time there that's great. yield and if you guys use the real key word probably the the coolest feature that is the least known as a some kind of ratio there and done at the yield is amazing for building generators and sort of leisurely evaluated methods. land as baseless libraries jack compilation rush hour for guys are sharper and of course otherwise you have to type it's bad and then finally some kind of like designer drag adoptee stuff right to this all cool to have a show you his every single one of these has a feature that is as good and many times better than python. and you haven't done it right so if you could say i'm going to check out some of the language as a whole bunch of other cool advantages cross-platform free. easy to point to a lot of things in it had all these features that would be really compelling my goal is not to get you to stop writing c. sharp but just the sort of diversifier i think about what's out there are so first of all. little studio right you would not want to go without this thing and muse the community addition because i can three when a so come over here and will fire have little studio has reached arbor and all those sorts of things that stalin but wait for it to come to life here it is does have a sharper after all right.
i would only the service for here so you could say look there's no way i'm going to give this thing up as beautiful as you come here say are i want to create farming project in advise him in notice you get python tools vigil studio created by steve our and some of the guys that microsoft who. are not just people who decide as some kind of feature the height of about of python to the trustee of these guys are literally core developers on the sea python run time these are the people that contribute to python itself might discover and create identification or i. in this as double again it has intel sense it has all the cool stuff you know watch windows whatever that you would expect in the studio so that's pretty sweet so if you like i couldn't give a little studio cool go for. no one is the conclusion of this rush hour per idea there's actually in my opinion a little bit better id that confirm the jet brains guys so if you can use vista you might want to check out something called high charm so i was really excited to hear that the japanese guys created. the project writer which is their own sort of dedicated c. sharp by the without little studio just like what it was all what it was a sharp are all the way down i would be cool well that's basically what i term is right it's like the id that generates created for python and it's really really slick art so let's go and actually write a little bit. of code using high charm just enough will spend maybe five minutes in a few more looking at it. art so here.
hopefully the funds are big enough i know that this is small but the main other phones are larger quite so we're going to go on creating a file. credit card on file collett let's see. game doesn't want to create a game right now all the stuff going to be available to you and i get have repo in the sharper just asked it looks like you're working within this good have repository are to get a story that matter to get have do you want to add this file so yes we do an ad this file are so what is going to play again. just this number game really really simple write a note the computer will think of a number between let's say you're on one hundred and i'll say what number you think i'm thinking of its highs it too low something like this will give us just enough like playing around with the scent acts to become tools so we can start out and we don't have a con sold out right line. we don't have that. rather we have print a very similar otherwise so print this is the guessing still is hard the guessing game but away high trouble fix spoiling years and both your method names type names and in strings are at sewing his friends and empty line here who does. and then let's say we want to get a number from the user so instead of saying come to rely on we can just say input will say i guess people's input what number and i think enough. was a zero hundred inclusive months but like so. are so we also need to. have a number that we are thinking of some maybe just conceptually have enough first makes losses will say call of the number in a c. sharp you would probably right the number like this but here we have what's called snake casing have lots of underscores imposed on as you'll see so we want to create a random number so we can use this thing called random. just like in dot net and sharper knows that we actually have to sort of ad reference to this so we can say import this name up at the top this is like a using plus add reference in one shot that makes a rand aunt from zero to one hundred that may not be inclusive one hundred but good enough. so the many of this guess and we could say we could try to compare the guest but right now it's a string we could actually test that by printing out this so let me run this fight is doom of here really quick so you can see there's no little she was about my should be able to click it heard about it but nothing happens so if i go over here and i write. click i can say you are run the bug run with code coverage profile it on current good stuff but let's run it. and now i can just press appear from so on right eye. so i can say let's say fifty guess it. maybe a print this not just executed. i was struck fifty again. so this is the class of string and we want s.t.r. but that string and python we want energy or so we have to convert it to an interviewer that's easy enough. so was called the something like gas tax analogies or a factory name. that will come down here will say now that gas is actually. i'm going to convert the spike on this construct a friend know we can just do our little if block will be done with our game so will say something like this while. guess is not equal to the number want to do something i don't want to leave an empty space here for a moment while a print out the last line now normally would just to critically right but there's no cronies are what you put is a keyword called passes here's a block but it's simply from own hold on so the animal print done that. the hearing to say if. well. guess we want to run this a few times a week so we can come to hear him that and. so if we go here then of course that it won it in when we can say something like print. the statement right so see if the guess is greater than the number now member told about the white space human seem like filling with the space bar anything watch the so by coal a enter high charm automatically knows i'm to find codes we must indent for spaces but i want to go back the chance i want to go back one space. i would never want to do that in this context so by hit the back space it goes back for the tablet goes forward it looks like there's tabs i told you there's the opponents have so much there's an exception high for these are actually spaces that the editor just knows. force bases his showing say print too high and and here i can say else. front too low. i guess an agent else if i'll have to guess lower than the number. coming into else and break the cycle. are right. so i just do this. we're done we'll say sunlight print right it was and we could and c. sharp you could just find out the gas they want implicitly convert things to strings so and c. sharp you could write this you could say crilly brace star. the format that you could say guess he said and five and two are so let's get in here and just play this game one time of lee's working fifty. two high forty two high thirty. when he can suspicious ten. oh five eight now i suppose nine k. so that's a fight on language it's it has classes and other stuff that look at here in a minute but it's. oh. it's pretty straight for is quite familiar you know you have the sort of dots and tax random dot such and such it's quite like see sharpen the other ceiling which is except for these could sweets that you see if you use of a proper editor. it's basically transparent you if you use notepad even we haven't about time don't do that. ok so let's carry on i said now we know little bit about the language lets you some comparisons have some features are so i won't take the timing a run it but i can tell you may be that is a later dema in high charm and individual studio we have very very similar to begin to.
curious what you guys have and c. sharp don't think we have at it continue i think that's probably good i was ok so we also saw that it's the sharp everything is an object and python three everything is an object both of these languages if you omit object from the right in that inheritance. then guess what. it's still an object right or so very similar in that sense and that means that they have a common set of methods that you can override replacing here you can see in our seas are documents were over writing the to string method and were when you call the to string is as i am a document now. in python we have something called the python data model. and it involves a lot of underscores but it means basically the same thing so having this concept of like an operator or this space method of about. forty forty ish methods that are were called either dunder methods for double underscore on both ends or magic method so here you can see we're using the dunder stir remember he saw its across name for string so this is like the to string fort right we could under we could define a dunder bull in our we could do a true false test. could do a quality in all these sorts of things on her right but notice. which one has more typing and more surrounding supporting structure that doesn't mr have to be there so this is kind of an edge cases little bit the python looked a little cleaner once you get used to the dunder underscore that will underscore thing may be knocked down a bit but. you'll see this is the thing that repeats art for each member for each very nice don't have to worry about indexes and off i wanted years these kinds of things well. python has something very similar they don't use the word for each the use for thing in but it means exactly the same thing. right so what if we have a list on the left and c. sharp we have an array in the right and python to raise our lists basically there. the dynamic expandable things you can create a raise but there are actually harder to do is stand shades of the default thing is these expendable arrays called list like you'd expect and then anything that is a collection was all sorts of collections you can just like and c. sharp for each of them but we call a foreign now. now one of these awesome and c. sharp as you can actually add this year on tight right if i have a tight here we call of a shopping cart i can just implement i knew rubble of to pull of string of calm float and then implement both the generic version and then for historic reasons because generics. but added that the seas are two thousand and two. we also implement the the older object based version of get intimate are right and this case notice we're like just leveraging the getting numerator feature of our underline type rights we have a a list the list itself is a memorable so we're just basically same when you numerate my type just do whatever the list as for an immersion. so let's do this for a python sos go here making a file.
um. i'm sorry. so over here and the rerun this time ago so it is we want to create a class in our class was a shopping cart was a class shopping cart. and had a constructor now the constructor and imposed on it is a to faze thing there's a allocation constructor and then there's the sort of initialize or so we have this done under in it method now the way you define field umpires on is a little different. so you sort of dynamically within this initialize or add the types to the class so if we want to have a set of items heart was made to make early click on car items some like that and we could initialize that to an empty list is what you write. king now let's actually to find some items as well so a cart item. and it's going to have a net pyjamas a cool little a short cut for that lets say this has a name and a price some like that so much are knows that this is how you add field so i can sit alton turns as would you like to add name as a field to this class course i would maybe i did that for prices well now. ok. so here i can say let's create a cart equal shopping cart like so you don't say new just say the name and call it is what's called a call and into the car we can give it to a method for ad here we could just directly work against the car items but let's say death ad words. now in many languages we have a keyword this python we have a keyword called self. the difference is you explicitly state that as a parameter when you define the type where's in c. sharp and suppose this is it's also passed in the execution when you call the method but it's implicit you don't state it so anyway. it will say the hairs a self-taught cart items out of ten the item is now incumbent years ago my cart say and notice even though it says self you don't actually say self it's basically implicit so let's add a. card item and our car item is going to take two things right you could see his name in a priceless call this a tesla and was a tesla run up to do this and dollars are not good enough to converting. how about that ok let's add also a leaf another electric car and i think that's more like thirty thousand us dollars ok so this is great we've got a shopping cart and it's got some items and here we could try to print it out you won't see much but you look carefully says all there's a shopping cart object. this memory address know. so let's try to loop through it in print them out so i can area say for item in cart and say present the. still like this will do the price. the work you think i think that will work and the and. quantities of the format and you see item dot price and name ok now i run this is not going to be super happy it's going to say. card is not in trouble if i tried and c. sharp i would get a compiler are saying cannot convert shopping cart to a new mobile or something like this right cannot use in fortune but the way that i added it is actually going to be less effort here. and so i come over here to my shopping cart class and i can define he done under it or method. and then i just do as i could either implement my own so version or i could lie can see sharp lean on the list implementation so for now i'll do this as a self-taught car adam start under its or i just like getting numerator on the list and c. sharp an hour on this. you can see the summer i have heard of something. and. oh yeah like this no just is a common area. right. i think you are so that schools so all we have to do is implement this method of here. and we got it or asian into our for in loop just like you would and seizure. right so we look back over here was.
you can see same teacher less work. take some getting used to realize that this is only right but if if you were equally comfortable in both languages which one would you rather read and maintain and i are cool properties i said i'm totally over get things set thing but the need for them is really important and it's cool to see sharp as it. school the python has it as well. so you basically to find a basic method and you put a what's called a decorator a property decorator onto it and that transforms it into you look at the bottom down here total prices cruzeiro card a total price total price is clearly there a car dot total price only difference is the name in sin tax naming convention. one on the site right pretty awesome right so this is cool for like a computer property we could add this to our.
are part of here you go of total scala total and we could retrieve we can do something like this. total of safety for now equal zero. for i and self that heightens the last equals i'd up rice maternity know. now this is a method but if i do this and i can hear the and i can say friend the total is. carved out the total just getting property right. total is one hundred thirty thousand dollars. the cool.
so we have the same basic idea anonymous objects member anonymous objects are most important c. sharp for projections in link expressions right but there are generally useful in a few ways right. so we could write like this we could say new and just to find two properties on it a python doesn't have this feature of a pipe on a super flexible so we can define a class that says when anybody tries to get an item off of you actually you drive from dictionary for ten you're calling the get methadone dictionary and when somebody tries to set an item on you actually said an item in your underlying fiction. the method and then we can basically right the same. korea will see that this would be potentially useful for exactly the same reason as it is as sharp around projections to the job jackson and databases and stuff like that. heartland expressions and i learned about leverage questions of course these came with the sharp three as well as how these things are amazing career ice cold right. art so little homework on this actually switch over here. and let's do another example. i value so-called this one was called methods and filters like that. so let's try to quit method. and this will be. soldier numbers it's going to have some kind of function that you pass called test and it's going to have was a limit so we can tell how many we want and i guess what started it would really care to find another to colon enter thing artomatic lean dense say for now there's no faith with interest in his eye. can write this on equal zero on a less than ten and i play sports like that literally doesn't exist there is no numerical for loop and python mean you won't talk about embracing the i know mobile sort of concept right it's all you can do but what we can using say for and and range in creating a new. the rubble type literal type goes from zero to one hundred and then loop over that this uses lazy evaluation much like a link of objects or something like this would so i can say to hear if i would say. now test of this is a method that takes an energy and returns a boy i could say if this numbers in the set whatever your test you going to give me as a call this. to numbers whatever make the list we could say data out of ten and an and the and say return data. what's so i could have another method even some like that it takes a numb some like that and returns no a moment to his ear and if so then i could do something like my d.d. equals filter in numbers and i could get even not call it. the pass is a function and i could print those numbers and i run the right one knew from this. he can see if you can actually see even numbers are. but of course and c. sharp you don't have to write this even things like that's as much on compressed you don't want to do that you want to just write some sort of thing here the sharp you would say like a gnome goes to know what say we want all things the visible by eleven. model of the calls are right you can see the python is not happy because we can do this said what we do as we say lambda. we put a call and sober. now. then. our best published in print the story. men in korea. super mare super clean ok. right so yet we can write the same time and again look at the size of code of how much junk is on the screen. if you are equally comfortable in both languages which one would you rather look at married is the theme. are right link now had to see sharp your link in the sharpest better than the equivalent in python yet so was very we have a collection called people we want to go through that collection final people who are over thirty we want to order by their age descending and we want to do a projection to just kill back. few of their values as an anonymous site so python we have something called a list comprehension. which is very very similar and you can also create as something called a generator expression as well and you've got to kind of remap these things like the from goes to a for the were goes to an f. the select goes to my not a subject. the order is different. it's not quite nice but it's actually surprisingly similar but there's no sort bilton sadly i'm ok this one is really powerful this is maybe one of the main reasons you guys should consider python came in c. sharp you can go and use new get and i said new get change the way that we can see sharp work with. packages work with open source and the open source adoption grew massively after new get became a thing now. so in python we have something called pip. something called to forget that what it stands for and we can do basically the same thing so here in installing the mahdi be driver for c. sharp here installing among the driver for fight on them.
so you can say well new get his amazing new get has so many packages and it's incredible there are fifty almost fifty seven thousand projects on you get that i can go on to add reference to his mate. python we have the single pipeline has eighty one thousand eighty two thousand packages right so if you want to do machine learning pip install psychic learn for lines of code your now doing like predicting machine. i wanted to proper. storage in hashing insulting of passwords pippen stall past live run this with enough complexity it takes point two seconds to test a password so some like one hundred thousand fold on three lines ago i beautiful. right now one of the things really cool about c. sharp i said i think it's probably less years maybe i'll do a poll on you guys how many of you people understand that c. sharp could there like a familiar with that. yeah ok so for the video that's a third third of the audience so let's write this and python and so just was not really quick this is the fibonacci sequence this will generate an infinite series. at the end the fibonacci numbers are an infinite series of numbers this method will generate an infinite collection that you can for each over i and yet it does it instantly without killing machine are locking up for things like that so could this be done and find on the answer is yes called the so let's go with a fine. method called fit. we could say. this number equals such and such an obvious a settlement was just say hundred from and there's two numbers involved the fibonacci sequence goes like one one two three five eight thirteen where the following numbers the some of the previous two one plus one as to what was to his three two posters five and so on. but in nature math that kind of stuff so we need to numbers current and next nominee saying next tee because next to the proper word is a thing as to find some ball now check this out in python we have this concept of two bulls but not a does well but it's not nearly as in integrated in the language so i can say. i would like these two numbers to start out one n one and i can unpack these like so you see this is a lot of really cool of use is not just a fine variables like this so i could say this while current was saying next was less than say two hundred will fix is going to be infinite so that. water will say. let's start selling so i will say what the current you don't use what numbers in sharper always christ reception right temporary variable chance at one of the other said other to the temporary variable here we can just say this is going to be next. and next plus trend. i will say in numbers out of ten i think i got that right. and then and and say return numb so just print. the. and maybe want to run. yes thing. it was like them right but this is about it said this is like this is just our times this is not super interesting has a lot of print the season makes important now that really. i so let's actually say i want all the numbers. now. what can happen if i run it like this how long will it take to run. answer not long for how long will take the crash not long to get around a memory right is going to jam into that list until it's done well we can now we can actually say this i can say yield just like in c. sharp current. what that means is going to go through here and every time i find an item say here is an item in my said the runtime have to basically create a state machine that is admirable that than runs through this force now this is going to run forever this is bad but i can say for an inflated and then consume and top five as a consumer have decided. and is greater than three hundred break now otherwise print and and i want to not do much new lines all say i want to separate my lines with that. now aren't look at this. korea. but it's not just cool like that like watch this vital the bug a thing. they're not good book. so you can hear what is a step in here i am stopping step in stepping yield first item its back here i work with it and then when it jumps back it's going to go back probably the line for now but certainly not really run this method. and check out the a dog or this is really sweet. it is automatically shows all the variables are and scope like in line and that's pretty awesome ok so the same thing happens in c. sharp except.
look we have to write. which would you rather read it on your element to write don't have a time like i can still sort of give you as much as it does so i was given the. a speedo net is a fine but framework i've written lots and lots of popular how heavily used websites will say and. i really enjoyed working with a spit out that in the cabinet in the sea. python we also have much to everyone's turns out the web is the most i had become probably the most prominent place for python i see a lot data science you see a lot and devolves d.c. lot in many places but the web it really shines there's a few sites have been built with high. on the sea discuss you tube early version of google. interest you know sites that are not little minor things right like serious site to read it for example drop box almost all the infrastructure including little tray icon and the website in his written and python and. another thing is really nice really important is a good day to access story right so on both english as we have mangini be which is already a really good story but traditional sort of relational database stuff and the framework well respected in the garden space here we have something called sequel alchemy. at least as good a very nice lady loading either loading on navigation relationships it has seen as something like i'm. in the framework could first that actually generate the tables from classes things like that. right so let me just pull up a quick website that i built with a webcam or compose uncle pyramid and sequel coming in just show you guys really quickly so i run a podcast called talk by phone to me in its quiet pull it up.
there i can just show you like a few the moving pieces. so just show you that looks like something that all the running.
i do notice one thing this is a really large website actually if if that was a speech not met there would be like attend twenty seconds like compiling a s.p.x. pages a razor there's like always has long start a period like this right. yet you'll see the performance is really cool so. let's look at a particular page of i come over here i've got a bunch of episodes i click on one of them here's an example. and i come over here this be deterred. it's. so. if you can see. we're here we have a temple page like is like a razor this is the method its maps there's some data like idea of the. the episode as well as a page name that is also mapped over. we create this view model the light goes to the database of talk about a second and then we just return a dictionary to our. simple page and very much like raiser you say things like at episode not name but use progresses instead right now we look at this of the model thing was here you see it actually go to the ship was tory and gets up so does a few other things to hear it says. don't create me a database session to create query based on the steps of class and find where the show id is the past and show id given the first one. pretty similar to the framework is not identical cars it doesn't leverage just like link things more like the a the extension method style blink and you look at this is one of these database and cities you can see this is the table name of russian people are coming base here is the primary key which i said to be are incremental created it here is the whether or not. published a row and it's the fault values false and going and index on that a really nice in just by typing out this class and hitting go it will basically create the tables of they don't exist really nice system now you might wonder well sure this is fine michael for like a silly little website but what if it. acquires performance right dot net is compiled how the machine instructions it's got to be faster right man on a so i did a test. the talk i did another conference where i created something like this but use mangini be used by mongo and the see chart monger driver and comparison and it talk to him on the database with one point two million records and it did a web request same basic stuff you saw career he gets the database take. the record sending over to the template render in razor and chameleon which was called here and then return it to the browser. in c. sharp was pretty fast it can do that in nyc nine to ten second milliseconds. the python did it and six miles or so. it's. it's hard to compare the performance but it's it's easy to think of this is like a scripting language so it must be slow and inefficient actually this this site is probably faster this way than if i'd written in a spirit that not necessarily because python is faster but because the overhead of a speed on that is bigger than the overhead that you to plug it in the what are called microfracture. remarks and python. ar.
so hopefully that look inside the school said jay compilation write this actually really is important for certain especially around like computational work this is really important right.
so in part on what to do well it's by default interpreted the right time you get called the python me that implemented and see but is actually interpreted. but there's a project called pipe i a python runtime written in python hence the pipe eye and it does just compilation just like c. sharp. and this is much much faster than regular python five ten times faster however it's not as compatible with certain libraries the performance story in python is really different than it isn't dot net because like that's equal to the library should you much of its run in python but there's like the inner part where does likes. serialisation and there's a really hot loop that is actually written see an imported as a c. extension right so you there's a lot of mixing of like this little part of slow so is right that loop and see that all the sudden like really dramatically change the performance story so it's not super easy to say interpreted not interpreted. because there's some variations there but this is one option is also arm python and i thought on which let your own python on the c.r. and j.v. i'm respectively i invite on his kind of fading away but it's still pretty interesting drop box i said basically everything they do is an impact on so they're very interested in performance they're working on this thing called. poston and the azure machine learning guys are working on something called pigeon to add get a compilation to the sea python run time as an option and are using the dot net corso are as of the first sort of implementation of this just pretty interesting and that's cross-platform so that's that's cool. now again had to to see chart been on the story it's by far and away a better story than it is imposed on to do is probably the least common thing that you write in part on but you can write them and there are some options that are not banned so you can use this thing called cute or cutie has like a drag. drop the designer and what's cool about cuba's is cross-platform so guys an example of one of these.
i do out mongo in my favorite a tool for mama to be a singer called robot longo just go heroes pulls and stuff and as human rights of this u.i. i think it's a pretty slick what can you i. this thing is which i think looks quite native one of the problem with these cross-platform things as they look fake like to remember all the java early java like file dialogues a load this is something weird write this is not like that and this is written in cute. and technically straightness the post wasn't you but just as well could have been written a python and q now.
so now we have to be p.f.. so when this form of people do not as well and python you can take cute. and this thing called by side or pike you depending on their sort of can peak in libraries you can build something like rebel mongo and its cross-platform then you can use something called c x freeze to package it as any exceeds or pipe after patches of the app files so it looks like native damp nobody would even know it by them. you can also use d.p.f. with iran by them. can even do in the medium with your python classes and you can also on i was ten years cocoa pio b j c which plugs into the cocoa a piano as can. right so. that's python it's a simple readable language that is very full featured. we saw the parts of c. sharp that are i think at least are really important hopefully that largely intersected with your list. and we saw that point by point the python ones are pretty comparable sometimes a little less good it's a fairly often maybe even better right. so we've never really nice the bugger i the and pipes are as well as by the tools original studio he saw i was using visual shia community addition and the python tools are free so that's like a hundred percent free on your own windows right that's pretty cool also i didn't mention before we. we have little studio code they now have a python plug in for visual studio code as well so if you don't do that on i was ten. ok you want to get the source code from this talk you know my get up and fight just to a chicken through harm you have it right so get a dot com slash might see kennedy and then you can succumb repositories there should be at the top if you go soon but it's python dashboard asked artnet. attached as dashing easy that are as low as two thousand sixteen so much for concise messiah. our heart so so if you want to go deeper into this is like really interesting to you. i said i have a podcast called talk by phone to me and i have some classes and stuff online classes for these kind of things but check out the podcast i've got sixty two episodes now and go out interviews with people like for example i talked about pigeon and the microsoft guise of steel our core stuff i interviewed those guys for a while i talked. to steve dour who did the python to his original studio to talk to the guise of the large hadron collider how these python help find the higgs boson i thought was awesome lots of really cool stories of what people are doing and they mostly on the python podcast so check that out and talk with hundred of them. write anything else know that's the and ok. or so you guys only questions anything like to look at those of a kind of a separated group here yes question so. how do you do the deployment so the deployment story. so the question how do you do that the planet well basically there's no compiling rights you can just copy the files but you still there's basically true until you get to the point where you have some kind of dependencies for example of using like sequel alchemy and a web framework you have to also deploy those.
as in all of their dependents is what shines out to be many many things so let's take a quick look at how that might go. that is not what i was looking the press area are so. so you might start by having a project are you going to work on you probably create was called a virtual environment. so let's go.
so i can say something like this i say python three run the model the in the into in the sea. the ploy just say it's ok. wait a moment. and she now there's an m.d.c. folder. right so there is a there's little activate things let me just ask this question which python when i get a fight python is as you get the system one right. and like new get i can say tip list i kind of said the results be like so this is like the new gets july so here's all the stuff i've got installed right but what of these do i need to deploy right so this is not helpful so i can say dot activated and run this now if i say. it hit list. but it actually just has this invites a cable which one which python reason. during this so korea like a copy of my run time as if you could like somehow copy the still aren't like a little isolated thing and then i would say something like hip install. what i say see cockney may use a haircut. a sequel alchemy. so that's going to go and download and install it and i can say ok let's hear this right he would do this probably on your deployments are you can actually create a file called requirement start to extend the that lists out all the things you're apt to pens upon you say he installed my requirements. activate this environment and run that's worked for the server for desktop type things you something called six freezer pipe app to create an exterior dot at filed that basically does this and stashes it like internally that help. no other questions yes. defense injection unit testing mocking. no yes yes. the dependency injection there is this concept but it is leveraged less because it's easier to just like stick stuff together so there are dependency injection libraries and puppy i have people use unless there are definitely mocking frameworks and there are three or four good unit testing frameworks there's one built into the base cost library. i called unit test but probably the most popular ones called something called pie test and you can use in both its very j. unit style for the unit has style. you basically critic lasted rise from a test fixture and then. then you name your methods test something and it runs on you have a certain methods like you haven't gene. yeah. sorry. a sink yeah ok so good question that probably should have gotten my less tracing can weigh in with reading stuff. as of python three four think one three five and five on three four they added literally the keywords a sinking away. now that does not work exactly the same way as it does for c. sharp in c. sharp basic it away work generally over all sorts of threading and a to get away work better well this is me for this threading and python generally works better when it's blocking io. right when you weigh on a database call on a network call web service called something like that computationally the parallels and am python is not great there's a model called. will be ready in a multi process i'm not sure thing all the process where you might be processing we're basically for other processes and run. run in parallel instead of doing threading. inside the a right but they do have a sinking awake in a way it works well for blocking aisle. i have one more minute any other questions yeah. so are you going to be like a little are this is really. what about the democrats are. how do you maintain large applications there's a good question i would say you know testing is certainly part of it. one part is you can break you know so you know how i did kippen saucy clocking i could pay pick install requests it's the other the external libraries you can build your application out of your own broken down libraries like this and then you can state them as a dependency. your app so some people do this you can actually kind of like i think you can do this new good as well you can host your own private high p.-i server within your company and so i could come over and say i don't know what it is but. i could give it like another repo the has access to my private things and state those requirements and install them and things like that so you testing packaging so isolation things like that now. right looks like time is up to be happy to answer more questions after but i'll let you guys go think every for coming.
Feedback