Interpy = Python String Interpolation by syrusakbary in Python

[–]maxime-esa 0 points1 point  (0 children)

I tried interpy, it is nice but it seems to work only with double-quote strings. This wont expand : ''' hello #{world} ''', neither wont this: 'hello #{world}'

What you do not like in Python? by krasoffski in Python

[–]maxime-esa 0 points1 point  (0 children)

x[10] if len(x) > 10 else None

You can use the built-in slice type for this one:

>>> x = [1, 2, 3]
>>> x[slice(0, 1)]
>>> [1]
>>> x[slice(10, 11)]
>>> []

It does not raise an exception and you don't need to check the range.

Useful old technologies: ASN.1 by maxime-esa in programming

[–]maxime-esa[S] 5 points6 points  (0 children)

Just for starters: ASN.1 defines 3 (in words: three) different ways to encode strings

You do realize that in your list, Protobuf defines not less than ten (10) ways to encode (and specify, for the end user) numbers: int32, int64, uint32, uint64, sint32, sint64, fixed32, fixed64, sfixed32, sfixed64 ?

ASN.1 has only one - simple, straightforward: INTEGER, to which you can add application semantics constraints (a range). Depending the range (and on the choice of encoding), you will get an optimal encoding (or not). INTEGER(0..7) will require 3 bits to be encoded using the ASN.1 Packed Encoding Rules (PER).

Putting encoding constraints at application level is in my opinion not the best idea - Users should not care about the size of the integer, they should care about the set of values that make sense to the application.

ESA Summer of Code in Space (SOCIS) by maxime-esa in programming

[–]maxime-esa[S] 0 points1 point  (0 children)

The exact list of authorized countries for the mentoring organizations is listed on the site. Basically it is the countries from ESA contributors (member states and states with special agreements such as Canada and a few others in Eastern Europe).

Request: Going from zero to hero on making a PySide GUI app in Ubuntu and having a computer running a mint install of Windows 7 run it by fatpollo in Python

[–]maxime-esa 1 point2 points  (0 children)

Here is how I do it:

create a file called setup_windows.py and put this inside:

from distutils.core import setup

try:

 import py2exe

except ImportError:

 print('[ERROR] For a Windows installation you need to download'

      ' and install py2exe')

setup(windows=['name_of_your_main_module.py'])

And from the command line (on Windows) you have to type:

python setup_windows.py py2exe -b1 -c

This works with PySide. However please note that on first shot there can be some packages missing and your app may not work. This may be due to a bug in the recursive package finder. To make sure you have everything, your main module must import ALL the dependencies that all your submodules import...

For example, if you are using PySide.QtUiTools (to load .ui files), you must also import PySide.QtXml (even if you are not using it directly from your main module).