Skip to main content

Home/ Mac Attack/ Group items tagged data

Rss Feed Group items tagged

Benjamin Bandt-Horn

The Python Computer Graphics Kit - 0 views

  • The Python Computer Graphics Kit is an Open Source software package containing a collection of Python modules, plugins and utilities that are meant to be useful for any domain where you have to deal with 3D data of any kind, be it for visualization, creating photorealistic images, Virtual Reality or even games.
  • Provides access to specialized input hardware such as SpaceMouse/SpaceBall, data glove or tablet via wrappers around the 3DxWare SDK by 3Dconnexion, the Wintab Developer Kit by LCS/Telegraphics and the Data Glove SDK by Fifth Dimension Technologies.
  •  
    The Python Computer Graphics Kit is an Open Source software package containing a collection of Python modules, plugins and utilities that are meant to be useful for any domain where you have to deal with 3D data of any kind, be it for visualization, creating photorealistic images, Virtual Reality or even games.
Benjamin Bandt-Horn

How to implement __iter__(self) for a container object (Python) - Stack Overflow - 0 views

  • usually __iter__() just return self if you have already define the next() method (generator object)
  • While you are looking at the collections module, consider inheriting from Sequence, Mapping or another abstract base class if that is more appropriate. Here is an example for a Sequence subclass:
  • if hasattr(self.data[0], "__iter__": return self.data[0].__iter__() return self.data.__iter__()
  •  
    if not self.data: raise StopIteration
Benjamin Bandt-Horn

Metaprogramming - 0 views

  • Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime.
  •  
    Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime.
Benjamin Bandt-Horn

[SLUT] - 0 views

  • ABOUT Slut is a programming framework for generative, synthetic, interactive, network-enabled graphics. Slut generates images from processes. Such processes may be simple "construction plans" or they may depend on user input. They may be drawn from incoming network data or messages that are sent to the network. Produced images may be adaptive, accumulative or static. They may look and feel like computer games or they may inform like scientific visualizations. They may be lyrical, cynical, political, intrusive (literally over the network), simply beautiful or banal.
  •  
    ABOUT Slut is a programming framework for generative, synthetic, interactive, network-enabled graphics. Slut generates images from processes. Such processes may be simple "construction plans" or they may depend on user input. They may be drawn from incoming network data or messages that are sent to the network. Produced images may be adaptive, accumulative or static. They may look and feel like computer games or they may inform like scientific visualizations. They may be lyrical, cynical, political, intrusive (literally over the network), simply beautiful or banal.
Benjamin Bandt-Horn

Stack data structure in python - Stack Overflow - 0 views

  • No need to jump through these loops, See 5.1.1 Using Lists as Stacks
Benjamin Bandt-Horn

3. An Informal Introduction to Python - Python v2.7.6 documentation - 0 views

  •  
    Python knows a number of compound data types, used to group together other values. The most versatile is the list, which can be written as a list of comma-separated values (items) between square brackets. List items need not all have the same type.
Benjamin Bandt-Horn

3. Data model - Python v2.6.6 documentation - 0 views

  • it is advised to somehow mix together (e.g. using exclusive or) the hash values for the components of the object that also play a part in comparison of objects.
  • If a class does not define a __cmp__() or __eq__() method it should not define a __hash__() operation either
  • Called when an attribute lookup has not found the attribute in the usual places (i.e. it is not an instance attribute nor is it found in the class tree for self). name is the attribute name. This method should return the (computed) attribute value or raise an AttributeError exception.
  • ...2 more annotations...
  • new-style classes
  • By default, instances of both old and new-style classes have a dictionary for attribute storage
  •  
    special method names
Benjamin Bandt-Horn

Practical guidelines for beautiful Python code | TurnKey Linux Blog - 0 views

  • a well defined mental model of the problem domain
  • Refining the architecture is part of the "refactor mercilessly" rule
  • If you've never inherited from a built-in data type, experiment with a small test case in a throw away script. This way you don't mangle your current project and you can be as experimental as you like.
  • ...3 more annotations...
  • constants are always class level attributes because they are shared by all instances
  • code is communication
  • If a method doesn't need access to instance level attributes then it should be a class method, not a regular method. If a method doesn't need access to class level attributes then it should be a static method, not a class method.
Benjamin Bandt-Horn

Python: How do I pass a variable by reference? - Stack Overflow - 0 views

  • Parameters are passed by value
  • some data types are mutable, but others aren't
  • If you pass a mutable object into a method, the method gets a reference to that same object and you can mutate it to your heart's delight, but if you rebind the reference in the method, the outer scope will know nothing about it, and after you're done, the outer reference will still point at the original object.
  • ...5 more annotations...
  • List - a mutable type
  • String - an immutable type
  • you could return the new value. This doesn't change the way things are passed in, but does let you get the information you want back out:
  • use_a_wrapper_to_simulate_pass_by_reference
  • But sometimes the thing was a pointer
  •  
    Parameters are passed by value
Benjamin Bandt-Horn

Binary Tree in Python - Stack Overflow - 0 views

  • def PreOrder(self): print self.data if self.left: print self.left.PreOrder() if self.right: print self.right.PreOrder()
1 - 10 of 10
Showing 20 items per page