Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is `scipy.i`?

Tags:

python

scipy

Out of random keyboard bashing, I ended up noticing that there is a variable in SciPy called i, which is assigned to the string '6'. (May be different on other machines?)

I tried using built-in help functions, but there is nothing assigned to scipy.i as it only refers to a string.

I also searched the docs and Google, but nothing came up.

Could it be related to version control, or something similar? By the way, I'm using Enthought Python on Windows 7 (both 64 bits).

This is far from being a critical question, I'm just curious about it!

like image 883
PhilMacKay Avatar asked Apr 08 '13 19:04

PhilMacKay


People also ask

What is SciPy in Python used for?

SciPy is a scientific computation library that uses NumPy underneath. SciPy stands for Scientific Python. It provides more utility functions for optimization, stats and signal processing. Like NumPy, SciPy is open source so we can use it freely.

What is SciPy in machine learning?

SciPy is a very popular library among Machine Learning enthusiasts as it contains different modules for optimization, linear algebra, integration and statistics. There is a difference between the SciPy library and the SciPy stack. The SciPy is one of the core packages that make up the SciPy stack.

Is SciPy same as NumPy?

NumPy and SciPy both are very important libraries in Python. They have a wide range of functions and contrasting operations. NumPy is short for Numerical Python while SciPy is an abbreviation of Scientific Python. Both are modules of Python and are used to perform various operations with the data.

What can be done with SciPy?

SciPy in Python is an open-source library used for solving mathematical, scientific, engineering, and technical problems. It allows users to manipulate the data and visualize the data using a wide range of high-level Python commands. SciPy is built on the Python NumPy extention. SciPy is also pronounced as “Sigh Pi.”


1 Answers

Oh, this is cute. From the scipy __init__.py:

# Emit a warning if numpy is too old
majver, minver = [float(i) for i in _num.version.version.split('.')[:2]]

In Python 2, list comprehensions "leak" their loop variables into the enclosing scope. And thus:

>>> import numpy as _num
>>> _num.version.version
'1.6.2'
>>> _num.version.version.split('.')[:2]
['1', '6']
>>> majver, minver = [float(i) for i in _num.version.version.split('.')[:2]]
>>> i
'6'
like image 77
DSM Avatar answered Sep 24 '22 17:09

DSM