Difference between revisions of "SnakesInASpace"

From Whitespace (Hackerspace Gent)
Jump to: navigation, search
(setting up readline completion)
 
(7 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
|End date=2010/05/16 20:00:59
 
|End date=2010/05/16 20:00:59
 
|Location=Whitespace
 
|Location=Whitespace
|Cost=free for members, donation for non-members
+
|Cost=5
|Presenters=Fs111,  
+
|Presenters=Fs111,
 
|Short description=and now for something completely different!
 
|Short description=and now for something completely different!
 
}}
 
}}
This is a placeholder page for the upcoming python beginners workshop. If you are interested in it, please help finding a date on the doodle: http://www.doodle.com/mzhdmdpg8t5q55ig
+
== Please register here ==
 +
http://www.doodle.com/mzhdmdpg8t5q55ig
  
 
== What kind of workshop is this? ==
 
== What kind of workshop is this? ==
Line 37: Line 38:
 
* a text editor of choice, anything will do, I use [http://www.vim.org vim]. Tips for vim and Python [http://vim.wikia.com/wiki/Category:Python here].
 
* a text editor of choice, anything will do, I use [http://www.vim.org vim]. Tips for vim and Python [http://vim.wikia.com/wiki/Category:Python here].
 
* a shell
 
* a shell
* some programming knowledge is really helpful,, but this is a hackerspace, you should have seen code before :-)
+
* some programming knowledge is really helpful, but this is a hackerspace, you should have seen code before :-)
  
 
== How much does it cost? ==
 
== How much does it cost? ==
Line 45: Line 46:
  
 
PYTHON!!!!11 No srsly, I will do it in English.
 
PYTHON!!!!11 No srsly, I will do it in English.
 +
 +
 +
== setting up readline completion ==
 +
  export PYTHONSTARTUP=$HOME/.pythonrc
 +
 
 +
 +
  # Add auto-completion and a stored history file of commands to your Python
 +
  # interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
 +
  # bound to the Esc key by default (you can change it - see readline docs).
 +
  #
 +
  # Store the file in ~/.pystartup, and set an environment variable to point
 +
  # to it:  "export PYTHONSTARTUP=/home/user/.pystartup" in bash.
 +
  #
 +
  # Note that PYTHONSTARTUP does *not* expand "~", so you have to put in the
 +
  # full path to your home directory.
 +
  import atexit
 +
  import os
 +
  import readline
 +
  import rlcompleter
 +
  readline.parse_and_bind('tab: complete')
 +
  # readline.parse_and_bind("bind ^I rl_complete") # for osx
 +
  historyPath = os.path.expanduser("~/.pyhistory")
 +
  def save_history(historyPath=historyPath):
 +
      import readline
 +
      readline.write_history_file(historyPath)
 +
  if os.path.exists(historyPath):
 +
      readline.read_history_file(historyPath)
 +
  atexit.register(save_history)
 +
  del os, atexit, readline, rlcompleter, save_history, historyPath

Latest revision as of 14:33, 16 May 2010

Note: this article is about a passed event.

SnakesInASpace
WhitespaceLogo.gif
From 2010/05/16 14:00:00 to 2010/05/16 20:00:59
Presenters (2):
Fs111
Where:
Whitespace Blekerijstraat 75, Gent, Belgium
Loading map...

Costs 5

Cornify

«and now for something completely different!»

"Unknown" is not in the list of possible values (Meeting, Workshop, Talk, Slacking, Conference, Hacking) for this property.

Please register here[edit]

http://www.doodle.com/mzhdmdpg8t5q55ig

What kind of workshop is this?[edit]

This will be a beginners workshop, things I (fs111) want to cover.:

  • Brief introduction in the who, what and where in python
  • Hello World and the interactive interpreter
  • control structures
  • built-in types (numbers, strings, lists, dicts, sets etc.) and higher level functions
  • input/output
  • module system (imports)
  • objects and classes and types
  • documentation system
  • neat little tricks and features you should know (generators, list comprehension, slicing)
  • some modules from the standard lib that you should know (OS interface, filesystem, option parsing, xml?, network stuff etc.)
  • Q/A all the time of course


How long will the workshop last?[edit]

I really don't know. I try to cover the stuff mentioned above and then we can go into freestyle hacking, where we help each other out I guess. As long we do not run out of mate we can go on :-) The list of topics usually too long for one session, so expect a second one.


What do I need to participate?[edit]

I will use the latest release of the Python 2.x series which is 2.6 right now. 3.x is out already for some time but the adoption is low and a big number of 3rd party modules are not ported yet. So what I would expect from you is that you have the following installed:

  • python 2.6, which can be downloaded here
  • a text editor of choice, anything will do, I use vim. Tips for vim and Python here.
  • a shell
  • some programming knowledge is really helpful, but this is a hackerspace, you should have seen code before :-)

How much does it cost?[edit]

It is free for members and non members are kindly asked to make a donation, the more, the better!

What language will this workshop be in?[edit]

PYTHON!!!!11 No srsly, I will do it in English.


setting up readline completion[edit]

 export PYTHONSTARTUP=$HOME/.pythonrc
 
 # Add auto-completion and a stored history file of commands to your Python
 # interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
 # bound to the Esc key by default (you can change it - see readline docs).
 #
 # Store the file in ~/.pystartup, and set an environment variable to point
 # to it:  "export PYTHONSTARTUP=/home/user/.pystartup" in bash.
 #
 # Note that PYTHONSTARTUP does *not* expand "~", so you have to put in the
 # full path to your home directory.
 import atexit 
 import os
 import readline
 import rlcompleter
 readline.parse_and_bind('tab: complete')
 # readline.parse_and_bind("bind ^I rl_complete") # for osx
 historyPath = os.path.expanduser("~/.pyhistory")
 def save_history(historyPath=historyPath):
     import readline
     readline.write_history_file(historyPath)
 if os.path.exists(historyPath):
     readline.read_history_file(historyPath)
 atexit.register(save_history)
 del os, atexit, readline, rlcompleter, save_history, historyPath
Historical data can not be displayed in a Factbox