Skip to content

Commit

Permalink
Merge pull request #172 from evhub/develop
Browse files Browse the repository at this point in the history
Release v1.2.0
  • Loading branch information
evhub authored Sep 24, 2016
2 parents 3ae4c27 + 9a72e4d commit 0a61a70
Show file tree
Hide file tree
Showing 63 changed files with 8,413 additions and 4,736 deletions.
25 changes: 19 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Macintosh desktop services store files
# OS files
.DS_Store

# Windows thumbs database file
Thumbs.db
*~
.#*
._*
\#*\#
.cache

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -53,15 +56,25 @@ coverage.xml
*.mo
*.pot

# Django stuff
# Django
*.log

# Sphinx documentation
_build/
_docs/

# PyBuilder
target/

# Ipython notebook
# Ipython
.ipynb_checkpoints

# Vim
*.sw[nop]
.ropeproject

# Sublime
*.sublime-*

# Coconut
tests/dest/
docs/
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- repo: git://github.com/pre-commit/pre-commit-hooks.git
sha: 18d7035de5388cc7775be57f529c154bf541aab9
hooks:
- id: check-added-large-files
- id: check-byte-order-marker
- id: end-of-file-fixer
- id: trailing-whitespace
- id: debug-statements
- id: autopep8-wrapper
args:
- --in-place
- --aggressive
- --aggressive
- --ignore=W503,E501
- id: flake8
args:
- --ignore=W503,E501,E265,E402,F405
691 changes: 24 additions & 667 deletions .travis.yml

Large diffs are not rendered by default.

512 changes: 352 additions & 160 deletions DOCS.md

Large diffs are not rendered by default.

25 changes: 15 additions & 10 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

1. [Can I use Python modules from Coconut and Coconut modules from Python?](#can-i-use-python-modules-from-coconut-and-coconut-modules-from-python)
1. [What versions of Python does Coconut support?](#what-versions-of-python-does-coconut-support)
1. [Help! I tried to write a recursive iterator and my Python segfaulted!](#help-i-tried-to-write-a-recursive-iterator-and-my-python-segfaulted)
1. [If I'm already perfectly happy with Python, why should I learn Coconut?](#if-im-already-perfectly-happy-with-python-why-should-i-learn-coconut)
1. [How will I be able to debug my Python if I'm not the one writing it?](#how-will-i-be-able-to-debug-my-python-if-im-not-the-one-writing-it)
1. [I don't like functional programming, should I still use Coconut?](#i-dont-like-functional-programming-should-i-still-use-coconut)
1. [I've never done functional programming before, should I still try to learn Coconut?](#ive-never-done-functional-programming-before-should-i-still-try-to-learn-coconut)
1. [I don't know Python very well, should I still try to learn Coconut?](#i-dont-know-python-very-well-should-i-still-try-to-learn-coconut)
1. [I don't like functional programming, should I still learn Coconut?](#i-dont-like-functional-programming-should-i-still-learn-coconut)
1. [I don't know functional programming, should I still learn Coconut?](#i-dont-know-functional-programming-should-i-still-learn-coconut)
1. [I don't know Python very well, should I still learn Coconut?](#i-dont-know-python-very-well-should-i-still-learn-coconut)
1. [Why isn't Coconut purely functional?](#why-isnt-coconut-purely-functional)
1. [Won't a transpiled language like Coconut be bad for the Python community?](#wont-a-transpiled-language-like-coconut-be-bad-for-the-python-community)
1. [I want to contribute to Coconut, how do I get started?](#i-want-to-contribute-to-coconut-how-do-i-get-started)
Expand All @@ -25,23 +26,27 @@ Yes and yes! Coconut compiles to Python, so Coconut modules are accessible from

Coconut supports any Python version `>= 2.6` on the `2.x` branch or `>= 3.2` on the `3.x` branch. See [compatible Python versions](http://coconut.readthedocs.io/en/master/DOCS.html#compatible-python-versions) for more information.

### Help! I tried to write a recursive iterator and my Python segfaulted!

No problem—just use Coconut's [`recursive_iterator`](http://coconut.readthedocs.io/en/master/DOCS.html#recursive_iterator) decorator and you should be fine. This is a [known Python issue](http://bugs.python.org/issue14010) but `recursive_iterator` will fix it for you.

### If I'm already perfectly happy with Python, why should I learn Coconut?

You're exactly the person Coconut was built for! Coconut lets you keep doing the thing you do well—write Python—without having to worry about annoyances like version compatibility, while also allowing you to do new cool things you might never have thought were possible before like pattern-matching and lazy evaluation. If you've ever used a functional programming language before, you'll know that functional code is often much simpler, cleaner, and more readable (but not always, which is why Coconut isn't purely functional). Python is a wonderful imperative language, but when it comes to modern functional programming—which, in Python's defense, it wasn't designed for—Python falls short, and Coconut corrects that shortfall.

### How will I be able to debug my Python if I'm not the one writing it?

Ease of debugging has long been a problem for all compiled languages, including languages like `C` and `C++` that these days we think of as very low-level languages. The solution to this problem has always been the same: line number maps. If you know what line in the compiled code corresponds to what line in the source code, you can easily debug just from the source code, without ever needing to deal with the compiled code at all. In Coconut, this can easily be accomplished by passing the `--linenumbers` or `-l` flag, which will add a comment to every line in the compiled code with the number of the corresponding line in the source code. Then, if Python raises an error, you'll be able to see from the snippet of the compiled code that it shows you a comment telling you what line in your source code you need to look at to debug the error.
Ease of debugging has long been a problem for all compiled languages, including languages like `C` and `C++` that these days we think of as very low-level languages. The solution to this problem has always been the same: line number maps. If you know what line in the compiled code corresponds to what line in the source code, you can easily debug just from the source code, without ever needing to deal with the compiled code at all. In Coconut, this can easily be accomplished by passing the `--line-numbers` or `-l` flag, which will add a comment to every line in the compiled code with the number of the corresponding line in the source code. Alternatively, `--keep-lines` or `-k` will put in the verbatim source line instead of or in addition to the source line number. Then, if Python raises an error, you'll be able to see from the snippet of the compiled code that it shows you a comment telling you what line in your source code you need to look at to debug the error.

### I don't like functional programming, should I still use Coconut?
### I don't like functional programming, should I still learn Coconut?

Definitely! While Coconut is great for functional programming, it also has a bunch of other awesome features as well, including the ability to compile Python 3 code into universal Python code that will run the same on _any version_. And that's not even mentioning all of the features like pattern-matching and destructuring assignment with utility extending far beyond just functional programming. That being said, I'd highly recommend you give functional programming a shot, and since Coconut isn't purely functional, it's a great introduction to the functional style.

### I've never done functional programming before, should I still try to learn Coconut?
### I don't know functional programming, should I still learn Coconut?

Yes, absolutely! Coconut's [tutorial](http://coconut.readthedocs.org/en/master/HELP.html) assumes absolutely no prior knowledge of functional programming, only Python. Because Coconut is not a purely functional programming language, and all valid Python is valid Coconut, Coconut is a great introduction to functional programming. If you learn Coconut, you'll be able to try out a new functional style of programming without having to abandon all the Python you already know and love.
Yes, absolutely! Coconut's [tutorial](http://coconut.readthedocs.io/en/master/HELP.html) assumes absolutely no prior knowledge of functional programming, only Python. Because Coconut is not a purely functional programming language, and all valid Python is valid Coconut, Coconut is a great introduction to functional programming. If you learn Coconut, you'll be able to try out a new functional style of programming without having to abandon all the Python you already know and love.

### I don't know Python very well, should I still try to learn Coconut?
### I don't know Python very well, should I still learn Coconut?

Maybe. If you know the very basics of Python, and are also very familiar with functional programming, then definitely—Coconut will let you continue to use all your favorite tools of functional programming while you make your way through learning Python. If you're not very familiar either with Python, or with functional programming, then you may be better making your way through a Python tutorial before you try learning Coconut. That being said, using Coconut to compile your pure Python code might still be very helpful for you, since it will alleviate having to worry about version incompatibility.

Expand All @@ -55,7 +60,7 @@ I certainly hope not! Unlike most transpiled languages, all valid Python is vali

### I want to contribute to Coconut, how do I get started?

That's great! Coconut is completely open-source, and new contributors are always welcome. Contributing to Coconut is as simple as forking Coconut's [`develop` branch](https://github.com/evhub/coconut/tree/develop) on GitHub, making your changes, and proposing a pull request. If you have any questions at all about contributing, including understanding the source code, figuring out how to implement a specific change, or just trying to figure out what needs to be done, try asking around at Coconut's [Gitter](https://gitter.im/evhub/coconut), a GitHub-integrated chat room for Coconut developers.
That's great! Coconut is completely open-source, and new contributors are always welcome. Contributing to Coconut is as simple as forking Coconut on [GitHub](https://github.com/evhub/coconut), making changes to the [`develop` branch](https://github.com/evhub/coconut/tree/develop), and proposing a pull request. If you have any questions at all about contributing, including understanding the source code, figuring out how to implement a specific change, or just trying to figure out what needs to be done, try asking around at Coconut's [Gitter](https://gitter.im/evhub/coconut), a GitHub-integrated chat room for Coconut developers.

### Why the name Coconut?

Expand All @@ -65,4 +70,4 @@ If you don't get the reference, the image above is from [Monty Python and the Ho

### Who developed Coconut?

[Evan Hubinger](https://github.com/evhub) is an undergraduate student studying mathematics and computer science at [Harvey Mudd College](https://www.hmc.edu/).
[Evan Hubinger](https://github.com/evhub) is an undergraduate student studying mathematics and computer science at [Harvey Mudd College](https://www.hmc.edu/). You can find his resume online at <http://evhub.github.io/resume.pdf>.
Loading

0 comments on commit 0a61a70

Please sign in to comment.