• Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    Here is a starting point for a mock interpreter. It is far from complete but it already parses many examples. (It can't parse examples with list comprehension, but I don't …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    I modified the code of `dis.disassemble()` to create a function which disassembles the line where the function `f()` is called. I think it can help you in trying to handle …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in change the niceness of a process

    I don't see how the process could have a pid before you launch it, so the answer is most certainly after launching the process. You could also start the program …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to Ene Uran in No module named PySide

    Linux sounds more and more interesting. Seems to have a lot of nice tools.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Accessing windows registry

    Did you try pypi packages such as https://github.com/Infinidat/infi.registry or https://pypi.python.org/pypi/registry/0.4.2 ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    I'll have a look.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in print won't execute

    If the dictionary file was created on windows, it may have windows-like end of lines. Try to open the dictionary file with mode 'rU' (universal newlines).
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in change the niceness of a process

    If you don't mind using a third party library, you may consider [psutil](https://code.google.com/p/psutil/wiki/Documentation#Classes) where process objects have `get_nice()` and `set_nice()` methods.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    The original idea was not to build a bytecode decompiler. Why do you want to support expressions such as a, b, c, d = 1, f(), 2 When you define …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in No module named PySide

    On my system, PySide is in the folder /usr/lib/python2.7/dist-packages Check that this directory is in the python path >>> import sys >>> '/usr/lib/python2.7/dist-packages' in sys.path True If it is not …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    > due to python being a slow language, any little performance increase matters This is simply not true. It is true that python is a slow language, as compared to …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    Here is the new version without decorator. I don't know why I didn't think about this in the first place. # python 2 or 3 from __future__ import print_function """module …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    Hm, now that we have the `varnames()` function, I don't see why we would need a decorator anymore. Why not directly examine the bytecode when `varnames()` is called ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    OK, here is the new version. You're the beta tester. The module and the decorator are now named `usevarnames` # python 2 or 3 from __future__ import print_function """module usevarnames …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    Ok, I'll write the new version. Why do you want to inline the helper function in the wrapper ? It obfuscates things. Let the bytecode apart. I'm working on it.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    I think a module `usesvarnames` can contain both the decorator, the stack variable and the function `varnames()`. Nothing else is needed near the wrapped function. Code could look like import …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    What we could do is to push the varnames tuple on the top of an external stack (or a `collections.deque`) before calling the function, and pop it out of the …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in No module named PySide

    Perhaps a `sudo apt-get install python-pyside` (or python3-pyside).
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Regex (Newbie trouble) re

    You need to add value = float([y for x, y in valueTable if x == 'Price/Book (mrq):'][0]) print(value) You could perhaps find the table first with a `findAll('table', ...)`.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    It occurred to me that you could replace varnames = vars.pop('varnames', ()) with varnames = vars.pop('varnames', ("<anonymous struct>",)) in my previous code. It would allow creating struct having a descriptive …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in HELP PLZ

    The best thing to do is to post your program here and explain what doesn't work.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    The snippet is [here](https://www.daniweb.com/software-development/python/code/317012/create-values-from-variable-names-). If you don't like the name `varnames`, change the snippet to have `_tcll_own_varnames__` or some other unlikely name. You can also use a singleton python object, …
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Create values from variable names.

    Sometimes you want the value of a variable to be related to its name in the source code. For example, the variable x should have the value "var x". This …
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Create values from variable names.

    Sometimes you want the value of a variable to be related to its name in the source code. For example, the variable x should have the value "var x". This …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Create values from variable names.

    The original snippet has been edited with the most recent version. It must be stressed again that this is a interesting hack which may work only for some versions and …
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Create values from variable names.

    Sometimes you want the value of a variable to be related to its name in the source code. For example, the variable x should have the value "var x". This …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    Those are very good reasons. You probably know that python can also generate C code. Here is my code, using my code snippet (module kernilis.withvarnames) This is the version at …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how do I make a class instance act as a class??

    The pythonic solution to name the class the way you want in such a context is to pass the class name as argument. I mean have a syntax such as …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in What Languages Can You Guys Speak?

    My mother tongue is French, I studied English and German at school, but I hardly can speak German. May be one day I'll learn Italian: one of my friends used …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to snippsat in Regex (Newbie trouble) re

    Cant find what you search in respData. Do post also post your import. import urllib.request, urllib.parse This is the adress,you get data from. >>> resp.geturl() 'https://ca.finance.yahoo.com/lookup?s=basics' Do you find `Price …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Regex (Newbie trouble) re

    We see the failing regex, but we don't know how it fails. Can you post a fully failing python example with a (short) concrete respData ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in PIL and matplotlib for Linux

    In Kubuntu, aptitude says that the new python Pil is a fork of Pillow.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in PIL and matplotlib for Linux

    On my system it is sudo apt-get install python-matplotlib python3-matplotlib python-pil python3-pil It is easier to find packages with aptitude sudo apt-get install aptitude aptitude search pil
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python countdown timer

    What is your version of python ?
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Introducing the symboldict module

    I uploaded a module named [symboldict](https://pypi.python.org/pypi/symboldict) to the python package index (pypi). This snippet shows how to use it to create a dictionary of symbols from various modules. This dictionary …
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Introducing the symboldict module

    I uploaded a module named [symboldict](https://pypi.python.org/pypi/symboldict) to the python package index (pypi). This snippet shows how to use it to create a dictionary of symbols from various modules. This dictionary …
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Introducing the symboldict module

    I uploaded a module named [symboldict](https://pypi.python.org/pypi/symboldict) to the python package index (pypi). This snippet shows how to use it to create a dictionary of symbols from various modules. This dictionary …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python 2 and 3

    Well, self-answered, great!
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Introducing the symboldict module

    I uploaded a module named [symboldict](https://pypi.python.org/pypi/symboldict) to the python package index (pypi). This snippet shows how to use it to create a dictionary of symbols from various modules. This dictionary …
  • Member Avatar for Gribouillis
    Gribouillis

    Created Introducing the symboldict module

    I uploaded a module named [symboldict](https://pypi.python.org/pypi/symboldict) to the python package index (pypi). This snippet shows how to use it to create a dictionary of symbols from various modules. This dictionary …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in removing line numbers

    You can try something along the line of ss = re.sub(r'^\d+ ?', '', s, re.MULTILINE)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Is an asthma air purifier good to go to get rid of smoke ?

    You can give your neighbor an electronic cigarette. Many heavy smokers (including me) stopped with the e-cigarette. Give him e-liquid with 11mg nicotine to start with.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Season's Greetings

    Merry christmas!
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in InterfaceError: Error binding parameter 0

    What is your database ? You are trying to perform multiple SQL statements at the same time. In the usual python dbapi, this is done with [cursor.executemany()](https://www.python.org/dev/peps/pep-0249/#executemany). Did you try …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Create a password you can remember

    It looks like a culinary advice from Mac Donalds :)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in The message

    Merry xmas and Happy New year guyzzzz :)))
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Laptop cover, no internal "organs"

    It could be useful in combination with raspberry pi computers which have no input and output devices. Well. We're waiting for your online store!
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in AttributeError: 'MyClass' object has no attribute

    There may be indention issues in your code. What is the `self` at lines 28 and 36 for example? Also avoid to have two different variables `program_buttons` and `programs_button` in the …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in new idle

    Merry Christmas! The look is very similar to [DrPython's](http://drpython.sourceforge.net/screenshots.html), which was also designed for teaching purposes (I think it was a python version of a DrScheme (now DrRacket) related to …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in remote screenshot in python

    I think you need the ability to run a program on the remote computer. This can be achieved with a ssh server on the remote computer.

The End.