Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38210

Re: Best Practice Question

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'win32': 0.03; 'syntax': 0.03; 'string.': 0.04; '(python': 0.05; 'inserts': 0.07; 'puts': 0.07; 'subject:Question': 0.07; 'trailing': 0.07; 'python': 0.09; 'backslash': 0.09; 'highlighting': 0.09; 'worse': 0.09; "'\\\\'": 0.16; '-tkc': 0.16; 'interprets': 0.16; 'mistake.': 0.16; 'syntaxerror:': 0.16; 'string': 0.17; 'wrote:': 0.17; '>>>': 0.18; 'feb': 0.19; 'all,': 0.21; 'import': 0.21; 'latter': 0.22; 'posted': 0.22; '(i.e.,': 0.23; 'task': 0.23; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; '+0100': 0.27; 'correct': 0.28; 'all.': 0.28; '>>>>': 0.29; 'url:mailman': 0.29; "i'm": 0.29; 'knows': 0.30; 'stuff': 0.30; 'code': 0.31; 'url:python': 0.32; 'url:listinfo': 0.32; 'docs': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'that,': 0.34; 'url:org': 0.36; 'method': 0.36; 'correctly': 0.37; 'does': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'nothing': 0.38; 'sure': 0.38; 'shows': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'notice': 0.39; 'received:192.168': 0.40; 'url:mail': 0.40; 'your': 0.60; 'remove': 0.61; 'ever': 0.63; 'laptop': 0.66; 'received:74.208': 0.71; 'presented': 0.72; '2013': 0.84; 'beside': 0.84; 'ok?': 0.84; 'received:74.208.4.194': 0.84; 'joel': 0.91; 'subject:Best': 0.91
Date Tue, 05 Feb 2013 13:10:59 -0500
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version 1.0
To python-list@python.org
Subject Re: Best Practice Question
References <5110F277.9020205@davea.name> <1931346778.15606854.1360074752203.JavaMail.root@sequans.com> <mailman.1370.1360081284.2939.python-list@python.org> <b04a6aad-1730-403d-88d4-716be2033296@googlegroups.com> <CAPM-O+z0aDADCO1fTtBDKJ+xnmEt=dfsjpnoPpoWLfY2+aWOaQ@mail.gmail.com>
In-Reply-To <CAPM-O+z0aDADCO1fTtBDKJ+xnmEt=dfsjpnoPpoWLfY2+aWOaQ@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:VzsGQeqwCYmSwtyUGzYXM5IAEvAnbG+LXM9sQijg+2y q+dXn1eovvi34xaEGYIlJ9IvLVK//dztSfxI1ESE2wVQM13H8E sur0P+IEIk4CZT2mKb0K6q7Ahk0k/an6zuyK2ii2UflARH7+nY Kl4Qet3GPymfM4zXVc3ZgTzR8rquBi0V9qnhC33NLg7d1RDjlV wMfNCu0zCGlxq5ek6/F3WvTRJQnIBpqBvPz0uR9nEQFRA0L2PZ RniqzK4k3FILKVtvTNVGnNtyx2sLdU5Ih470lWDEU/gcZBsqQE 3uaeP0nQpkUGsj36wy2FU8M9knu/XWZ3Oo5JX6H7yVR6G82WQ= =
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1375.1360087880.2939.python-list@python.org> (permalink)
Lines 58
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360087880 news.xs4all.nl 6944 [2001:888:2000:d::a6]:53647
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38210

Show key headers only | View raw


On 02/05/2013 11:53 AM, Joel Goldstick wrote:
> On Tue, Feb 5, 2013 at 11:40 AM, Anthony Correia <akcorreia@gmail.com>wrote:
>
>> On Tuesday, February 5, 2013 10:17:54 AM UTC-5, pytho...@tim.thechases.comwrote:
>>> On Tue, 5 Feb 2013 15:32:32 +0100 (CET), Jean-Michel Pichavant wrote:
>>>
>>>> By the way, did someone ever notice that r'\' fails ? I'm sure
>>>
>>>> there's a reason for that... (python 2.5) Anyone knows ?
>>>
>>>>
>>>
>>>> r'\'
>>>
>>>> SyntaxError: EOL while scanning single-quoted string
>>>
>>>
>>>
>>> I hit this all the time with Vim's path-completion (":help
>>>
>>> i_CTRL-X_CTRL-F") on Win32 which puts a trailing "\" on
>>>
>>> directory-names.  I just need to remember to remove it, a task made
>>>
>>> easier because the syntax highlighting correctly shows how Python
>>>
>>> interprets it (i.e., the string is still continued).
>>>
>>>
>>>
>>> -tkc
>>
>> Sorry about that I hit the touchpad on my laptop by mistake.  Beside the
>> using  single '\' vs a double '\\' does that look ok?
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
> according to the docs for os.path.join, you don't need the backslash stuff
> at all.  Python knows the correct separator for your os and inserts it
> accordingling:
> I'm on linux:
>
>>>> import os
>>>> p = os.path.join('bob', 'bill')
>>>> p
> 'bob/bill'
>>>>
>

Worse than that, the code as posted by the OP used string concatenation 
before calling  os.path.join(), and the latter method does nothing at 
all, when presented with a single string.



-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Best Practice Question python.list@tim.thechases.com - 2013-02-05 09:17 -0600
  Re: Best Practice Question Anthony Correia <akcorreia@gmail.com> - 2013-02-05 08:40 -0800
    Re: Best Practice Question Joel Goldstick <joel.goldstick@gmail.com> - 2013-02-05 11:53 -0500
    Re: Best Practice Question Dave Angel <d@davea.name> - 2013-02-05 13:10 -0500
  Re: Best Practice Question Anthony Correia <akcorreia@gmail.com> - 2013-02-05 08:40 -0800

csiph-web