On 06/19/2012 12:41 PM, Hemanth H.M wrote:
>>> float.hex(x)
'0x1.5p+3'
Some days I don't ask the brightest questions. Suppose x was a numpy
floating scalar (types numpy.float16, numpy.float32, numpy.float64, or
numpy.float128). Is there an easy way to write x in
binary or hex?
Consider the following line in C:
printf('%a\n', x);
where x is a float or double. This outputs a hexadecimal representation
of x. Can I do this in Python?
--
http://mail.python.org/mailman/listinfo/python-list
I am trying to create a collection of hashable objects, where each
object contains references to
other objects in the collection. The references may be circular.
To simplify, one can define
x= list()
x.append(x)
which satisfies x == [x].
Can I create a similar object for tuples which sa
Terry Reedy said:
> Question 1: if you use the .pth method, do you get the same result?
(I expect you will, but good to
> check.)
Recompiled Pyhton 3.3 without the SITEPATH change. Same result:
> python3.3
Python 3.3.0a3 (default, May 8 2012, 19:57:45)
[GCC 4.6.3] on linux
Type "help", "cop
I use up-to-date Debian testing (wheezy), amd64 architecture. I downloaded,
compiled and installed Python 3.3.0 alpha 3 (from python.org) using
"altinstall". Debian wheezy comes with python3.2 (and 2.6 and 2.7). I
installed the Debian package "python3-bs4" (BeautifulSoup4 for Python3).
Note: De
#! /usr/bin/env python
"""
When I run the following program I get the error message:
UnboundLocalError: local variable 'x' referenced before assignment
Can "inner" change the value of a variable defined in "outer"? Where
is this explained in the docs?
"""
def outer():
def inner():
x
Do any of the Python GUIs have a super-high-level widget that displays a
directory tree? Most file managers or editors have this type of window.
--
http://mail.python.org/mailman/listinfo/python-list
I have uploaded "mrquery.05.12.19.tgz"' to my web page
"http://members.tripod.com/~edcjones/pycode.html";.
"mrquery" finds the duplicate images in a collection of
images. It implements a variant of the algorithm in
"Fast Multiresolution Image Querying" by Charles E.
Jacobs, Adam Finkelstein and Da
#! /usr/bin/env python
class A(list):
def __init__(self, alist, n):
list.__init__(self, alist)
self.n = n
def __str__(self):
return 'AS(%s, %i)' % (list.__str__(self), self.n)
def __repr__(self):
return 'AR(%s, %i)' % (list.__repr__(self), self.
Suppose I want to define the class MyClass so I can create an instance by
MyClass(arg0, arg1, kwarg0=None, kwarg1=0, reuse=None, save=None)
If reuse is not None, it is the name of a pickle file. Unpickle the file
to get the instance.
If save is not None, it is a file name. Pickle the instanc
Suppose arr is a two dimensional numarray array. Suppose we do the
following:
def rowsort(arr):
a = arr.tolist()
a.sort()
return numarray.array(a)
Can this sort be done efficiently in numarray? This function is called
"rowsort" in MatLab.
--
http://mail.python.org/mailman/listinfo/py
I have a PC with Debian sid installed. I install all my Python stuff in
/usr/local. I just installed numarray 1.3.1. Blaslite and lapacklite
were compiled. Did the installation process search for blas and lapack?
--
http://mail.python.org/mailman/listinfo/python-list
Steven Bethard wrote:
> As mentioned, this has nothing to do with numarray, and everything to
> do with your inexplicable use of lists. Why don't you just write this
> as:
>
> arr = numarray.ones((8, 8, 256, 256), Float64)
The code I posted was simplified from a larger program which I have now
re
#! /usr/bin/env python
"""Should this program take 4.3 seconds to run? I have a Linux PC with
an AMD Athlon XP 2000+ chip (1.7Gh). I use Python 2.4.1 and numarray
1.2.3, both compliled from source."""
import time, numarray
from numarray.numerictypes import *
nested = []
for i in range(8):
I have a program named "octave" (a Matlab clone). It runs in a terminal,
types a prompt and waits for the user to type something. If I try
# Run octave.
oct = subprocess.Popen("octave", stdin=subprocess.PIPE)
# Run an octave called "startup".
oct.communicate("startup")
# Change directory inside o
Chris wrote:
Okay, color me stupid, but what is everyone referencing when they
mention Python 3.0? I didn't see any mention of it on the Python site.
http://www.python.org/peps/pep-3000.html
(which happens to be the first hit if you search for "python 3.0" in the
search box on python.org...)
Oka
16 matches
Mail list logo