python 2.7.12 on Linux behaving differently than on Windows

Lew Pitcher lew.pitcher at digitalfreehold.ca
Tue Dec 6 13:00:36 EST 2016


On Tuesday December 6 2016 12:36, in comp.lang.python, "BartC" <bc at freeuk.com>
wrote:

> On 06/12/2016 17:00, MRAB wrote:
>> On 2016-12-06 13:52, BartC wrote:
> 
>>> Some special syntax is known about: | < and > for example. % less so
>>> (I've never, ever used it in live input AFAIK).
>>>
>> [snip]
>>
>> You've never used ImageMagick?
>>
>> If you want to shrink an image to half its size:
>>
>>     convert dragon.gif -resize 50% half_dragon.gif
> 
> No. But that '50%' is seen by apps (eg. with Python's 'print sys.argv')
> on both Windows and Linux.
> 
> However, I can imagine that a calculator app might have trouble with
> some expressions:
> 
>     calculate 3*5

I can't see this being an issue with the "calculator app", unless the
calculator app itself is written to perform file globbing.

It /might/ be an issue with the shell, if you permit it to glob
the "calculator app" arguments before invoking the "calculator app" binary.
But, then again, Unix shell filename globbing is something that the user can
disable temporarily or permanently if necessary.

For example:
  calculate '3*5'
or
  sh -o noglob -c "calculate 3*5"
or even
  sh -o noglob
  calculate 3*5

> This expression might be seen as 345 if there happens to be file called
> '345' lying around.

Only if shell globbing is enabled, and you don't specifically bypass it.


-- 
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request



More information about the Python-list mailing list