Giter Site home page Giter Site logo

pythontoscala's Introduction

PythonToScala

PyToScala

The goal of this project is to be a concise guide for those transitioning from Python to Scala. This is by no means meant to be a complete guide to Scala, but rather some (hopefully) helpful snippets of code to help you translate between the two languages.

This guide loosely follows along with the text of Scala for the Impatient, a great introductory book for those learning Scala. You might find it helpful to read it alongside the chapters from this repo.

Note that in general, you should not try to directly translate idioms from one language to another; you don't want to write Scala that looks like Python- you want to write Scala that looks like Scala! You should strive to write idiomatic code whenever possible. A good starting point is Twitter's Effective Scala

I recommend reading through the guide in the following order:

  1. Variables and Arithmetic
  2. Conditionals
  3. Functions
  4. Strings
  5. Sequences
  6. Maps
  7. Tuples
  8. Exceptions
  9. Classes

Here are some Scala topics not discussed above that I think are important to review:

  • Pattern Matching This is like a switch statement on turbo, and is very powerful and oft used. The Scala Cookbook has really great practical examples.
  • Auxiliary Constructors Classes can have multiple constructors that operate on different argument types/number of args.
  • Case Classes as an immutable, record-like data-structure that can be pattern-matched.
  • Scala Collections There is a lot of power in all of the methods available to data structures like Vector, Array, List, Sequence, Set, etc. Just take a look at all of the available methods.

This can also be read as a GitBook, which offers pdf/ebook downloads and a nice web format for reading.

pythontoscala's People

Contributors

wrobstory avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.