• Member Avatar for Gribouillis
    Gribouillis

    Created Generate unique words based on computer time

    This snippet defines a function returning new identifiers created from reading the computer's time.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Replacing in a list Help!

    Try L[:] = [(' ' if x == '32' else x) for x in L]
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating mesh with triangle, tetgen, or meshpy (python wrapper)

    Did you run the meshpy examples here ? One of them may resemble your problem https://github.com/inducer/meshpy/tree/master/examples
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Would you ever?

    I would not use another OS by my free will. On the other hand, linux must have serious drawbacks to fill so little space in the OSes market share statistics. Its …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Cannot post question with code sample

    You can zip it and attach the zip file to a post. We'll be able to see if there is anything special about it.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help modeling some parent-child classes

    Great, I'm looking forward to seeing your classes. If all this doesn't suffice, there are other tools such as multiple inheritance and mix-in classes, but remember the zen of python: …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help modeling some parent-child classes

    The constructor must not raise NotImplementedError because the constructor must be called by the subclasses. You could give the attributes a default value such as `None` or `NotImplemented` for example. …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help modeling some parent-child classes

    There is no general rule. You can make another base class which would inherit the first base class, or you can leave them as twin classes. I think twin methods …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help modeling some parent-child classes

    What you can do here is a common ancestor with the 3 attributes class BaseConnection(object): def __init__(self): self.connection = None self.cursor = None self.error = None class MySQLConnection(BaseConnection): def __init__(self, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help modeling some parent-child classes

    If the child class has only attributes A and B, then the superclass should not have attributes A B C D. If it is not the case, it means that your model is …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help modeling some parent-child classes

    I think you can follow the simple rule that code which is nearly the same in 2 classes is a good candidate to be written in a common superclass for …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Vending machine

    The first thing is to never have variable names containing a variable index, such as `product_1, product_2,` etc. Use lists or tuples instead pairs = [ ("Flake", 0.55), ("Wispa", 0.50),("Crunchie", …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in What are specifications/requirements of native, precise Linux program?

    I would not recommend to choose Objective-C. It is a very nice language but AFAIK, most of the existing programs and tools use cocoa which is an Apple library. You …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in What are specifications/requirements of native, precise Linux program?

    The history of the unix system is tightly bound to the history of the C programming language, so I would say that a genuine linux application is written in C, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Drawing Turtle

    You can define a color with for example fillcolor('green') Then you can fill a domain with fill(True) #... Here draw a domain as you did before fill(False)
  • Member Avatar for Gribouillis
    Gribouillis

    Created Unicode characters not displaying properly

    Some unicode characters such as dice symbols or chess symbols (see https://en.wikipedia.org/wiki/Miscellaneous_Symbols) dont display properly anymore in the forums. What's going on ? there are examples here [Click Here](https://www.daniweb.com/software-development/python/code/492854/another-visit-to-string-formatting-python#post2155656) and …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Another Visit To String Formatting (Python)

    This example shows how to use the `__format__` method to fine tune the format of an instance (here a dice) in formatting statements. #-*-coding: utf8-*- python 2 or 3 from …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Break Factor Function

    If you are working in number theory, you might be interested in the python interface to the [PARI GP calculator](http://pari.math.u-bordeaux.fr/doc.html) system: [pari-python](http://code.google.com/p/pari-python/). It contains many functions for number theory (it …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Get Root Floor and Root Ceiling of a Number

    Why not use `math.floor()` and `math.ceil()` ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Get the Middle Factors from a Factor List

    Here is how you can code the same thing by using a [PEP8](https://www.python.org/dev/peps/pep-0008/) compliant coding style # -*-coding: utf8-*- # python 2 or 3 def get_middle_factors(factor_list): """Return a list of …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in DuckDuck Go, New Search Engine

    Here is a [french site](http://degooglisons-internet.org/) which goal is to ungooglize internet. It is a non-profit organization supporting free software.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in hello all members of this forum

    Welcome to daniweb!
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Tkinter check radio button state before proceed

    There is a better way: you can disable 2C when 1A is on. In the following code, I added a callback method, which is called when one of the options is …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Help grouping by time interval

    You need to add the group number, for example import datetime as dt import itertools as itt import operator as op def todatetime(string): return dt.datetime.strptime(string, '%H:%M:%S') def enhanced_sequence(seq): """yields pairs …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how to print every word starts with "A" in a urlpage

    What is the type of `soup.text` ? try print(type(soup.text)) if it is a string (type str), you could try import re for word in re.findall(r'\b\w+\b', soup.text): ...
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how to print every word starts with "A" in a urlpage

    Isn'it if `word.startswith('A')` ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in a tkinter program that needs a background image

    Yes because Vegaseat uses import tkinter as tk while you are using from tkinter import * Usually, people prefer to avoid `import *` because there is no way to see …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Self Modding Code

    I think the program should create a backup of itself before attempting to rewrite itself and restore the backup if anything goes wrong. It would be a minimal security feature …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Using Unicode to Produce Better Looking Cards and Decks

    I already have a python code snippet for these https://www.daniweb.com/software-development/python/code/423640/unicode-chessboard-in-a-terminal
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Using Unicode to Produce Better Looking Cards and Decks

    As there is no issue, you could post this as a code snippet (select the appropriate article type when the article is created). Why not add a call to` main()` …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Printing to Columns with print()

    Thank you. The snippet has just been updated to version 0.2.1.
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Print a list in multicolumn format

    This snippet prints a python list of strings in multicolumn format (similarly to linux `ls` command). It uses module prettytable, available in [pypi](https://pypi.python.org/pypi/PrettyTable).
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Print a list in multicolumn format

    This snippet prints a python list of strings in multicolumn format (similarly to linux `ls` command). It uses module prettytable, available in [pypi](https://pypi.python.org/pypi/PrettyTable).
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Print a list in multicolumn format

    This snippet prints a python list of strings in multicolumn format (similarly to linux `ls` command). It uses module prettytable, available in [pypi](https://pypi.python.org/pypi/PrettyTable).
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Print a list in multicolumn format

    This snippet prints a python list of strings in multicolumn format (similarly to linux `ls` command). It uses module prettytable, available in [pypi](https://pypi.python.org/pypi/PrettyTable).
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Printing to Columns with print()

    You might be interested in my `print_multicolumn()` code snippet https://www.daniweb.com/software-development/python/code/468373/print-a-list-in-multicolumn-format and also by module `prettytable` in general. Here is what it does >>> L = ['a', 'b', 'c', 'a', 'b', …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in strip() method with chars doesn't seem to work

    Standard builtin functions have been tested gazillion times by programs all around the world. It is almost impossible that you discover an unknown bug in them. `strip()` removes characters only …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to snippsat in why the output doesn't contain all that URL links?

    >so why it didn't print the url of each website into output?! Because this is a dynamic site using JavaScript,jQuery.... The problem is that JavaScript get evaluatet by DOM in …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in cant send this list from terminal to txt file/drop each index into new line

    Python complains because the file's `write()` method needs a string argument. Here the correct way to handle things is to find the values of the `href=` attributes, which contain the …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Algorithmic challenge

    ERRATUM: I corrected the first version of the code above, which contained a subtle bug yielding incorrect results. One must consider **overlapping** matches of the regular expression. This is taken …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to TrustyTony in Algorithmic challenge

    I think it is easy to choose subset of unicode letters (one special language specific letter from each letter set from each language specific letter set and special symbol set, …
  • Member Avatar for Gribouillis
    Gribouillis

    Marked Solved Status for Algorithmic challenge

    Given a unicode string or file, what is the best way to find a short unicode string that is **not** a substring of the first one ? I want a …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Algorithmic challenge

    Ok, solved! Thank you very much to you and PyTony for your help and support !
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Algorithmic challenge

    Here is the statistical approach at work with a alphabet of size 10. #!/usr/bin/env python3 # -*-coding: utf8-*- '''find a short string not in a string ''' from __future__ import …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Algorithmic challenge

    I think you misunderstand the statistical approach. There is no assumption on the distribution of letters in the data string. I'm using an inquality that is true for all sequences, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Algorithmic challenge

    I have a robust solution with more than a single letter. It is described in the attached pdf. I'm working on implementing it.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in looking for a reference for python url lib tutorial?

    You don't need to install it: it is part of the python standard library. Look in the standard's library documentation for reference.
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to JamesCherrill in Algorithmic challenge

    I don't know Python, but can't you just create an array of 2^16 booleans, corresponding to the 2^16 basic UniCode characters, do one pass of the string and set the …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Algorithmic challenge

    Yes it works, here is the code, using module bitstring from pypi #!/usr/bin/env python # -*-coding: utf8-*- '''find a unicode character not in a string python 2 and 3 ''' …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Algorithmic challenge

    Yes in this case there is a string with length 1, but how would you find it ? Short means for example that if there is a string with length …

The End.