Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 31

Thread: Tell me...

  1. #11
    Guest

    Re: Tell me...




    I'm pretty sure that a similar thing can be done in Python. Never tried, though.


    And the idea that there is only one way to do it disturbs me.


    Because then the language would be really boring and restrictive. Different methods of doing things can provide different functionality.
    Code:
    [vince@vincent: ~/prog/python]% python                   
    Python 2.1.1 (#1, Nov 11 2001, 18:19:24) 
    [GCC 2.95.4 20011006 (Debian prerelease)] on linux2
    Type "copyright", "credits" or "license" for more information.
    >>> a = 'Jello'
    >>> a[0] = 'H'
    Traceback (most recent call last):
     File "<stdin>", line 1, in ?
    TypeError: object doesn't support item assignment
    >>>
    I did not say that there should be only one way to do it. But, right now Python limits how I can do it. I can do like in Python with Ruby though:
    Code:
    [vince@vincent: ~/prog/python]% irb
    irb(main):001:0> a = "Jello"
    "Jello"
    irb(main):002:0> a = "H" + a[1..-1]
    "Hello"
    irb(main):003:0>
    And can you tell me how to get a random number with Python please?

  2. #12
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760

    Re: Tell me...

    Perl can be great, but when a complete idiot is writing code (like most VB programmers these days), the code is barely intelligible by even great coders. We do alot of perl at work here, and I'll tell ya -- the factory code, my bosses code, and the code my godlike programmer friend was gracous to fix are three separate lifeforms. The only one that is totally incomprehensible is my bosses, with a close second being the factory crap. By the way all -- COMMENTING IS NOT AN OPTION -- ITS FRIGGIN NECESSARY!!!!!

    I Have a look at some perl code. Not very readable (Well thats from what I saw anyway)

  3. #13
    Guest

    Re: Tell me...


    COMMENTING IS NOT AN OPTION -- ITS FRIGGIN NECESSARY!!!!! *
    I so agree with you man! Maybe we could propose a PEP (Python Enhancement Proposition), a Ruby proposal, etc. So that the language won't run if there are not at least 3 comments (like Python won't execute if not indented correctly)

  4. #14
    Guest

    Re: Tell me...


    at least 3 comments
    not enough
    if ur code has to be used/changed/read by other people then the code should be commented throughout the whole damn thing

  5. #15
    Guest

    Re: Tell me...




    not enough
    if ur code has to be used/changed/read by other people then the code should be commented throughout the whole damn thing
    How about the ratio of comments:line of code should be at least 1:3 and more preferably 2:3 ?

  6. #16
    Guest

    Re: Tell me...


    How about the ratio of comments:line of code should be at least 1:3 and more preferably 2:3 ?
    u can't really put a ratio on it because certain parts of code are so clear that everyone understands it, and other parts of code need a lot of comments to make it clear for everyone

  7. #17
    Guest

    Re: Tell me...




    u can't really put a ratio on it because certain parts of code are so clear that everyone understands it, and other parts of code need a lot of comments to make it clear for everyone
    How about general flame to anyone who doesn't comment?

  8. #18
    Guest

    Re: Tell me...


    How about general flame to anyone who doesn't comment?
    oh definitely

  9. #19

    Re: Tell me...

    And can you tell me how to get a random number with Python please?
    Code:
    <-> python
    Python 2.1.1 (#1, Nov 11 2001, 18:19:24) 
    [GCC 2.95.4 20011006 (Debian prerelease)] on linux2
    Type "copyright", "credits" or "license" for more information.
    >>> import random
    >>> a=random.randrange(0,10)
    >>> a
    7
    >>> a=random.randrange(0,10)
    >>> a
    8
    >>> a=random.randrange(0,10)
    >>> a
    8
    >>> a=random.randrange(0,10)
    >>> a
    4
    You appear to be right about the string manipulation. When I saw what you did, I could have sworn I saw it in the Python tutorial -- and I did: just after it was saying what wouldn't work

  10. #20
    Guest

    Re: Tell me...

    I tried Python extensively today (6-7 hours). *In my opinion, Ruby is still easier. *Sure Python is nice, but I feel better in Ruby.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •