Re: type = "instance" instead of "dict"

2006-02-27 Thread Fredrik Lundh
James Stroud wrote: > Perhaps you did not know that you can inheret directly from dict, which > is the same as {}. For instance: > > class Dict({}): >pass > > Is the same as > > class Dict(dict): >pass it is ? >>> class Dict({}): ... pass ... Traceback (most recent call last): File

Re: newbie

2006-02-27 Thread Steve Holden
Brain Murphy wrote: [...] > also i have heard that there are no crackers using python why is this?? > Because the Python Secret Underground seeks hackers out and -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Carl Banks
Ben Finney wrote: > This PEP specifies an enumeration data type for Python. -1 for this particular proposal as a builtin. I feel it's not a great design of something that isn't terribly useful to begin with. +0 for the standard library, only after a couple changes. As I see it, this whole propo

Re: type = "instance" instead of "dict"

2006-02-27 Thread Steve Holden
James Stroud wrote: > Cruella DeVille wrote: > >>I'm trying to implement a bookmark-url program, which accepts user >>input and puts the strings in a dictionary. Somehow I'm not able to >>iterate myDictionary of type Dict{} >> >>When I write print type(myDictionary) I get that the type is >>"insta

Re: changing params in while loop

2006-02-27 Thread Ben Cartwright
robin wrote: > i have this function inside a while-loop, which i'd like to loop > forever, but i'm not sure about how to change the parameters of my > function once it is running. > what is the best way to do that? do i have to use threading or is there > some simpler way? Why not just do this in

Re: type = "instance" instead of "dict"

2006-02-27 Thread James Stroud
Cruella DeVille wrote: > I'm trying to implement a bookmark-url program, which accepts user > input and puts the strings in a dictionary. Somehow I'm not able to > iterate myDictionary of type Dict{} > > When I write print type(myDictionary) I get that the type is > "instance", which makes no sens

Re: Python and Flash

2006-02-27 Thread SamFeltus
PS. Here is an example... http://sonomasunshine.com/sonomasunshine/FrontPage.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Flash

2006-02-27 Thread SamFeltus
PS. Here is an example... http://sonomasunshine.com/sonomasunshine/FrontPage.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Flash

2006-02-27 Thread SamFeltus
Why not just have the Python on the server send a JSON string to the Flash ap? Easy easy. Just use LoadVars on the Flash side. All that SOAP and XML-RPC sounds might be an needless overcomplication. Sam the Gardener http://sonomasunshine.com -- http://mail.python.org/mailman/listinfo/python-

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Alex Martelli
Ben Finney <[EMAIL PROTECTED]> wrote: ... > The Python parser knows what to do when a comparison returns > NotImplemented. The parser has nothing to do with it, but the bytecode interpreter sure does;-). Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Alex Martelli
Terry Reedy <[EMAIL PROTECTED]> wrote: ... > I suspect that the notion of empty set was once controversial. Yep: Reverend Dodgson (best known by his pen name of Lewis Carroll, and as the author of the Alice novels, but a logician and mathematician IRL) fought long and hard against Cantor's set

Re: Use of __slots__

2006-02-27 Thread Alex Martelli
MrJean1 <[EMAIL PROTECTED]> wrote: > An example of the RARE use case may be this particular one > > A benchmark is not a use case. Alex -- http://mail.python.org/mailman/listinfo/python-list

Dr. Dobb's Python-URL! - weekly Python news and links (Feb 27)

2006-02-27 Thread Cameron Laird
QOTW: "Actually, Python has the distinction of being both a great tool language *and* a great Zen language. That's what makes Python so cool ;-)))" - Ron Stephens "It is probably possible to do the whole thing with a regular expression. It is probably not wise to do so." - John Zenger (among MANY

Re: How to do an 'inner join' with dictionaries

2006-02-27 Thread Michael J. Fromberger
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Let's say I have two dictionaries: > dict1 is 1:23, 2:76, 4:56 > dict2 is 23:A, 76:B, 56:C > > How do I get a dictionary that is > 1:A, 2:B, 4:C The following should work: j = dict((k, dict2[dict1[k]]) for k in dict1 if dict1[k]

Re: sort one list using the values from another list

2006-02-27 Thread Kent Johnson
Simon Sun wrote: > Magnus Lycka wrote: > >>Is there something here I can't see, or did you just >>change a variable name and present that as another >>solution? > > Heh, I have use python for a very short time. Base your statements, I test > in python, found `_' is a valid variable name. So I don

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Roy Smith
A few random questions: a = enum ('foo', 'bar', 'baz') b = enum ('foo', 'bar', 'baz') what's the value of the following: a == b a is b a.foo == b.foo a.foo is b.foo len (a) str (a) repr (a) hash (a) type (a) Can you make an enum from a sequence? syllables = ['foo', 'bar', 'baz'] c = enum (syll

Re: sort one list using the values from another list

2006-02-27 Thread Simon Sun
Magnus Lycka wrote: > Is there something here I can't see, or did you just > change a variable name and present that as another > solution? Heh, I have use python for a very short time. Base your statements, I test in python, found `_' is a valid variable name. So I don't know it is a just a plain

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: > I'll amend the specification so empty enumerations are not an > error. (This will also remove the last remaining exception class from > the specification, making it cleaner still. Good.) And once you've done that, we can bui

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Paul Rubin
Ben Finney <[EMAIL PROTECTED]> writes: > By way of explanation, my earlier implementations of this didn't have > enumerations as sequences. Now that the design has converged more on a > sequence and container idiom, I agree with you. say that Weekdays = enum('mon', 'tue', ...) What is the typ

Re: spaces at ends of filenames or directory names on Win32

2006-02-27 Thread [EMAIL PROTECTED]
rtilley wrote: > Roel Schroeven wrote: > > rtilley schreef: > > > >> This will at least allow me to ID folders that start with > >> whitespace... from within Windows too :) yet I still cannot rename the > >> folders after stripping the whitespace... attempting to gives an > >> [Errno 2] No such fi

Re: PEP 354 -- "in" operator?

2006-02-27 Thread Ben Finney
[fixing References field. Please reply in the original thread so I can find you easily.] Roy Smith <[EMAIL PROTECTED]> writes: > If I have an enum, how can I verify that it's a legal value? Can I > do: > > Weekdays = enum('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat') > > def foo (day): >if

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Ben Finney
Tim Chase <[EMAIL PROTECTED]> writes: > Just a couple thoughts: Appreciated. >> An enumeration is an exclusive set of symbolic names bound >> to arbitrary unique values. > > Uniqueness imposes an odd constraint that you can't have synonyms in > the set: > > >>> shades = enum({white:100, grey:50,

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Ben Finney
"Giovanni Bajo" <[EMAIL PROTECTED]> writes: > Ben Finney wrote: >> Values within an enumeration cannot be meaningfully compared except >> with values from the same enumeration. The comparison operation >> functions return ``NotImplemented`` [#CMP-NOTIMPLEMENTED]_ when a >> value from an enumeratio

changing params in while loop

2006-02-27 Thread robin
hi, i'm a newbie, but please bear with me for a second. i have this function inside a while-loop, which i'd like to loop forever, but i'm not sure about how to change the parameters of my function once it is running. what is the best way to do that? do i have to use threading or is there some simp

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Paul Rubin
Ben Finney <[EMAIL PROTECTED]> writes: > If an enumeration object were to be derived from, I would think it > just as likely to want to have *fewer* values in the derived > enumeration. Subclassing would not appear to offer a simple way to do > that. pentium_instructions = enum('add', 'sub', 'mul'

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Mikalai
Steven D'Aprano wrote: > Paul Rubin wrote: > > What is an empty enum? How and when would you use it? > > The best I can come up with is that an empty enum would > be the enumerated values you have when you don't > actually have any enumerated values. This is not to be > confused with an empty list:

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Ben Finney
"Terry Reedy" <[EMAIL PROTECTED]> writes: > "Steven D'Aprano" <[EMAIL PROTECTED]> wrote >> A list is a container. > > I think it is misleading, if not wrong, to refer to Python > collections as 'containers', 'boxes', or similar. A object in a box > cannot be in another disjoint box. A object in a

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Ben Finney
Paul Rubin writes: > Hmm, I also see the PEP doesn't specify what's supposed to happen with > > Weekdays = enum('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat') > Solar_system = enum('sun', 'mercury', 'venus', 'earth',) # etc. > print Weekdays.sun == Solar_system.s

Re: Catch exceptions

2006-02-27 Thread Jonathan Gardner
(A) You'll have to be more specific about your problem if you want us to help. Under which circumstances did it work or not? What exactly is the problem? (B) Where you put your error-handling is up to you. It depends on what the function does and how it is to respond. Do you want the function to t

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Ben Finney
Paul Rubin writes: > Ben Finney <[EMAIL PROTECTED]> writes: >> Enumerations with no values are meaningless. The exception >> ``EnumEmptyError`` is raised if the constructor is called with no >> value arguments. > > Why are empty enumerations not allowed? Empty sets, emp

Re: type = "instance" instead of "dict"

2006-02-27 Thread Jonathan Gardner
You should probably spend a bit more time in the documentation reading things for yourself. Read http://www.python.org/doc/2.4.2/ref/types.html under "Class Instances" for your answer. -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Ben Finney
"Giovanni Bajo" <[EMAIL PROTECTED]> writes: > Kay Schluehr wrote: >> Ben Finney wrote: >>> One motivation for having a class (rather than an instance) for >>> each enumeration is to allow subclasses of enumerations, extending >>> and altering an existing enumeration. A class, though, implies >>> t

Re: Catch exceptions

2006-02-27 Thread Cruella DeVille
I put the try catch in my main-method, and it worked to some extent (except from when I try to read from a file with no content) Any idea how to solve that? And is it a good place to have a try-except in main instead of in the class methods? My code is at http://nibbler.no/blog/wp-includes/Bookma

Re: str.count is slow

2006-02-27 Thread Terry Reedy
"Ben Cartwright" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Your evidence points to some unoptimized code in the underlying C > implementation of Python. As such, this should probably go to the > python-dev list (http://mail.python.org/mailman/listinfo/python-dev). > > The pro

Re: Matplotlib logarithmic scatter plot

2006-02-27 Thread Derek Basch
Great! That worked fine after I played with it for a bit. One last question though. How do I label the ticks with the product of the exponentiation? For instance: 100 instead of 10**2 Thanks for all the help, Derek Basch -- http://mail.python.org/mailman/listinfo/python-list

Re: sort one list using the values from another list

2006-02-27 Thread bearophileHUGS
Following Ron Adam solution (and using [] instead of list() in the last line), this may be a possible solution of the problem, that is often quite fast: def psort16(s1, s2): try: d = dict(izip(s2, s1)) except TypeError: _indices = range(len(s1)) _indices.sort(key=s2

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Paul Rubin
"I V" <[EMAIL PROTECTED]> writes: > I think it does, doesn't it? From the PEP: > > "Values within an enumeration cannot be meaningfully compared *except > with values from the same enumeration*. The comparison operation > functions return ``NotImplemented`` [#CMP-NOTIMPLEMENTED]_ when a > value f

Re: Catch exceptions

2006-02-27 Thread Crutcher
Without seeing more of your code, I'm not sure what you are doing wrong. This works: ex.py vv def xopen(path): try: return open(path) except IOError, e: print 'Error:', e.args[1] xopen('xyzzy') ^^ $ python ex.py Error: No such file or direct

Dr. Dobb's Python-URL! - weekly Python news and links (Feb 27)

2006-02-27 Thread Cameron Laird
QOTW: "Actually, Python has the distinction of being both a great tool language *and* a great Zen language. That's what makes Python so cool ;-)))" - Ron Stephens "It is probably possible to do the whole thing with a regular expression. It is probably not wise to do so." - John Zenger (among MANY

Re: str.count is slow

2006-02-27 Thread Fredrik Lundh
Ben Cartwright wrote: > > On my machine, the output is: > > > > str: 0.29365715475 > > array: 0.448095498171 > > unicode: 0.0243757237303 > This tactic typically avoids most (sometimes all) of the calls to > memcmp. Other string search functions, including unicode.count, > unicode.index, a

Re: spaces at ends of filenames or directory names on Win32

2006-02-27 Thread rtilley
Roel Schroeven wrote: > rtilley schreef: > >> This will at least allow me to ID folders that start with >> whitespace... from within Windows too :) yet I still cannot rename the >> folders after stripping the whitespace... attempting to gives an >> [Errno 2] No such file or directory. The strip

Catch exceptions

2006-02-27 Thread Cruella DeVille
In my application of bookmarks I get a filename as a parameter in one of my methods. I want to catch the "FileNotFoundException" if the user types an invalid filename. My code (that doesn't do what I want it to do - namely print a nicely formatted error message, and no stack trace) def openFile(se

Re: str.count is slow

2006-02-27 Thread Ben Cartwright
[EMAIL PROTECTED] wrote: > It seems to me that str.count is awfully slow. Is there some reason > for this? > Evidence: > > str.count time test > import string > import time > import array > > s = string.printable * int(1e5) # 10**7 character string > a = array.array('c', s) > u =

Re: Matplotlib logarithmic scatter plot

2006-02-27 Thread John Hunter
> "Derek" == Derek Basch <[EMAIL PROTECTED]> writes: Derek> Thanks for the reply. I need a scatter plot though. Can Derek> that be done? You can set the scale of xaxis and yaxis to either log or linear for scatter plots In [33]: ax = subplot(111) In [34]: ax.scatter( 1e6*rand(1000),

Re: sort one list using the values from another list

2006-02-27 Thread Ron Adam
Scott David Daniels wrote: > Ron Adam wrote: >> Ron Adam wrote: >> This probably should be: >> >> def psort11(s1, s2): >> d = dict(zip(s2,s1)) >> assert len(d) == len(s1) >> s1[:] = list(d[v] for v in sorted(d)) > > You could do this to avoid all of those lookups: > > def psort_

MySQLdb compile error with AMD64

2006-02-27 Thread keith
Hi, I have been using MySQLdb on a 32-bit processor, no worries. Love it. I went to install on an AMD64 running the 64-bit version of SUSE 10.0. I get the following error during the "python setup.py build" gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE

Re: type = "instance" instead of "dict"

2006-02-27 Thread Steve Juranich
Cruella DeVille wrote: > I created a class Dict (not dict), but since it only complicates things > for me I implemented my program without it. > > when I wrote myDictionary = dictionary.__dict__.iteritems() it worked > better... > what does the __dict__ mean? This is something else entirely and

Re: PEP 354: Enumerations in Python

2006-02-27 Thread I V
Paul Rubin wrote: > Hmm, I also see the PEP doesn't specify what's supposed to happen with > > Weekdays = enum('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat') > Solar_system = enum('sun', 'mercury', 'venus', 'earth',) # etc. > print Weekdays.sun == Solar_system.sun > > so that's another sho

Re: type = "instance" instead of "dict"

2006-02-27 Thread Cruella DeVille
I created a class Dict (not dict), but since it only complicates things for me I implemented my program without it. when I wrote myDictionary = dictionary.__dict__.iteritems() it worked better... what does the __dict__ mean? -- http://mail.python.org/mailman/listinfo/python-list

Re: ''.join() with encoded strings

2006-02-27 Thread Sandra-24
Sorry, this was my mistake, I had some unicode strings in the list without realizing it. I deleted the topic within 10 minutes, but apparently I wasn't fast enough. You're right join works the way it should, I just wasn't aware I had the unicode strings in there. -Sandra -- http://mail.python.or

Re: Firebird and Python

2006-02-27 Thread Ray Cote
At 5:07 PM +0100 2/27/06, Magnus Lycka wrote: > > I'm still interested >in experiences from Pythonistas using Firebird-- >especially embedded. Works great. Python and Firebird embedded (at least on Windows) is very simple to use. Not currently using it on other platforms. --Ray -- Raymond Cote

PyQT: QDialog and QMainWindow interacting with each other

2006-02-27 Thread Fabian Steiner
Hello! I have got a QMainWindow with a QListView, in which the different entries of a database are shown to the user. Moreover it has got a QPushButton, so that another QDialog can be opened where the user is able to add a new entry: ... self.connect(self.btnNew, SIGNAL('clicked()'), self.ope

Re: bsddb3 database file, are there any unexpected file size limits occuring in practice?

2006-02-27 Thread Klaas
Claudio writes: > I am on a Windows using the NTFS file system, so I don't expect problems > with too large file size. how large can files grow on NTFS? I know little about it. > (I suppose it in having only 256 MB RAM available that time) as it is > known that MySQL databases larger than 2 GByt

Re: unicode question

2006-02-27 Thread Edward Loper
Walter Dörwald wrote: > Edward Loper wrote: > >> [...] >> Surely there's a better way than converting back and forth 3 times? Is >> there a reason that the 'backslashreplace' error mode can't be used >> with codecs.decode? >> >> >>> 'abc \xff\xe8 def'.decode('ascii', 'backslashreplace') >> Trac

Re: Matplotlib logarithmic scatter plot

2006-02-27 Thread Derek Basch
Thanks for the reply. I need a scatter plot though. Can that be done? -- http://mail.python.org/mailman/listinfo/python-list

Re: spaces at ends of filenames or directory names on Win32

2006-02-27 Thread Roel Schroeven
rtilley schreef: > This will at least allow me to ID folders that start with whitespace... > from within Windows too :) yet I still cannot rename the folders after > stripping the whitespace... attempting to gives an [Errno 2] No such > file or directory. The strip seems to work right too accord

Re: type = "instance" instead of "dict"

2006-02-27 Thread Kent Johnson
Cruella DeVille wrote: > So what you are saying is that my class Dict is a subclass of Dict, and > user defined dicts does not support iteration? I don't know what your class Dict is, I was guessing. The built-in is dict, not Dict. > > What I'm doing is that I want to write the content of a dict

Re: Best python module for Oracle, but portable to other RDBMSes

2006-02-27 Thread Jonathan Gardner
I've never seen the points of those tools. Just lay it out on paper or document it somewhere. Be consistant with your naming scheme and it shouldn't be hard to see the relations. If found that the people who don't understand how tables should relate to one another are also the same people who don't

Re: Kill forked processes

2006-02-27 Thread kmkz
I didn't mean that you'd have to write it for me, I meant that if what you said works (atexit, signal) I will paypal you $10 for your generous contribution to my project. -- http://mail.python.org/mailman/listinfo/python-list

Re: Matplotlib logarithmic scatter plot

2006-02-27 Thread Bas
Try this, don't know if this works for al versions: from pylab import * x=10**linspace(0,5,100) y=1/(1+x/1000) loglog(x,y) show() If you only need a logarithm along one axis you can use semilogx() or semilogy(). For more detailed questions go to the matplotlib mailing list. Cheers, Bas -- http

Re: expat

2006-02-27 Thread Jarek Zgoda
Katja Suess napisał(a): > may I have a hint what the problem is in my situation? > Is it a syntax error in sweetone.odt or in xml.parsers.expat? > Same problem with different file instead of sweetone.odt means that it's > not the file that has a syntax error. > xml.parsers.expat is a standard modu

Re: expat

2006-02-27 Thread Fredrik Lundh
Katja Suess wrote: > may I have a hint what the problem is in my situation? > Is it a syntax error in sweetone.odt or in xml.parsers.expat? > xml.parsers.expat.ExpatError: syntax error: line 1, column 0 it's a problem with the file you're parsing (either because it's not a valid XML file, or bec

Matplotlib logarithmic scatter plot

2006-02-27 Thread Derek Basch
Can anyone give any suggestions on how to make a logarithmic (base 10) x and y axis (loglog) plot in matplotlib? The scatter function doesn't seem to have any log functionality built into it. Thanks, Derek Basch P.S. I suck at math so feel free to make me feel stupid if it is really easy to do :)

str.count is slow

2006-02-27 Thread chrisperkins99
It seems to me that str.count is awfully slow. Is there some reason for this? Evidence: str.count time test import string import time import array s = string.printable * int(1e5) # 10**7 character string a = array.array('c', s) u = unicode(s) RIGHT_ANSWER = s.count('a') def ma

expat

2006-02-27 Thread Katja Suess
Hi, may I have a hint what the problem is in my situation? Is it a syntax error in sweetone.odt or in xml.parsers.expat? Same problem with different file instead of sweetone.odt means that it's not the file that has a syntax error. xml.parsers.expat is a standard module that probably has no errors

Re: spaces at ends of filenames or directory names on Win32

2006-02-27 Thread rtilley
This will at least allow me to ID folders that start with whitespace... from within Windows too :) yet I still cannot rename the folders after stripping the whitespace... attempting to gives an [Errno 2] No such file or directory. The strip seems to work right too according to the prints before

Re: type = "instance" instead of "dict"

2006-02-27 Thread Cruella DeVille
So what you are saying is that my class Dict is a subclass of Dict, and user defined dicts does not support iteration? What I'm doing is that I want to write the content of a dictionary to a file, and send the dictionary (favDict) as a parameter like this: favDict = Dict() <-- my own class (or not

newbie

2006-02-27 Thread Brain Murphy
I have some questions, 1) I am trying to have multiple def's but it is not working. for instance, i am using the tutoreals and am trying to combine the phone book as well as the grades..ect so that it would look somthing like this:   def print_options():     print "options:"   

Re: type = "instance" instead of "dict"

2006-02-27 Thread Kent Johnson
Cruella DeVille wrote: > I'm trying to implement a bookmark-url program, which accepts user > input and puts the strings in a dictionary. Somehow I'm not able to > iterate myDictionary of type Dict{} > > When I write print type(myDictionary) I get that the type is > "instance", which makes no sens

Re: Use of __slots__

2006-02-27 Thread MrJean1
An example of the RARE use case may be this particular one /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

PDB on a large threaded application (QMTest)

2006-02-27 Thread [EMAIL PROTECTED]
Hi, I'm trying to debug QMTest from Code Sourcery with PDB from inside Emacs. My problem is that without PDB, I have no problem, but when I'm using PDB, I get exceptions thrown. Has anyone else tried using PDB on QMTest? My python is 2.2, and QMTest is 2.0.3. Thanks / Claes -- http://mail.pytho

Re: new wooden door step - fixing and finishing

2006-02-27 Thread robin
Jeffrey Schwab <[EMAIL PROTECTED]> wrote: >> I was wondering about treating it >> wilth liberal amounts of Teak Oil or similar... > >Some people, when confronted with a problem, think "I know, I?ll use >Teak Oil." Now they have two problems. +1 QOTW BTW, I integrated a similar line into one of

Re: different ways to strip strings

2006-02-27 Thread rtilley
Kent Johnson wrote: > So... > s.strip() gets a bound method object from the class and calls it with no > additional argument. > str.strip(s) gets an unbound method object from the class and calls it, > passing a class instance as the first argument. > > Kent Thank you Kent. That's a very inform

newbie : econometrics in python

2006-02-27 Thread MARK LEEDS
i've used python in the past but only for data processing, writing to files, midifying files, reading from files. now, my boss wants me to do some econometrics using python.   would anyone who has done this ( var, vecm, cointegration, ols, kalman filter whatever ) mind sending me some sample c

type = "instance" instead of "dict"

2006-02-27 Thread Cruella DeVille
I'm trying to implement a bookmark-url program, which accepts user input and puts the strings in a dictionary. Somehow I'm not able to iterate myDictionary of type Dict{} When I write print type(myDictionary) I get that the type is "instance", which makes no sense to me. What does that mean? Thank

Re: How many web framework for python ?

2006-02-27 Thread robin
Steve Holden <[EMAIL PROTECTED]> wrote: >Damn. More reading ... Even more reading as of tomorrow, when I get my Web Application Framework article up on my blog. Even listing the vast number of frameworks & toolkits out there is daunting, so I figured I may as well share my own outlook. And FWIW

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote > A list of X is like a box containing X, and in another post > A list is a container. I think it is misleading, if not wrong, to refer to Python collections as 'containers', 'boxes', or similar. A object in a box cannot be in another disjoint box

Re: making 'utf-8' default codec

2006-02-27 Thread Jarek Zgoda
Jorge Godoy napisał(a): >>Bad idea. You may accidentally break some libraries that depend on ASCII >>being default & standard. > > And what would those produce as output when fed with unicode data? How would > they handle this input? IMVHO nothing should rely on having a standard > charset as i

Re: different ways to strip strings

2006-02-27 Thread Kent Johnson
Crutcher wrote: > It is something of a navel (left over feature). "xyz".strip() is (I > think) newer than string.strip() > Yes, but the question as written was about str.strip() which is an unbound method of the str class, not string.strip() which is a deprecated function in the string module.

Re: different ways to strip strings

2006-02-27 Thread Kent Johnson
rtilley wrote: > s = ' qazwsx ' > > # How are these different? > print s.strip() > print str.strip(s) They are equivalent ways of calling the same method of a str object. > > Do string objects all have the attribute strip()? If so, why is > str.strip() needed? Really, I'm just curious... there'

Re: Waiting for Connection

2006-02-27 Thread D
Thanks Kent! update_idletasks() does exactly what I needed, which as you mentioned was just to give it enough time to reconfigure the button. Doug -- http://mail.python.org/mailman/listinfo/python-list

converting binary data

2006-02-27 Thread piotr maliński
I have a game file described here: http://iesdp.gibberlings3.net/ieformats/itm_v1.htm and I'm trying to read all the data: plik = open('bow08.itm', 'rb') try:         tekst = plik.read() finally:         plik.close() # char array - works print tekst[0x0004:0x0004

Re: sort one list using the values from another list

2006-02-27 Thread Scott David Daniels
Ron Adam wrote: > Ron Adam wrote: >> Alex Martelli wrote: >>> Ron Adam <[EMAIL PROTECTED]> wrote: >>>... Considering the number time I sort keys after getting them, It's the behavior I would prefer. Maybe a more dependable dict.sortedkeys() method would be nice. ;-) >>> >>> s

Re: problem(s) with import from parent dir: "from ../brave.py import sir_robin"

2006-02-27 Thread Magnus Lycka
per9000 wrote: > ...and there was much rejoicing... Even better, thanks - you guys are > the best. > > import string, time, sys > sys.path.append("../../py_scripts") > > Works just nice, and yes, I removed the env.variable before I tried it > :-D The *right* thing to do might be to install the p

Re: different ways to strip strings

2006-02-27 Thread Crutcher
It is something of a navel (left over feature). "xyz".strip() is (I think) newer than string.strip() -- http://mail.python.org/mailman/listinfo/python-list

Re: different ways to strip strings

2006-02-27 Thread Crutcher
It is something of a navel (left over feature). "xyz".strip() is (I think) newer than string.strip() -- http://mail.python.org/mailman/listinfo/python-list

different ways to strip strings

2006-02-27 Thread rtilley
s = ' qazwsx ' # How are these different? print s.strip() print str.strip(s) Do string objects all have the attribute strip()? If so, why is str.strip() needed? Really, I'm just curious... there's a lot don't fully understand :) -- http://mail.python.org/mailman/listinfo/python-list

Re: ''.join() with encoded strings

2006-02-27 Thread Fredrik Lundh
"Sandra-24" wrote: > I'd love to know why calling ''.join() on a list of encoded strings > automatically results in converting to the default encoding. First of > all, it's undocumented, so If I didn't have non-ascii characters in my > utf-8 data, I'd never have known until one day I did, and then

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-27 Thread Magnus Lycka
Claudio Grondi wrote: > I mean, that using time.clock() solves the problem, because the output > of the following code: On Windows that it. At least on Linux and Solaris, time.clock() returns CPU time. If time.clock() returns significantly different values before and after time.sleep(1), there's

Re: ls files --> list packer

2006-02-27 Thread Magnus Lycka
kpp9c wrote: > that is nice but the little further wrinkle, which i have no idea > how to do, would be to have the contents of each directory packed into > a different list since you have no idea before hand how many lists > you will need (how many subdirs you will enounter) ... well that

Re: ''.join() with encoded strings

2006-02-27 Thread Diez B. Roggisch
Sandra-24 wrote: > I'd love to know why calling ''.join() on a list of encoded strings > automatically results in converting to the default encoding. First of > all, it's undocumented, so If I didn't have non-ascii characters in my > utf-8 data, I'd never have known until one day I did, and then t

Re: making 'utf-8' default codec

2006-02-27 Thread Jorge Godoy
Jarek Zgoda <[EMAIL PROTECTED]> writes: > Bad idea. You may accidentally break some libraries that depend on ASCII > being default & standard. And what would those produce as output when fed with unicode data? How would they handle this input? IMVHO nothing should rely on having a standard char

Re: unicode question

2006-02-27 Thread Walter Dörwald
Edward Loper wrote: > [...] > Surely there's a better way than converting back and forth 3 times? Is > there a reason that the 'backslashreplace' error mode can't be used with > codecs.decode? > > >>> 'abc \xff\xe8 def'.decode('ascii', 'backslashreplace') > Traceback (most recent call last): >

''.join() with encoded strings

2006-02-27 Thread Sandra-24
I'd love to know why calling ''.join() on a list of encoded strings automatically results in converting to the default encoding. First of all, it's undocumented, so If I didn't have non-ascii characters in my utf-8 data, I'd never have known until one day I did, and then the code would break. Secon

Re: Unicode and MoinMoin

2006-02-27 Thread Fredrik Lundh
Neil Hodgson wrote: > > The only issue I'm having relates to Unicode. MoinMoin and python are > > pretty unforgiving about files that contain Unicode characters that > > aren't included in the coding properly. I've spent hours reading about > > Unicode, and playing with different encoding/decoding

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-27 Thread Magnus Lycka
Peter Hansen wrote: > Magnus Lycka wrote: > >> With an operating system such as Windows, this is >> probably something you can expect to happen, although >> I'm surprised if such long lag times as 200 s are typical. > > No way. I mean, I'm the biggest critic of Windows operating systems > when

Firebird and Python

2006-02-27 Thread Magnus Lycka
Jarek Zgoda wrote: > They just hired Jim Starkey. Perhaps MySQL AB hopes he will write a > transactional engine for MySQL, as he previously wrote one for Interbase > (which is known to be one of the best a man could imagine). > > Anyway, we got far off topic, so we better go somewhere else. Ok,

Re: ls files --> list packer

2006-02-27 Thread Scott David Daniels
kpp9c wrote: > Thank you... i was looking in the wrong place cause all i found was > this relatively useless doc: > http://docs.python.org/lib/module-os.html > which says almost nothing. > In one of its subsections, cleverly named "Files and Directories", I see a nice description of listdir.

Re: Waiting for Connection

2006-02-27 Thread Kent Johnson
D wrote: > I am trying to do the following using Python and Tkinter: > > 1) Display a window with 1 button > 2) When user clicks the button, Python attempts to call a function > that opens a socket and listens for a connection - what I want to do > is, if the socket has been successfully opened

Re: Use of __slots__

2006-02-27 Thread Don Taylor
Alex Martelli wrote: > meant for extremely RARE use, and only by very advanced programmers who > fully know what they're doing Yea, from the table of my memory I ’ll wipe away all trivial fond records of __slots__ (Bet you wish Mark Lutz had not mentioned it in Learning Python ...) Don. --

  1   2   >