Search Results

Search found 2 results on 1 pages for 'dunebug'.

Page 1/1 | 1 

  • Python Instance Variable as Default Parameter

    - by DuneBug
    Hello, I have am writing a Python function that takes a timeout value as a parameter. Normally, the user will always use the same timeout value, but on occasion he may want to wait slightly longer. The timeout value is stored as a class instance variable. I want to use the class' timeout instance variable as the default parameter. Currently, I am implementing this as follows: def _writeAndWait (self, string, timeout = -1): if (timeout == -1): timeout = self._timeout I was just wondering, is the proper way to use an instance variable as a default parameter? Or is there a better way that would avoid the "if" check? Thanks, Ryan

    Read the article

  • C 64-bit Pointer Alignment

    - by DuneBug
    Are pointers on a 64-bit system still 4 byte aligned (similar to a double on a 32 bit system)? Or are they note 8 byte aligned? For example, on a 64-bit system how big is the following data structure: struct a { void* ptr; char myChar; } Would the pointer by 8 byte aligned, causing 7 bytes of padding for the character (total = 8 + 8 = 16)? Or would the pointer be 4 byte aligned (4 bytes + 4 bytes) causing 3 bytes of padding (total = 4 + 4 + 4 = 12)? Thanks, Ryan

    Read the article

1