Skip to main content

Home/ Mac Attack/ Group items tagged c#

Rss Feed Group items tagged

Benjamin Bandt-Horn

Chapter 1. python 2.0 - 1.55.0 - 0 views

  • The Boost Python Library is a framework for interfacing Python and C++. It allows you to quickly and seamlessly expose C++ classes functions and objects to Python, and vice-versa, using no special tools -- just your C++ compiler. It is designed to wrap C++ interfaces non-intrusively, so that you should not have to change the C++ code at all in order to wrap it, making Boost.Python ideal for exposing 3rd-party libraries to Python. The library's use of advanced metaprogramming techniques simplifies its syntax for users, so that wrapping code takes on the look of a kind of declarative interface definition language (IDL).
  •  
    The Boost Python Library is a framework for interfacing Python and C++. It allows you to quickly and seamlessly expose C++ classes functions and objects to Python, and vice-versa, using no special tools -- just your C++ compiler. It is designed to wrap C++ interfaces non-intrusively, so that you should not have to change the C++ code at all in order to wrap it, making Boost.Python ideal for exposing 3rd-party libraries to Python. The library's use of advanced metaprogramming techniques simplifies its syntax for users, so that wrapping code takes on the look of a kind of declarative interface definition language (IDL).
Benjamin Bandt-Horn

Unicode and new style string formatting ~ The Voidspace Techie Blog - 0 views

  • Unicode and new style string formatting Python 2.6 and Python 3 gain a new style of string formatting, which is apparently based on the string formatting in C#. I wasn't a big fan of the string formatting in C# and so wasn't very excited about it moving into Python, but as is to be expected it has grown a bit on me.
  • As always, the best solution is to not mix Unicode and byte-strings but to keep all strings in Unicode and only perform the encode when actually needed.
  • So why does this behaviour matter? Well it particularly matters for framework authors formatting messages based on 'user' input. This is the case with unittest, which creates error messages when tests fail. The error messages internally in unittest are byte-strings and they are often mixed with user supplied messages using string formatting. We use old-style (% based) formatting, so if the user supplies byte-strings then the resulting messages will be byte-strings. If the user supplies Unicode strings then the resulting messages will be in Unicode. Because all the internal unittest messages are ascii only we can guarantee than an implicit decode to Unicode will succeed - so the user can choose the output type by varying the type of the messages they provide.
  •  
     Python 2.6 and Python 3 gain a new style of string formatting, which is apparently based on the string formatting in C#. I wasn't a big fan of the string formatting in C# and so wasn't very excited about it moving into Python, but as is to be expected it has grown a bit on me.
Benjamin Bandt-Horn

Gosu (library) - Wikipedia, the free encyclopedia - 0 views

  •  
    Gosu is an open source 2D game development library for the Ruby and C++ programming languages, available for Mac OS X, Windows and Linux. The C++ version is also available for iPhone and iPad.
Benjamin Bandt-Horn

Stackless Python - Wikipedia, the free encyclopedia - 0 views

  • Stackless Python, or Stackless, is a Python programming language interpreter, so named because it avoids depending on the C call stack for its own stack. The most prominent feature of Stackless is microthreads, which avoid much of the overhead associated with usual operating system threads. In addition to Python features, Stackless also adds support for coroutines, communication channels and task serialization.
  •  
    Stackless Python, or Stackless, is a Python programming language interpreter, so named because it avoids depending on the C call stack for its own stack. The most prominent feature of Stackless is microthreads, which avoid much of the overhead associated with usual operating system threads. In addition to Python features, Stackless also adds support for coroutines, communication channels and task serialization.
Benjamin Bandt-Horn

Boilerplate code - Wikipedia, the free encyclopedia - 0 views

  • Or in C# using Automatic Properties with compiler generated backing fields: public class Pet { public PetName Name { get; set; } public Person Owner { get; set; } }
  •  
    Or in C# using Automatic Properties with compiler generated backing fields: public class Pet { public PetName Name { get; set; } public Person Owner { get; set; } }
Benjamin Bandt-Horn

gevent: A coroutine-based network library for Python - 0 views

  • gevent is a coroutine-based Python networking library that uses greenlet to provide a high-level synchronous API on top of the libev event loop. Features include: Fast event loop based on libev (epoll on Linux, kqueue on FreeBSD). Lightweight execution units based on greenlet. API that re-uses concepts from the Python standard library (for example there are Events and Queues). Cooperative sockets with SSL support » DNS queries performed through threadpool or c-ares. Monkey patching utility to get 3rd party modules to become cooperative »
  •  
    gevent is a coroutine-based Python networking library that uses greenlet to provide a high-level synchronous API on top of the libev event loop. Features include: Fast event loop based on libev (epoll on Linux, kqueue on FreeBSD). Lightweight execution units based on greenlet. API that re-uses concepts from the Python standard library (for example there are Events and Queues). Cooperative sockets with SSL support » DNS queries performed through threadpool or c-ares. Monkey patching utility to get 3rd party modules to become cooperative »
Benjamin Bandt-Horn

Panda3D - Free 3D Game Engine - 0 views

  •  
    Panda3D is a game engine, a framework for 3D rendering and game development for Python and C++ programs.
Benjamin Bandt-Horn

IntegratingPythonWithOtherLanguages - Python Wiki - 0 views

  • ActiveState research Python for .NET is a near-seamless integration of the CPython runtime with the .NET Common Language Runtime (CLR). IronPython is an implementation of Python for .net, which allows you to import .net class libraries seamlessly in Python.
Benjamin Bandt-Horn

Rapid GUI Programming with Python and Qt - 0 views

  • From PyQt4.6, PyQt has two APIs, API#1 (the original), and API#2 (new). API#2 is more Pythonic and eliminates QString and QVariant, and is a bit nicer to use. API#1 remains best for those using PyQt to prototype C++/Qt applications. API#1 is the default for PyQt4.x with Python 2.x, and for PyQt4.0-4.5 with Python 3.x. API#2 is the default for PyQt4.6+ with Python 3.x, and for PySide.
  • most of the changes affect uses of QDataStream, QSettings, and QTextStream, and of course any use of QString methods (since in API#2, QString is gone, so we use str).
  • To convert any particular example to PySide the steps are as follows: Replace python3 in the first line with python. Add the following statements before the first import: from __future__ import division from __future__ import print_function from future_builtins import * Replace PyQt4 with PySide throughout (e.g., in the imports) If using Python 2.6 replace {} in format strings with {0}, {1}, etc., as appropriate. Add [0] at the end of every QFileDialog.*() function call. (In PyQt these return a—possibly empty—filename; in PySide they return a filename–filter 2-tuple, but all the examples only need the filename.) Replace QT_VERSION_STR with qVersion(). Replace PYQT_VERSION_STR with PySide.__version__; you will also need to add import PySide in the imports after the future imports. Replace @pyqtSignature with @Slot. Replace def isAlive(qobj): ... with def isAlive(qobj): return True. (There is currently no PySide equivalent.) Replace chr with unichr.
Benjamin Bandt-Horn

Why are there no ++ and --​ operators in Python? - Stack Overflow - 0 views

  • You don't write things like for(int i = 0; i < 10; ++i) in Python very often; instead you do things like for i in range(0, 10).
  • it would add opcodes to the language (implying a larger, and therefore slower, VM engine)
  • in the "C" world it is most effectively used (not most commonly) with pointers. There is a direct mapping to some instructions sets that support pre- or post-increment of address registers
  • ...2 more annotations...
  • Python doesn't have tricks to convey intentions to the assembler because it doesn't use one.
  • this 'koan' also hints that increment/decrement operators are non-obvious
  •  
    You don't write things like for(int i = 0; i < 10; ++i) in Python very often; instead you do things like for i in range(0, 10).
1 - 10 of 10
Showing 20 items per page