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


Groups > fr.comp.lang.python > #3210

Re: from matplotlib import pyplot as * ?

X-Received by 2002:a0c:8705:: with SMTP id 5mr14356966qvh.32.1563109827232; Sun, 14 Jul 2019 06:10:27 -0700 (PDT)
X-Received by 2002:a25:9248:: with SMTP id e8mr12469732ybo.505.1563109826957; Sun, 14 Jul 2019 06:10:26 -0700 (PDT)
Path csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!b26no8187548qtq.0!news-out.google.com!a5ni318qtd.0!nntp.google.com!b26no8187541qtq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups fr.comp.lang.python
Date Sun, 14 Jul 2019 06:10:26 -0700 (PDT)
In-Reply-To <5d2911c7$0$31401$426a34cc@news.free.fr>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=2a01:cb0c:8591:2200:df7:f9c6:81c6:a6a4; posting-account=hQExVgoAAAAjTa1rqAeEWQZvSnm86oYY
NNTP-Posting-Host 2a01:cb0c:8591:2200:df7:f9c6:81c6:a6a4
References <5d2911c7$0$31401$426a34cc@news.free.fr>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <6d5aca45-abc5-40ac-97a5-5cd5dc84e173@googlegroups.com> (permalink)
Subject Re: from matplotlib import pyplot as * ?
From Becaree <pierrelouis.chevallier60@gmail.com>
Injection-Date Sun, 14 Jul 2019 13:10:27 +0000
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding quoted-printable
Lines 9
Xref csiph.com fr.comp.lang.python:3210

Show key headers only | View raw


Si c'est pour les élèves, les apprendre à coder en rajoutant plein de globaux, c'est vraiment pas top. Je m'explique: imaginons que j'ai une fonction clf() dans math de python et une fonction clf() dans pyplot. Les deux vont rentrer en conflit. De plus, a moins d'une très bonne connaissance des librairies, il peut arriver des conflits si je veux nommer une variable clf et l'utiliser. Il y a des cas spécifiques d'utilisation du import star même si c'est globalement (ahah) une mauvaise pratique. Certaine librairies utilise des __all__ dans les __init__.py permettant de limiter les globaux à l'import. Nota Bene, ce n'est pas le cas de fastai ;-)

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


Thread

from matplotlib import pyplot as * ? Fabrice <professeur.leclercq@gmail.com> - 2019-07-13 01:03 +0200
  Re: from matplotlib import pyplot as * ? Francois Lafont <francois.lafont@nospam.invalid> - 2019-07-13 01:51 +0200
    Re: from matplotlib import pyplot as * ? Fabrice <professeur.leclercq@gmail.com> - 2019-07-13 14:42 +0200
  Re: from matplotlib import pyplot as * ? Becaree <pierrelouis.chevallier60@gmail.com> - 2019-07-14 06:10 -0700
    Re: from matplotlib import pyplot as * ? Fabrice <professeur.leclercq@gmail.com> - 2019-07-14 23:10 +0200
      Re: from matplotlib import pyplot as * ? Becaree <pierrelouis.chevallier60@gmail.com> - 2019-07-15 11:40 -0700
  Re: from matplotlib import pyplot as * ? Becaree <pierrelouis.chevallier60@gmail.com> - 2019-07-14 06:23 -0700
  Re: from matplotlib import pyplot as * ? Becaree <pierrelouis.chevallier60@gmail.com> - 2019-07-15 11:44 -0700

csiph-web