Slashdot Mirror


User: xitology

xitology's activity in the archive.

Stories
0
Comments
4
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 4

  1. Re:as is often the case... on Real Time (as in Live) Programming Competition · · Score: 1

    And wether it was supposed to be allowed or not, I was doing math (addition and comparison) of the numbers it was storing as strings and it wasn't throwing exceptions. Perhaps HP-UX had a wierd version of python 4 years ago?

    I don't know about HP-UX, but the distinction between numbers and strings always existed in Python starting from the initial release. Could it be that the HP-UX version was patched somehow? But it sounds weird.

    In principle, if you use only additions and comparisons and replace all integers with strings, the program will not raise an exception since both operations are valid for strings as well. It could explain the fact that the program eats too much memory -- doing a lot of string concatenations may cause it. But, of course, the result will be completely different. Again, if you ever had code like foo+1, it would raise an exception...

  2. Re:as is often the case... on Real Time (as in Live) Programming Competition · · Score: 1

    Your reply convinced me that you have used some other language rather than Python. :p

    While you don't declare variables in Python (you bind names to objects instead), Python doesn't have the same amorphous types as Perl and PHP. Integers and strings are completely different things in Python and can be only explicitly converted to each other using int and str functions. Check this interactive Python session:

    >>> 2+2 # numbers
    4
    >>> '2'+'2' # strings
    '22'
    >>> 2+'2' # a number + a string => exception
    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    TypeError: unsupported operand type(s) for +: 'int' and 'str'
    To be frank, your case looks like you, having vague understanding of Python semantics, made a bug and blamed the language instead of learning it.
  3. Re:as is often the case... on Real Time (as in Live) Programming Competition · · Score: 1

    I don't have my program slow down by a factor of 4 because it decides to store integers as strings (I'm looking at you Python).

    You might be looking to Perl or PHP, but certainly not to Python. Python clearly distinguishes numbers from strings.

  4. Re:Try "Notes from Underground" on A Programmer's Bookshelf · · Score: 3, Informative

    As an aside my [older] translation begins with "I am a sick man... an angry man... an unattractive man. For whatever reason the newer translation substitutes wicked for angry. Perhaps someone who understands more Russian would know why.

    The Russian word is zloy, which can be translated both as wicked and angry among others. Dostoevsky uses zloy a lot, so the choice is quite significant. I don't know English enough to advise the best choice though.