View Poll Results: What do youi use most to string, ' or "?

Voters
25. You may not vote on this poll
  • I use " most of the time(please post why)

    9 36.00%
  • I use ' most of the time(please post why)

    10 40.00%
  • I use both/ I use " to .../ I use ' to ...(please post where you use it, and why)

    6 24.00%
Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Python: ' or "?

  1. #1
    Join Date
    Mar 2007
    Location
    Lyngen, Norway
    Beans
    163
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Python: ' or "?

    What do you use most to string in Python, ' or "?

    examples:
    Code:
    print("hello") or print('hello')
    x="hello" or x='hello'
    f=open("/home/hello.txt","w") or f=open('/home/hello.txt','w')
    I just want to know what people use...
    Last edited by holihue; October 26th, 2007 at 06:24 PM.
    IBM Thinkpad R60
    Ubuntu user: # 14440
    Please visit:
    http://www.fablab.no

  2. #2
    Join Date
    Oct 2006
    Location
    Austin, Texas
    Beans
    2,715

    Re: Python: ' or "?

    Double-quote. Even though it would be quicker (for me) to type single-quotes, I've been programming in C so long that double-quotes are just habit.

  3. #3
    Join Date
    Oct 2006
    Location
    Ireland
    Beans
    416
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: Python: ' or "?

    Single quotes because it's quicker to type, though takes a while to get used to after C++ and I still sometimes use doubles without thinking

  4. #4
    Join Date
    Feb 2007
    Beans
    314
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: Python: ' or "?

    I use them both at random intervals.
    <plexr> do you know std c++ ?
    <plexr> or is a weak understanding of VB your only strength
    <ahorse_> oohhhhh he just said the equivalent of *yo momma*
    www.acgla.net <--- My webpage : )

  5. #5
    Join Date
    Sep 2006
    Location
    Germany
    Beans
    403
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: Python: ' or "?

    Single quote to remind my fingers I'm in Python. By coding convention, python filenames are all lower-case, something that is a habit I had to break from the java ways.
    "You don't do art because you want to, no, you do art because you have to." -- M. Buonarroti

  6. #6
    Join Date
    Jun 2006
    Location
    CT, USA
    Beans
    5,267
    Distro
    Ubuntu 6.10 Edgy

    Re: Python: ' or "?

    mostly ' - because you can type it without shift. I am lazy

  7. #7
    Join Date
    May 2007
    Location
    Paris, France
    Beans
    927
    Distro
    Kubuntu 7.04 Feisty Fawn

    Re: Python: ' or "?

    Quote Originally Posted by pmasiar View Post
    mostly ' - because you can type it without shift.
    Funny, I was wondering why previous posters mentionned ' to be faster to type than " ...

    I just realized you guys are NOT using an AZERTY keyboard...
    Not even tinfoil can save us now...

  8. #8
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Python: ' or "?

    I generally use double quotes for strings, in any language. I use single quotes for characters (guess what language I also use), and for a few other things.

  9. #9
    Join Date
    Sep 2005
    Location
    Cedar Rapids, IA, USA
    Beans
    545
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: Python: ' or "?

    I'm used to quotes in FORTRAN where if you wanted to output a " you'd have to put ' ' around it. But I think for Python, I intermix them.
    #399784 | Ubuntu User #287
    *** If you're going to program, install the damn build-essential package ***
    There is no such thing as Ubuntu specific programming
    Save the electrons - if you quote, trim!

  10. #10
    Join Date
    Oct 2007
    Beans
    6

    Re: Python: ' or "?

    I get used to single quotes really easily. Then I wonder why my C# code won't compile.

Page 1 of 2 12 LastLast

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
  •