Installing a Python package is easy, most of time just
Setup.py install However, setup.py doesn't seem to support
an uninstall command. If I want to delete a package that I
do not use any more, should I just manually delete the
corresponding sub directory under Lib\site-packages?
--
Joachim Durchholz wrote:
Darren New schrieb:
As far as I understand it, Eiffel compilers don't even make use of
postconditions to optimize code or eliminate run-time checks (like null
pointer testing).
That's correct.
I think a large part of the reasons why this isn't done is that
[EMAIL PROTECTED] wrote:
Will the hash function always generate unique keys?
no. hash() is designed for dictionaries (hash tables), not for use as a
cryptographic hash.
depending on your application, a bloom filter might be a good enough:
http://en.wikipedia.org/wiki/Bloom_filter
(see
[EMAIL PROTECTED] wrote:
I just realized that of course the hash is not always going to be
unique, so this wouldn't really work. And it seems a hash table would
still need to store the keys (as strings) so that string comparisons
can be done when a collision occurs.
btw, Python's dictionary
I want to generate a report and the PDF fits perfectly. Though there is
an issue of using different encoding in the doc. I tried PyPS with no
success. I need a lib that can make PDFs with an arbitrary set of fonts
(possibly embed them into the document). What would you suggest?
--
[EMAIL PROTECTED] wrote:
Hello,
I am using some very large dictionaries with keys that are long strings
(urls). For a large dictionary these keys start to take up a
significant amount of memory. I do not need access to these keys -- I
only need to be able to retrieve the value associated
Joachim Durchholz wrote:
Marshall schrieb:
I can certainly see how DbC would be useful without subtyping.
But would there still be a reason to separate preconditions
from postconditions? I've never been clear on the point
of differentiating them (beyond the fact that one's covariant
pipe,
In general it is not possible in one line. You have to do it before
hand or after with an if statement.
As a sidenote though you probably shouldn't use isinstance(), you might
need it less than you think you do, especially if you are using it to
check for some interface. For example, do
It should be enough but it might be a little slower than hash(string).
Diez B. Roggisch wrote:
[EMAIL PROTECTED] wrote:
Hello,
I am using some very large dictionaries with keys that are long strings
(urls). For a large dictionary these keys start to take up a
significant amount of
Dictionaries are hash tables in Python.
If you don't really want to store the keys, just use
dic[hash(key)]=value, this way the dictionary will have the same shape
and distribution of keys as dic[key]=value because
hash('abc')=hash(hash('abc')) but the long string of actual keys are
not
victor,
Have you tried Reportlab ( http://www.reportlab.org/rl_toolkit.html )?
That sounds like what you might need.
-Nick Vatamaniuc
victor wrote:
I want to generate a report and the PDF fits perfectly. Though there is
an issue of using different encoding in the doc. I tried PyPS with no
Jack,
As a rule, if you use a Linux distribution, you should just install
the package and then remove the package using the package manager.
Distutils uninstallation is not supported. Of course you could manually
delete the directory in site-packages in most, but not all (!) cases,
that should
On 2006-07-12, Nick Vatamaniuc [EMAIL PROTECTED] wrote:
Installing a Python package is easy, most of time just
Setup.py install However, setup.py doesn't seem to support
an uninstall command. If I want to delete a package that I
do not use any more, should I just manually delete the
Once you are ready to take the plunge another good document is the
Python tutorial written by Guido Von Rossum himself
(http://docs.python.org/tut/). It's not a full fledged 300 page
manifesto but it's covers the basic of the language.
IOANNIS MANOLOUDIS wrote:
I guess it's better to wait for
As a rule, if you use a Linux distribution, you should just install
the package and then remove the package using the package manager.
Grant That's fine except a lot of python packages aren't available in
Grant any of the various Linux distro package formats.
And one or two
Oh dear. For the time being I will leave it with fork and leave it at that.
Ta
sree
You may be missing nothing. If I recall correctly a similar problem was
once reported on the pygtk-list. Some investigation showed that some
programs couldn't be reliably run from a thread, using os.system.
Nick Vatamaniuc wrote:
If you don't really want to store the keys, just use
dic[hash(key)]=value, this way the dictionary will have the same shape
and distribution of keys as dic[key]=value because
hash('abc')=hash(hash('abc')) but the long string of actual keys are
not referenced by the
how come you're so sure that there will never be any collisions ?
because none of his strings want their insurance to go up...
:*)
-tkc
--
http://mail.python.org/mailman/listinfo/python-list
Marshall wrote:
So, what exactly separates a precondition from a postcondition
from an invariant?
A precondition applies to a routine/method/function and states the
conditions under which a function might be called. For example, a
precondition on stack.pop might be not stack.empty, and
I'm currently learning my way through Python and in the process
developing a reporting tool for the company I'm working for.
Basically the tool rips through an existing .XML file to grab the
information needed and spits it out in a nicely formated html page that
is easily read by anyone. This
Thanks to all for the suggestions - I am going to give them a try this
afternoon. I am still fairly new to Python, so this will definitely be
a good learning experience. :)
Maric Michaud wrote:
Le mercredi 12 juillet 2006 17:00, D a écrit :
Thanks, guys. So overall, would it just be easier
rwboley wrote:
My question is: how can I make that graphing step easier? Ideally I'd
like the chart to exist on it's own page, but I have no idea where to
even begin to implement this. Any thoughts would be appreciated.
I've seen several people recommend matplotlib for this kind of thing.
Marshall schrieb:
I can see the lack of a formal model being an issue, but is the
imperative bit really all that much of an obstacle? How hard
is it really to deal with assignment? Or does the issue have
more to do with pointers, aliasing, etc.?
Actually aliasing is *the* hard issue.
Just one
I am exploring the modules scipy and linalg using python under Win XP and
IDLE.
Defining m=matrix( .. ) and trying to compute the inverse of m:
inverse(m)
I get an array:
array( .. )
This is unfortunate. I would rather have a matrix returned as the rules for
manipulating matrices and
Marshall schrieb:
So, what exactly separates a precondition from a postcondition
from an invariant? I have always imagined that one writes
assertions on parameters and return values, and those
assertions that only reference parameters were preconditions
and those which also referenced return
* [EMAIL PROTECTED] (2006-07-11 10:20 +)
I want to generate all non-empty substrings of a string of length =2.
Also,
each substring is to be paired with 'string - substring' part and vice
versa.
Thus, ['abc'] gives me [['a', 'bc'], ['bc', 'a'], ['ab', 'c'], ['c',
'ab'], ['b', 'ac'],
Hi list,
Is there a more elagant way of doing this?
# logflags is an array of logicals
test=True
for x in logflags:
test = test and x
print test
--
Thanks,
--
http://mail.python.org/mailman/listinfo/python-list
Joachim Durchholz wrote:
Marshall schrieb:
I can see the lack of a formal model being an issue, but is the
imperative bit really all that much of an obstacle? How hard
is it really to deal with assignment? Or does the issue have
more to do with pointers, aliasing, etc.?
Actually
victor wrote:
I want to generate a report and the PDF fits perfectly. Though there is
an issue of using different encoding in the doc. I tried PyPS with no
success. I need a lib that can make PDFs with an arbitrary set of fonts
(possibly embed them into the document). What would you suggest?
Pretty sure he meant 1.5.1.
Found the documentation for the program he's using here:
http://www.hpcu.uq.edu.au/Manuals/MSC/msc/docs/marc/python/python_manual.pdf
It looks like the PyTensor object *should* have .xx, .xy, etc
properties, but they may be accessible through a matrix, i.e. .t(i,j)
John Henry wrote:
Is there a more elagant way of doing this?
# logflags is an array of logicals
test=True
for x in logflags:
test = test and x
print test
your code checks all members, even if the first one's false. that's not
very elegant. here's a better way to do it:
def
John Henry wrote:
Is there a more elagant way of doing this?
# logflags is an array of logicals
test=True
for x in logflags:
test = test and x
print test
Py2.5:
test = all( logflags )
Py2.4 (although somewhat ugly):
try:
test = itertools.ifilterfalse( logflags ).next()
John Henry wrote:
Hi list,
Is there a more elagant way of doing this?
# logflags is an array of logicals
test=True
for x in logflags:
test = test and x
print test
There's reduce, but it's not as explicit, and see F's post RE
efficiency:
x = [True, True, True]
y = [True, False,
John Henry wrote:
Hi list,
Is there a more elagant way of doing this?
# logflags is an array of logicals
test=True
for x in logflags:
test = test and x
print test
--
Thanks,
The builtin reduce does that kind of thing for any function you wish
to apply across the list.So
Aage Andersen wrote:
I am exploring the modules scipy and linalg using python under Win XP and
IDLE.
Defining m=matrix( .. ) and trying to compute the inverse of m:
inverse(m)
I get an array:
array( .. )
This is unfortunate. I would rather have a matrix returned as the rules for
Skip,
Uninstall support is hard, you would turn distutils (setup.py) into a
package management system, but wait...! there are already package
managers that do exactly that (rpm, deb, Windows Installer).
If no distro installer package is available for your Python module --
build it yourself and
Aage Andersen [EMAIL PROTECTED] (REMOVE) wrote in message
news:[EMAIL PROTECTED]
I am exploring the modules scipy and linalg using python under Win XP and
IDLE.
[...]
Comments welcome.
scipy questions are best discussed on the scipy list.
--
Konrad,
I would try to find out if pgcc has any compatibility switches. I saw
you turned optimization off but sometimes there is more you can do
disable some of the advanced behind the scenes magic. So apply all
those switches, run the tests and then try them one by one to find out
how many you
Marshall schrieb:
Joachim Durchholz wrote:
Marshall schrieb:
I can see the lack of a formal model being an issue, but is the
imperative bit really all that much of an obstacle? How hard
is it really to deal with assignment? Or does the issue have
more to do with pointers, aliasing, etc.?
Darren New schrieb:
There are also problems with the complexity of things. Imagine a
chess-playing game trying to describe the generate moves routine.
Precondition: An input board with a valid configuration of chess pieces.
Postcondition: An array of boards with possible next moves for the
Nick Uninstall support is hard, you would turn distutils (setup.py)
Nick into a package management system, but wait...! there are already
Nick package managers that do exactly that (rpm, deb, Windows
Nick Installer).
Note that I don't really care about uninstall support,
Joachim Durchholz wrote:
Actually, in a functional programming language (FPL), you write just the
postconditions and let the compiler generate the code for you.
Certainly. And my point is that the postcondition describing all valid
chess boards reachable from this one is pretty much going to
I'd second Skip's point. Now that setup.py does install, and it knows what
to
uninstall (because it copied the files in the first place) I think it's a
good idea
to have setup.py uninstall support. :)
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Nick Uninstall support is
[EMAIL PROTECTED] wrote:
Hi,
I want to generate all non-empty substrings of a string of length =2.
Also,
each substring is to be paired with 'string - substring' part and vice
versa.
Thus, ['abc'] gives me [['a', 'bc'], ['bc', 'a'], ['ab', 'c'], ['c',
'ab'], ['b', 'ac'], ['ac', 'b']]
I need to find out if an object is a class. Using new style classes
this is very easy:
class Test(object): pass
obj = Test
or
obj = Test()
if type(obj) == type:
# this is a class object..
else:
# this not a class object
But this fails for old style classes. For example:
class
import types
class OldStyle: pass
...
type(OldStyle) == types.ClassType
True
--
http://mail.python.org/mailman/listinfo/python-list
Ahh much better. Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Skip,
I agree. Some kind of a manifest or log file would be great and
probably not that hard to implement.
Nick
[EMAIL PROTECTED] wrote:
Nick Uninstall support is hard, you would turn distutils (setup.py)
Nick into a package management system, but wait...! there are already
Nick
Fred,
I never said there will be no collisions. For clarity, can you quote
the exact phrase where I mentioned that?
To say that there will be no collision is nonsense because the # of
possible long url strings is certainly larger than 2^32, applying the
pigeon hole principle you could easily
Nick Vatamaniuc wrote:
I never said there will be no collisions. For clarity, can you quote
the exact phrase where I mentioned that?
the text I quoted is only true if you can guarantee that there will be
no collisions.
/F
--
http://mail.python.org/mailman/listinfo/python-list
Please don't top post. I had to fix that below.
Any other thoughts or considerations are appreciated.
You could try and create a md5 sum of your strings and use that as key. It
_should_ be good enough, but I'm no crypto expert so take that with a grain
of salt.
It should be enough but it
[EMAIL PROTECTED] writes:
do it this way am I going to get the memory savings I am after? Will
the hash function always generate unique keys? Also, would the same
technique work for a set?
A hash function that always generates unique hashes is called a
perfect hash. They tend to be slow,
I checked my code today and your suggestion did fix the problem. I
used your second idea of having the default class attributes with
individual instance attributes. I ran into one problem where I kept
getting the error
File \\user1\jacksocl\Python_stuff\CMRPG\CharCreation.py, line 262,
in
Marshall wrote:
Joachim Durchholz wrote:
[...]
Preconditions/postconditions can express anything you want, and they are
an absolutely natural extensions of what's commonly called a type
(actually the more powerful type systems have quite a broad overlap with
assertions).
I'd essentially want to
depending on your application, a bloom filter might be a good enough:
http://en.wikipedia.org/wiki/Bloom_filter
Thanks (everyone) for the comments. I like the idea of the bloom
filter or using an md5 hash, since a rare collision will not be a
show-stopper in my case.
--
I'm sorry, I should have clarified. I want to execute commands on
networked computers running iWindows XP/i. Thank you for you
concern anyway. Does this mean that the Paramiko module only works on
Unix systems?
--
http://mail.python.org/mailman/listinfo/python-list
To capture output from python scripts run from a C++ app I've added the
following code at the beggening of the C++ app:
PyRun_SimpleString(import grabber);
PyRun_SimpleString(import sys);
PyRun_SimpleString(class a:\n\tdef
write(self,s):\n\t\tograbber.grab(s)\n);
PyRun_SimpleString(import
Sorry if this is a FAQ, but I couldn't find a good summary through
google. What kinds of statistical analysis tools exist in python? I
really just need t-tests, chi-squared test, and other such tests of
statistical significance. A few things point to numpy and scipy, but I
was surprised to find
Thomas Nelson wrote:
Sorry if this is a FAQ, but I couldn't find a good summary through
google. What kinds of statistical analysis tools exist in python?
The third hit for python statistics is a good overview of what's available:
http://www.astro.cornell.edu/staff/loredo/statpy/
I
On 12 Jul 2006 18:09:42 -0700 in comp.lang.python, Wesley Henwood
[EMAIL PROTECTED] wrote:
To capture output from python scripts run from a C++ app I've added the
following code at the beggening of the C++ app:
PyRun_SimpleString(import grabber);
PyRun_SimpleString(import sys);
Please do so.
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.10/386 - Release Date: 07/12/2006
--
http://mail.python.org/mailman/listinfo/python-list
Joachim Durchholz wrote:
Marshall schrieb:
Joachim Durchholz wrote:
Marshall schrieb:
I can see the lack of a formal model being an issue, but is the
imperative bit really all that much of an obstacle? How hard
is it really to deal with assignment? Or does the issue have
more to do
On Wed, 2006-07-12 at 16:12 -1000, normt's subject read:
Find and Delete all files with .xxx extension
How ? In the current directory/folder ? Recursively search through all
the directories/folders from a certain path ?
I suggest you look at the os module (section about Files and
David Hopwood wrote:
Marshall wrote:
Wouldn't it be possible to do them at compile time? (Although
this raises decidability issues.)
It is certainly possible to prove statically that some assertions cannot fail.
The ESC/Java 2 (http://secure.ucd.ie/products/opensource/ESCJava2/docs.html)
On 2006-07-12 06:17:27, mystilleef wrote:
But developers tend to pay more attention to given methods/functions
less crappy names, at least when compared to data attributes. This
stems from the fact that in many languages data attributes aren't
usually part of the API, as well as the whole
And there is a python interface to R, so that you can call R routines from
Python. R is a free stat language that has all the tests you've mentioned,
Gerry
--
http://mail.python.org/mailman/listinfo/python-list
Marshall [EMAIL PROTECTED] wrote:
David Hopwood wrote:
Marshall wrote:
Mightn't it also be possible to
leave it up to the programmer whether a given contract
was compile-time or runtime?
That would be possible, but IMHO a better option would be for an IDE to give
an indication
=== Reminder===
The deadline for submitting abstracts for the the workshop on September
8 in Leipzig is July 15. It is only two days away!!
If you would like to give a presentation, please send your abstract to
[EMAIL PROTECTED]
The workshop topics are listed at
The first check is also off - it should if issubclass(type(Test), type):
otherwise you miss the metaclass case:
class foo(type): pass
class Test(object):
__metaclass__ = foo
obj = Test
if type(obj) == type: 'class obj'
else: 'not a class'
just on the off-chance you run into a metaclass :)
John Henry [EMAIL PROTECTED] wrote:
Hi list,
Is there a more elagant way of doing this?
# logflags is an array of logicals
test=True
for x in logflags:
test = test and x
print test
test = sum(bool(x) for x in logflags)==len(logflags)
is yet another possibility (without the
Gerhard Fiedler [EMAIL PROTECTED] wrote:
...
I'm not sure about which languages you are talking (pretty much all that
allow public methods also allow public attributes), but in general I think
Smalltalk is a very well known object-oriented language that behaves
otherwise, just as one
Nick Vatamaniuc wrote:
The original post just said that he wanted to index some values by
their urls and didn't really care about the urls themselves, so I
suggested that he just use the hash of the key as the key. The
dictionary will then take a hash of that [note that:
John Henry [EMAIL PROTECTED] writes:
# logflags is an array of logicals
test=True
for x in logflags:
test = test and x
print test
print (False not in map(bool, logflags))
Possibly more pure alternative (untested):
from operator import and_
print reduce(and_, map(bool,
Terry == Terry Hancock [EMAIL PROTECTED] writes:
Note that it is trivial to catch collisions on entry and correct them:
key = hash(url_string)
i = 0
if d.has_key(key):
while d.has_key(key):
i += 1
hash is a number. It's sufficient to do
while d.has_key(key):
key += 1
i have walked a directory and have written the foll xml document.
one of the folder had character so i replaced it by amp;
#--test1.xml
Directory
dirnameC:\Documents and Settings\Administrator\Desktop\1\bye
wamp;y /dirname
file
namedef.txt/name
time200607130417/time
Ganesan Rajagopal [EMAIL PROTECTED] writes:
hash is a number. It's sufficient to do
while d.has_key(key):
key += 1
This is called linear probing and is not considered that great a
collision resolution strategy for hash tables. Really, if you want an
exhaustive study about hashing, see
Bugs item #1467450, was opened at 2006-04-10 03:21
Message generated for change (Comment added) made by theller
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1467450group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1512814, was opened at 2006-06-26 18:01
Message generated for change (Comment added) made by twouters
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1512814group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1521375, was opened at 2006-07-12 13:22
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1521375group_id=5470
Please note that this message will contain a full copy of
Bugs item #1521375, was opened at 2006-07-12 20:22
Message generated for change (Comment added) made by theller
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1521375group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1521491, was opened at 2006-07-12 22:04
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1521491group_id=5470
Please note that this message will contain a full copy of
Bugs item #1521491, was opened at 2006-07-12 22:04
Message generated for change (Comment added) made by rudnik_lior
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1521491group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1521375, was opened at 2006-07-12 13:22
Message generated for change (Comment added) made by scotdoyle
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1521375group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1512814, was opened at 2006-06-26 09:01
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1512814group_id=5470
Please note that this message will contain a full copy of the comment
101 - 184 of 184 matches
Mail list logo