[Tutor] when is a generator "smart?"

Jim Mooney cybervigilante at gmail.com
Tue Jun 4 02:00:05 CEST 2013


On 3 June 2013 14:41, Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:

> Maybe or maybe not. When you run 'python setup.py install' (this
> happens implicitly when using pip), Python will try to run the
> setup.py script. At this point the script can do anything that its
> author likes. It could check for versions, it could just install and
> be broken, it could delete random files or damage your system in a
> malicious way. The author may have written the package at a time when
> Python 3 didn't exist so they didn't see the need to check for Python
> version and wrote code that wouldn't work in Python 3.

Using Python 2.7 on Windows 7

That's scary. But are we talking modules from wherever or PyPI
modules? I figured the modules on the official PyPI index would be
checked to some degree, and be safe. I guess I'll always look into the
setup.py to see if it contains any obvious gotchas. Oops - pip
downloads and installs automatically - I never see setup.py. Might be
best to download, inspect, then run the install.

Good trick for running different Py versions from the command line
without accidentally confusing them. You never know what you're going
to learn here ;')  I was qualifying the path to each version but that
gets to be a pain. As for Wing, I just meant running as Guest is a
windows trick for running two different versions of the same program
for two different Pys without reconfiguring the IDE. Wing 101 has only
one config since it's the free version and doesn't do projects. So you
have to reconfig every time to run different Pys from the IDE unless
you do that trick. No doubt there's something similar in Linux.

Jim
>
> There is progress on improving this situation by formalising the
> metadata that is supplied with Python packages so that it can be used
> more effectively by tools such as pip. The current (unaccepted) PEP
> for this is here (see the environment markers section):
> http://www.python.org/dev/peps/pep-0426/
>
>> Incidentally, for those nutty enough to run two Pys on Win, with Wing
>> 101, I realized you can get Wing 101 to run either, without having to
>> reconfigure it all the time, by setting up a Guest account in Windows,
>> and configuring the second Wing for Py 3.3, run as Guest, with the
>> primary as 2.7. This is helpful since some online sources I read are
>> for one Py and some are for another.
>
> If you have py.exe (which you should if you've installed Python 3.3 on
> Windows) then you can run any installed Python version as 'py -2.7
> myscript.py' or 'py -3.3 myscript.py' to choose the version of Python
> that will run myscript.py. I find it easier and clearer to do that
> explicitly on the command line when I want to test different versions.
>
>
> Oscar
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor



-- 
Jim
Ornhgvshy vf orggre guna htyl


More information about the Tutor mailing list