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


Groups > comp.lang.python > #19639

Re: Disable use of pyc file with no matching py file

Date 2012-01-31 15:19 +0100
From Jean-Michel Pichavant <jeanmichel@sequans.com>
Subject Re: Disable use of pyc file with no matching py file
References <12592360.1754.1327959045517.JavaMail.geo-discussion-forums@vby1> <jg76ev$7m4$1@dough.gmane.org> <mailman.5233.1328005578.27778.python-list@python.org> <4f27d81e$0$29989$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.5245.1328019555.27778.python-list@python.org> (permalink)

Show all headers | View raw


Steven D'Aprano wrote:
> On Tue, 31 Jan 2012 11:26:10 +0100, Jean-Michel Pichavant wrote:
>
>   
>> Terry Reedy wrote:
>>     
>>> On 1/30/2012 4:30 PM, Roy Smith wrote:
>>>       
>>>> Every so often (typically when refactoring), I'll remove a .py file
>>>> and forget to remove the corresponding .pyc file.  If I then import
>>>> the module, python finds the orphaned .pyc and happily imports it.
>>>> Usually leading to confusing and hard to debug failures.
>>>>
>>>> Is there some way to globally tell python, "Never import a .pyc unless
>>>> the corresponding .py file exits"?
>>>>         
>>> Upgrade to 3.2.
>>>
>>>       
>> No.
>>     
>
>
> Is that intended as "No, I won't upgrade" or "No, Python 3.2 doesn't do 
> the job"?
>   
To answer Ben's mail as well, the "No" would be more of the "don't do 
it". My answer was as argued as Terry's one anyway (it was quite intended).
Steven, you often use analogies/similarities, here's one:

A: "My wheel is flat"
B: "Buy a new car"

Buying a new car would solve A's problem : yes
Should A buy a new car : probably no

Python 3.2 is fine, but someone could run into several issues while 
migrating. This is quite a pretty huge decision to make (I dedicate this 
sentence to Rick, I hope he's trolling fine).

JM



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


Thread

Disable use of pyc file with no matching py file Roy Smith <roy@panix.com> - 2012-01-30 13:30 -0800
  Re: Disable use of pyc file with no matching py file Miki Tebeka <miki.tebeka@gmail.com> - 2012-01-30 14:13 -0800
  Re: Disable use of pyc file with no matching py file Terry Reedy <tjreedy@udel.edu> - 2012-01-30 17:43 -0500
    Re: Disable use of pyc file with no matching py file John Roth <johnroth1@gmail.com> - 2012-01-31 12:20 -0800
      Re: Disable use of pyc file with no matching py file Terry Reedy <tjreedy@udel.edu> - 2012-01-31 18:43 -0500
        Re: Disable use of pyc file with no matching py file John Roth <johnroth1@gmail.com> - 2012-02-01 05:11 -0800
          Re: Disable use of pyc file with no matching py file Terry Reedy <tjreedy@udel.edu> - 2012-02-01 14:57 -0500
  Re: Disable use of pyc file with no matching py file Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-01-31 11:26 +0100
    Re: Disable use of pyc file with no matching py file Ben Finney <ben+python@benfinney.id.au> - 2012-01-31 22:56 +1100
    Re: Disable use of pyc file with no matching py file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-31 12:01 +0000
      Re: Disable use of pyc file with no matching py file Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-01-31 15:19 +0100
      Re: Disable use of pyc file with no matching py file Terry Reedy <tjreedy@udel.edu> - 2012-01-31 18:55 -0500
        Re: Disable use of pyc file with no matching py file Roy Smith <roy@panix.com> - 2012-01-31 23:14 -0500
          Re: Disable use of pyc file with no matching py file Terry Reedy <tjreedy@udel.edu> - 2012-02-01 05:28 -0500
      Re: Disable use of pyc file with no matching py file Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-02-01 11:12 +0100
      Re: Disable use of pyc file with no matching py file Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-01 06:14 -0500
      Re: Disable use of pyc file with no matching py file Terry Reedy <tjreedy@udel.edu> - 2012-02-01 14:53 -0500
      Re: Disable use of pyc file with no matching py file Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-02 01:42 -0500
      Re: Disable use of pyc file with no matching py file Terry Reedy <tjreedy@udel.edu> - 2012-02-02 04:21 -0500
        Re: Disable use of pyc file with no matching py file Brian <not_here@no-where.net> - 2012-02-12 10:53 -0800
  Re: Disable use of pyc file with no matching py file Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-01-31 11:18 +0000

csiph-web