background preloader

CodeSkulptor

CodeSkulptor

Skulpt Templating Templating, and in particular web templating is a way to represent data in different forms. These forms often (but not always) intended to be readable, even attractive, to a human audience. Frequently, templating solutions involve a document (the template) and data. Template usually looks much like the final output, with placeholders instead of actual data (or example data in simplified form), bears common style and visual elements. Templating Engines There are many, many different HTML/XML templating packages and modules for Python that provide different feature sets and syntaxes. The number of templating engines is so great because the mechanisms involved are pretty easy to write in Python, at least for a fairly basic template engine; this recipe from the Python Cookbook shows how easy it is. Engines using Value Substitution The simplest form of templating engine is that which merely substitutes values into a template in order to produce the final output. HTML Shorthand Processors

Top 10 Python idioms I wish I'd learned earlier I've been programming all my life, but never been a programmer. Most of my work was done in Visual Basic because it's what I was most comfortable with, plus a smattering of other languages (R, C, JavaScript, etc... Pascal, Applescript, Hypertext and BASIC, which I learned in 1979, if you go far back enough). A couple of years ago, I decided to use Python exclusively so that I could improve my coding. I ended up re-inventing many wheels -- which I didn't mind too much, because I enjoy solving puzzles. But sometimes it's good to have a more efficient, Pythonesque approach, and time after time I found myself having "aha!" Missing from this list are some idioms such as list comprehensions and lambda functions, which are very Pythonesque and very efficient and very cool, but also very difficult to miss because they're mentioned on StackOverflow every other answer! There's also an IPython notebook nbviewer version of this document if you prefer.

24.6. IDLE — Python v2.7.4 documentation IDLE is Python’s Integrated Development and Learning Environment. 24.6.2. Editing and navigation In this section, ‘C’ refers to the Control key on Windows and Unix and the Command key on Mac OSX. Backspace deletes to the left; Del deletes to the rightC-Backspace delete word left; C-Del delete word to the rightArrow keys and Page Up/Page Down to move aroundC-LeftArrow and C-RightArrow moves by wordsHome/End go to begin/end of lineC-Home/C-End go to begin/end of fileSome useful Emacs bindings are inherited from Tcl/Tk:C-a beginning of lineC-e end of lineC-k kill line (but doesn’t put it in clipboard)C-l center window around the insertion pointC-b go backward one character without deleting (usually you can also use the cursor key for this)C-f go forward one character without deleting (usually you can also use the cursor key for this)C-p go up one line (usually you can also use the cursor key for this)C-d delete next character Standard keybindings (like C-c to copy and C-v to paste) may work.

IntegratingPythonWithOtherLanguages [Hint: The idea is to create pages for the stuff, not just link it.] There a various tools which make it easier to bridge the gap between Python and C/C++: Pyrex - write your extension module on Python Cython -- Cython -- an improved version of Pyrex CXX - PyCXX - helper lib for writing Python extensions in C++ SCXX ctypes is a Python module allowing to create and manipulate C data types in Python. These can then be passed to C-functions loaded from dynamic link libraries. elmer - compile and run python code from C, as if it was written in C PicklingTools is a collection of libraries for exchanging Python Dictionaries between C++ and Python. weave - include C code lines in Python program ackward exposes parts of Python's standard library as idiomatic C++ C/C++ Binding Generators Tools to make C/C++ functions/methods accessible from Python by generating binding (Python extension or module) from header files. Articles Related See also to name a few.

80+ Best Free Python Tutorials, eBooks & PDF To Learn Programming Online Thinking of learning Python to make a dent in the universe? We have compiled a huge list of absolutely FREE Python tutorials, eBooks and PDFs to make your life easier. Python has taken over the programming world with a storm and has now become one of the most popular languages. You may prefer to read a few awesome books on Python if you prefer. Regardless of whether you are a beginner or an advanced learner, you can learn Python language online through the following (completely free) resources: Interactive Websites To Learn Python Online Some interactive python tutorial for beginners can be really useful in quickly learning the language. Python Monk This is a Free, interactive collection of tutorials learn python in browser. Free Websites If you wish to understand Python language from scratch or simply want to add on to your existing knowledge base, you can seek help from the one of the online websites which renders free of cost services in teaching you all the nuances of the language.

matplotlib: python plotting — Matplotlib 1.2.1 documentation The Python Tutorial Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms. The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation. The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). This tutorial introduces the reader informally to the basic concepts and features of the Python language and system.

matplotlib Tutorials - matplotlib plotting examples and tutorial Prequsites Download and install python, matplotlib and numpyor pythonXY (includes all of the above and more) Changes in code are marked with red Simple plot #import matplotlib libaryimport matplotlib.pyplot as plt #define some datax = [1,2,3,4]y = [20, 21, 20.5, 20.8] #plot dataplt.plot(x, y) #show plotplt.show() Simple plot - configure the line and markers #plot dataplt.plot(x, y, linestyle="dashed", marker="o", color="green") Simple plot - configure axes #plot dataplt.plot(x, y, linestyle="dashed", marker="o", color="green") #configure X axesplt.xlim(0.5,4.5)plt.xticks([1,2,3,4]) #configure Y axesplt.ylim(19.8,21.2)plt.yticks([20, 21, 20.5, 20.8]) Simple plot - title & labels #configure X axesplt.xlim(0.5,4.5)plt.xticks([1,2,3,4]) #configure Y axesplt.ylim(19.8,21.2)plt.yticks([20, 21, 20.5, 20.8]) #labelsplt.xlabel("this is X")plt.ylabel("this is Y") #titleplt.title("Simple plot") Simple plot - errorbars

s Python Class - Educational Materials Welcome to Google's Python Class -- this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience. The first exercises work on basic Python concepts like strings and lists, building up to the later exercises which are full programs dealing with text files, processes, and http connections. The class is geared for people who have a little bit of programming experience in some language, enough to know what a "variable" or "if statement" is. To get started, the Python sections are linked at the left -- Python Set Up to get Python installed on your machine, Python Introduction for an introduction to the language, and then Python Strings starts the coding material, leading to the first exercise.

Related: