Re: Reverse function python? How to use?
frankie_85 wrote: > Ok I'm really lost (I'm new to python) how to use the reverse function. > > > I made a little program which basically the a, b, c, d, e which I have > listed below and basically I want it th result to be printed reverse so > instead doing "print e, d, c, b, a", I'd like to use the reverse > function You can use extended slice operators http://www.python.org/doc/2.3.5/whatsnew/section-slices.html [1] This function call should do what yo expect print [e, d, c, b, a][::-1] [1] Does anyone know where to find a comprehensible description of enhanced slices in the Python docs besides an an aged "What's new?" column? Or is it intended that newbies read this http://docs.python.org/ref/slicings.html ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 12:42 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > Hi, > > > I wanted to read a file encoded in utf-8 and and using the following > > syntax in my source which throws me an error specifying Lookuperror : > > unknown encoding : utf-8. Also I am working on Python version 2.4.1. > > > import codecs > > fileObj = codecs.open( "data.txt", "r", "utf-8" ) > > > Can anyone please guide me how do I get utf-8 activated in my codecs or > > any setting needs to be done for the same before using codecs.What OS? > > Where did you get your python distribution? Anyway, I believe > utf-8 codec was in the python.org distribution since the introduction > of unicode (around python 2.0). If you can't use utf-8 codec right out > of the box, something is really wrong with your setup. > > -- Leo The OS is Windows XP and also how do I incorporate python distribution. Disutils folder exists in the python folder. Anything I need to do there ? Sachin. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
Sachin Punjabi wrote: > The OS is Windows XP then your installation is seriously broken. where did you get the installation kit? have you removed stuff from the Lib directory ? -- http://mail.python.org/mailman/listinfo/python-list
wxPython - which is the better sizer to use with notebook
Hi, What sizers do people use to - contain the notebook control in a Frame and, - contain the contents of a single page of the notebook. At the moment Im using a GridBagSizer for both but this seems to be overkill. Is a BoxSizer a better option? Thanks Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 1:29 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > The OS is Windows XPthen your installation is seriously broken. where did > > you get the > installation kit? have you removed stuff from the Lib directory ? > > It was already installed on my PC and I have no clue how it was installed or any changes has been done. I am just downloading newer version from python.org and will install and check it. I think there should be problem with installation itself. Thanx Sachin. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
Sachin Punjabi wrote: > On Oct 30, 1:29 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > Sachin Punjabi wrote: > > > The OS is Windows XPthen your installation is seriously broken. where > > > did you get the > > installation kit? have you removed stuff from the Lib directory ? > > > > > > It was already installed on my PC and I have no clue how it was > installed or any changes has been done. Then it's a distribution of your PC manufacturer. They could omit some modules like utf-8 codec. > I am just downloading newer > version from python.org and will install and check it. I think there > should be problem with installation itself. That's a right idea, I'd also recommend to leave the manufacturer's python distribution alone. Do not remove it, do not upgrade it. Some programs provided by the manufacturer can stop working. If the preinstalled python was installed into c:\python24 directory, choose some other directory when you install python from python.org. -- Leo -- http://mail.python.org/mailman/listinfo/python-list
Re: question about True values
On 2006-10-29, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 29 Oct 2006 00:31:23 -0700, Carl Banks wrote: > > That's why (for example) Python allows + to operate on lists, or strings, > or floats That was IMO a mistake. There are types for which concatenation as well as addition are meaningfull operators. By using the "+" for both these operations, writing such a class becomes awkward in Python because you have to stray away from Python idiom for one of the two operations. Should Python have chosen the "_" character for concatenating writing amnd working with such a class would have looked more natural. > -- but that doesn't imply that you can add a list to a float, > or that the same code will operate happily on both lists and floats. You, > the developer, don't need to care what data types you are adding, you just > use the same syntax: a+b. Of course the developer needs to care. It's not because a+b will give a result that the result will also be meaningfull. It is not because a class has defined the operators "+", "-", "/", "*" it will give a meaningfull result if you throw a matrix of instances into procdure that solves equations. > The objects themselves know what addition > means to themselves. In practice, string addition threatens to be so > inefficient that you might wish to avoid doing it, but as a general > principle, Python idioms and syntax are as type-independent as possible. Which isn't necesarrily a good thing. I think there is even a warning somewhere against too easily overloading the arithmetic operators for operations that don't act at all as such operators. I think they should have thought of that before using "+" for concatenation. > That's why obj[index] works whether you are getting or setting or deleting > an item, whether it is a sequence or a mapping or a custom class. As much > as possible, you don't need to know what the object is to know what syntax > to use. The idiom for item-access should always be obj[index], not > obj[index] for some types, obj.get(index) for some others, and > getitem(obj, index) for the rest. > > (Custom classes are, of course, free to break these guidelines, just as > the numpy developers were free to have __nonzero__ raise an exception. One > hopes they have good reasons for doing so.) > > And that's why Python not only allows but prefers "if any_object_at_all:" > over type-dependent tricks. The *object itself* is supposed to know > whether it is equivalent to true or false But the objects idea of true and false may not be the most usefull distinction the programmer wants to make. Look at the following example: if container: Prepare() Treat(container) Now Treat will throw an exception if container is not enough list like. But that exception will be throw after Prepare has done useless work in this case. If I replace "if container" with "if len(container)" the exception will be thrown earlier. So using "if len(container)" gives more usefull information than a simple "if container". > (or, in rare cases like numpy > arrays, raise an exception if truth-testing doesn't mean anything for the > type). You, the developer, are not supposed to spend your time wondering > how to recognise if the object is equivalent to false, you just ask the > object. > > If some well-meaning person argued that the correct way to test for a > numeric value of zero/non-zero was like this: > > if x*2 != x: > # x must be non-zero > > you'd fall down laughing (at least, I hope you'd fall down laughing). Yes, > such a test works, but you'd be crazy to do such unnecessary work if all > you want to know if x was nonzero. (And beware of floating point rounding: > what if x is tiny?) > > And then someone passes a class that implements infinity or the alephs to > this function (that could simply mean an INF float on a platform that > supports the IE standard) and the code wrongly decides that INF is zero. > Oops. > > "if x == 0:" is better, but still not good enough, because you're > still making assumptions about the data type. What if it is a numeric type > that works with interval arithmetic? You don't know what the right way to > test for a False interval is -- but the interval class itself will know. But you have no idea that the interval of "False" will guide you to the right branch. And inteval class might treat all zero length intervals as False or it could have a special empty interval which would be the only False interval. Both could be argued for, but you would want to know which before you would rely on "if some_interval:" to guide you to the right branch. > And that's the point -- you're making unnecessary assumptions about the > data, *and* doing unnecessary calculations based on those assumptions. At > best, you're wasting your time. At worst, you're introducing bugs. You have to make assumptions anyway. And your kind of code could introduce bugs just the same. > It isn't often that I make an appeal to authority, but this is one of >
Re: Is there a way to get utf-8 out of a Unicode string?
Fredrik Lundh wrote:
> thebjorn wrote:
>
> > I've got a database (ms sqlserver) that's (way) out of my control,
> > where someone has stored utf-8 encoded Unicode data in regular varchar
> > fields, so that e.g. the string 'Blåbærsyltetøy' is in the database
> > as 'Bl\xc3\xa5b\xc3\xa6rsyltet\xc3\xb8y' :-/
..
> first, check if you can get your database adapter to understand that the
> database contains UTF-8 and not ISO-8859-1.
It would be the way to go, however it looks like they've managed to get
Latin-1 data in exactly two columns in the entire database (this is a
commercial product of course, so there's no way for us to fix things).
And just to make things more interesting, I think I'm running into an
ADO bug where capital letters (outside the U+ to U+007F range) are
returning strange values:
>>> c.execute('create table utf8 (f1 varchar(15))')
>>> u'ÆØÅÉ'.encode('utf-8')
'\xc3\x86\xc3\x98\xc3\x85\xc3\x89'
>>> x = _
>>> c.execute('insert into utf8 (f1) values (?)', (x,))
>>> c.execute('select * from utf8')
>>> c.fetchall()
((u'\xc3\u2020\xc3\u02dc\xc3\u2026\xc3\u2030',),)
>>>
I haven't tested this through C[#/++] to verify that it's an ADO issue,
but it seems unlikely that MS would view this as anything but incorrect
usage no matter where the issue is...
Anyway, sorry for venting :-)
> if that's not possible, you can roundtrip via ISO-8859-1 yourself:
>
> >>> u = u'Bl\xc3\xa5b\xc3\xa6rsyltet\xc3\xb8y'
...
> >>> print u.encode("iso-8859-1").decode("utf-8")
> Blåbærsyltetøy
That's very nice!
-- bjorn
--
http://mail.python.org/mailman/listinfo/python-list
Re: lossless transformation of jpeg images
> > > Last time I checked PIL was not able to apply > > > lossless transformations to jpeg images so > > > I've created Python bindings (or is it a > > > wrapper? I never knew the difference :)) for > > > the jpegtran utility of the Independent Jpeg > > > Group. > > > Why not use Tkinter for jpeg ?? I'm not sure what you mean. Tkinter offers a way to apply for instance lossless rotation to an image? BTW, I have a question to PIL developers: is there a reason why functionality similar to jpegtran hasn't been built into PIL? I very much like PIL and was slightly surprised that lossless rotations are not in it, since everything that needs to be done can be found on www.ijg.org. Or there are copyright/legal issues? Or the C code there only works on linux and would be difficult to create a cross-platform binding? Or some other reason which I don't see? I'm asking because I would like to avoid possible difficulties (which I don't see yet but maybe someone who has thought about it before for example PIL developers do) while I try to create bindings for all jpeg related stuff that can be found on www.ijg.org. Thanks, Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a way to get utf-8 out of a Unicode string?
Gerrit Holl wrote:
> Hei,
>
> On 2006-10-30 08:25:41 +0100, thebjorn wrote:
> > def unfk(s):
> > return eval(repr(s)[1:]).decode('utf-8')
> >
...
> > Is there a less hack'ish way to do this?
>
> Slightly lack hackish:
>
> return ''.join(chr(ord(c)) for c in s)
Much less hackish :-)
-- bjorn
--
http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 1:54 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > On Oct 30, 1:29 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > Sachin Punjabi wrote: > > > > The OS is Windows XPthen your installation is seriously broken. where > > > > did you get the > > > installation kit? have you removed stuff from the Lib directory ? > > > > > > > It was already installed on my PC and I have no clue how it was > > installed or any changes has been done.Then it's a distribution of your PC > > manufacturer. They could omit some > modules like utf-8 codec. > > > I am just downloading newer > > version from python.org and will install and check it. I think there > > should be problem with installation itself.That's a right idea, I'd also > > recommend to leave the manufacturer's > python distribution alone. Do not remove it, do not upgrade it. Some > programs provided by the manufacturer can stop working. If the > preinstalled python was installed into c:\python24 directory, choose > some other directory when you install python from python.org. > > -- Leo I installed it again but it makes no difference. It still throws me error for LookUp Error: unknown encoding : utf-8. Sachin -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
Sachin Punjabi wrote: > I installed it again but it makes no difference. It still throws me > error for LookUp Error: unknown encoding : utf-8. Most likely you're not using the new python, you're still running old one. -- Leo -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 12:47 pm, "thebjorn" <[EMAIL PROTECTED]>
wrote:
> Sachin Punjabi wrote:
> > I wanted to read a file encoded in utf-8 and and using the following
> > syntax in my source which throws me an error specifying Lookuperror :
> > unknown encoding : utf-8. Also I am working on Python version 2.4.1.You
> > shouldn't have to do anything to have the utf-8 encoding available.
> Check in your lib/encodings directory for a file name utf_8.py and the
> code in __init__.py in the same directory should take care of the
> mapping. This has been this way since at least Python 2.2 (which is the
> oldest version I have on this machine).
>
> If that doesn't give you a clue as to what is going on in your setup,
> try
>
> u'foo'.encode('utf-8')
>
> at the prompt and post the complete traceback.
>
> > import codecs
> > fileObj = codecs.open( "data.txt", "r", "utf-8" )That should work fine,
> > although I prefer to explicitly set the mode to
> "rb" (it will be set to binary mode behind your back regardless ;-)
>
> hth,
> -- bjorn
I tried with the code you specified on the command line and it works
very much fine.
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> u'foo'.encode('utf-8')
'foo'
>>>
Sachin.
--
http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 2:27 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > I installed it again but it makes no difference. It still throws me > > error for LookUp Error: unknown encoding : utf-8.Most likely you're not > > using the new python, you're still running old > one. > > -- Leo I installed the newer version on D drive and it was previously installed on C drive. Also the command which bjorn asked me to execute on command line worked very much fine. Sachin. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
Sachin Punjabi wrote: > I installed the newer version on D drive and it was previously > installed on C drive. Also the command which bjorn asked me to execute > on command line worked very much fine. what happens if you *type* in the problematic statements at the command line, e.g. >>> import codecs >>> f = codecs.open( "/python24/README.txt", "r", "utf-8" ) if this still gives you the same exception, what output do you do the same in a Python interpreter run with the "-v" option: > d: > cd \python24 > python -v ... >>> import codecs >>> f = codecs.open( "README.txt", "r", "utf-8" ) -- http://mail.python.org/mailman/listinfo/python-list
codecs - where are those on windows?
I stumbled apon a paragraph in python-dev about "reducing the size of Python" for an embedded device: """ In my experience, the biggest gain can be obtained by dropping the rarely-used CJK codecs (for Asian languages). That should sum up to almost 800K (uncompressed), IIRC. """ So, my question is: on Windows. where are those CJK codecs? Are they by any chance included in the 1.867.776 bytes of python24.dll ? Best wishes, Harald -- http://mail.python.org/mailman/listinfo/python-list
Re: Optional Parameter Requirements
[EMAIL PROTECTED] wrote:
> If I'm building a function to accept optional parameters, do I need to
> allow for the capture of both the positional arguments as well as the
> keyword arguments?
No.
> If it doesn't make sense to allow keyword arguments,
> can I just write:
>
> def myfunc(a, b, *tup):
> ...
>
> and be done with it?
Yes.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
Re: Import if condition is correct
MindClass wrote:
> Is possible import a library according to a condition?
>
> if Foo = True:
> import bar
>
Did you even try ? Would have been faster than posting here...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
slice's indices() method
It seems to me that the indices() method for slices is could be improved. Right now it gives back concrete indices for a range of length n. That is, it does not return any None values. Using an example from clpy about this the indices for a 'None, None, -2' slice for a range of length 10 are given as '9, -1, -2'. The problem is that these concrete values cannot be fed back into a slice so that a slice will extract the same elements that the 'None, None, -2' would have extracted. That's where the problem is. It seems to me that the indices given *from a slice object* should be able to make a round trip and and be used as arguments for a slice object and extract the same elements that the non-concrete (i.e. None-containin) indices would have given. Instead, the behavior right now only allows these indices from a slice object to be fed to a *range* object to give back the indices of the elements that would have been extracted from the original lenght-n object. Here is the full example given in the clpy archives: >>> slice(None, None, -2).indices(10) (9, -1, -2) >>> range(9, -1, -2) [9, 7, 5, 3, 1] >>> range(10)[slice(9, -1, -2)] [] Notice that although the indices given, (9, -1, -2), give a valid range of values from 9 through 1 stepping by 2, these same indices don't extract elements from a range when they are given as an argument to the slice function. In essense, the slice 'None, None, -2' (or '::-2') is not interpreted the same way as the explicitly specified values of '9, -1, -2'. This seems unecessarily obtuse: since the indices *came* from a slice object it seems to me that they should be able to *go back into* a slice object; 'None, None, -2' and the indices obtained for a length-10 object should behave the same. In reading the discussion of Aug 2005 regarding this issue, it sounded like the intent of slice.indices() was to get indices which could be sent to range to generate a range whose values would match the indices produced by the original slice and that this capability was mainly to be used for unittest-ing. If the following sort of logic were applied instead of the current logic I think it would improve the usability of the indices() method for slices: def sliceIndices(slc, n): start, stop, step = slc.indices(n) if cmp(stop-start,0)<>cmp(step,0): #null if step<0: if 0 not in [start-n,stop-n]:start-=n;stop-=n else: if start<0 or stop<0:start+=n;stop+=n else: #valid if step<0: #all should be less than 0 if start>=0 or stop>=0:start-=n;stop-=n return start, stop, step With this logic the following result is obtained for the same indices used in the above examples: >>> print sliceIndices(slice(None,None,-2),10) (-1, -11, -2) >>> range(-1, -11, -2) [-1, -3, -5, -7, -9] >>> range(10)[slice(-1, -11, -2)] [9, 7, 5, 3, 1] This modification of the indices will give indices which can be used in a slice to extract the same elements from a length-n object as the original slice or to generate a range whose elements correspond to the indices of the elements extracted by the original slice. I searched through the *.py scripts in the distribution library, and the only place I found slice indices being used was in the script testing slices...and the test were simply assertions that the slice.indices() gave the expected tuple. Is there any reason not to change the behavior of the indices() method so it gives indices that can be used in range (to give indices corresponding to elements that would be extracted by a given slice) *and* used as arguments for slices so that the slice with the new indices (obtained from the indices() method) would extract the same elements as the original slice from whence they were obtained? Would anything (except the present unittest for the indices() method) break if this new behavior were implemented? /chris -- http://mail.python.org/mailman/listinfo/python-list
Re: stripping parts of elements in a list
CSUIDL PROGRAMMEr wrote:
> folks,
> I am new to python.
>
> I have a list made of elements
>
> ['amjad\n', 'kiki\n', 'jijiji\n']
> I am trying to get rid of '\n' after each name.
> to get list as
> ['amjad','kiki','jijiji']
>
> But list does not have a strip function as string does have.
What would a list.strip() method mean on a list of integers ?
> is there any solutions
mylist = ['amjad\n', 'kiki\n', 'jijiji\n']
print "with map : "
print map(str.lstrip, mylist)
print "with list comprehension :"
print [line.lstrip() for line in mylist]
print "with a for loop :"
strippedlist = []
for line in mylist:
strippedlist.append(line.lstrip())
print strippedlist
> Is there a way this can be done??
Probably. Reading some CS101 tutorial might be a good idea...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list
Re: Where do nested functions live?
Frederic Rentsch wrote in news:mailman.1428.1162113628.11739.python- [EMAIL PROTECTED] in comp.lang.python: >def increment_time (interval_ms): > outer weeks, days, hours, minutes, seconds, mseconds # 'outer' > akin to 'global' > (...) > mseconds = new_ms - s * 1000# Assignee remains outer > m, seconds = divmod (s, 60) > h, minutes = divmod (m, 60) > d, hours = divmod (h, 24) > weeks, days = divmod (d, 7) # No return necessary > > The call would now be: > >increment_time (msec) # No reassignment necessary > > > Hope this makes sense Yes it does, but I prefer explicit in this case: def whatever( new_ms ): class namespace( object ): pass scope = namespace() def inner(): scope.mseconds = new_ms - s * 1000 m, scope.seconds = divmod (s, 60) h, scope.minutes = divmod (m, 60) d, scope.hours = divmod (h, 24) scope.weeks, scope.days = divmod (d, 7) The only thing I find anoying is that I can't write: scope = object() Additionally if appropriate I can refactor further: def whatever( new_ms ): class namespace( object ): def inner( scope ): scope.mseconds = new_ms - s * 1000 m, scope.seconds = divmod (s, 60) h, scope.minutes = divmod (m, 60) d, scope.hours = divmod (h, 24) scope.weeks, scope.days = divmod (d, 7) scope = namespace() scope.inner() In short I think an "outer" keyword (or whatever it gets called) will just add another way of doing something I can already do, and potentially makes further refactoring harder. Thats -2 import-this points already. Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list
Python 123 introduction
Here is a brief simple introduction to Python I wrote for a computing course for graduate astronomers. It assumes some programming experience. Although it is not a complete guide, I believe this could be a useful document for other groups to learn Python, so I'm making it available for others to download, and modify for their own needs (some of the content is site specific). HTML version: http://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/python_123/ Postscript LaTeX output: http://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/python_123.ps PDF LaTeX output: http://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/python_123.pdf LaTeX source: http://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/python_123.tex Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: slice's indices() method
[EMAIL PROTECTED] wrote: > Is there any reason not to change the behavior of the indices() method > so it gives indices that can be used in range (to give indices > corresponding to elements that would be extracted by a given slice) > *and* used as arguments for slices so that the slice with the new > indices (obtained from the indices() method) would extract the same > elements as the original slice from whence they were obtained? and this month's "absolutely most pointless of all pointless proposals" award goes to... -- http://mail.python.org/mailman/listinfo/python-list
dict problem
Ben Finney wrote:
> Alistair King <[EMAIL PROTECTED]> writes:
>
>
>> Ben Finney wrote:
>>
>>> Even better, work on a minimal program to do nothing but reproduce
>>> the unexpected behaviour. If you get to such a program and still
>>> don't understand, then post it here so others can run it
>>> themselves and explain.
>>>
>> ive checked the values and XDS is actually returning a string where i
>> want a float ie '123.45' not 123.45.
>>
>
> Can you please post a small, complete program that shows the behaviour
> you want explained?
>
> You get this program by writing it -- either by cutting away
> irrelevant parts of the existing program, or (better) writing a new
> program from scratch that does nothing except demonstrate the
> behaviour.
>
> Note that in the process of getting such a program behaving this way,
> you may end up understanding the problem better.
>
>
i have seemed to work out most of the problems from the previous code,
now i have:
...
heavy = raw_input("\n\n@@\n\nPlease enter the heaviest
atom for which you obtained percentage values for, but not Oxygen, eg,
'C', 'N', 'S', 'Br'...: ")
print DSvalues
def updateDS1v(Fxas, x):
if Fxas != 0:
value = DSvalues.get(heavy)
floatvalue = float(value)
atoms = DS1v.get(x) + Fxas*floatvalue
DS1v[x] = atoms
updateDS1v(FCas, 'C')
print DS1v
...
the problem now is converting badly formatted dictionary values into floats
ive been trying something like this, where 'value' is a typical entry
into the dictionary:
...
IDLE 1.1
>>> value = "'0.0642501084'"
>>> print float(value)
and get the error, in IDLE and the code as:
Traceback (most recent call last):
File "", line 1, in -toplevel-
print float(value)
ValueError: invalid literal for float(): '0.0642501084'
...
Is there any other way of removing double and single quotes from a
number, as a string, to give the float value again?
I know it would be easier to create a properly formatted dictionary
again and i will do that but it would be good to know as i want to get
this program running properly to get some results i need for work.
Everything else seems to be working fine but this.
thanks
a
--
Dr. Alistair King
Research Chemist,
Laboratory of Organic Chemistry,
Department of Chemistry,
Faculty of Science
P.O. Box 55 (A.I. Virtasen aukio 1)
FIN-00014 University of Helsinki
Tel. +358 9 191 50392, Mobile +358 (0)50 5279446
Fax +358 9 191 50366
--
http://mail.python.org/mailman/listinfo/python-list
Easy PIL Question?
I want to do something very simple: I want to read a palette image (256 color PNG or BMP for instance), and then just to output the image data as numbers (palette indexes, I guess). Makes sense? How do I do that? /David -- http://mail.python.org/mailman/listinfo/python-list
Re: Easy PIL Question?
[EMAIL PROTECTED] wrote: > I want to do something very simple: > > I want to read a palette image (256 color PNG or BMP for instance), and > then just to output the image data as numbers (palette indexes, I > guess). it's explained in the documentation, of course: http://effbot.org/imagingbook/image.htm#Image.getdata -- http://mail.python.org/mailman/listinfo/python-list
Re: Very simple request about argument setting.
Hi, The shuf() function returns two values: x and foo. The command >>> x,foo,bar=shuf(1,2,3,4,5,6,7,8) becomes >>> x,foo,bar=x,foo So, this command assigns 2 values (x and foo) to 3 variables (x, foo and bar), which raises that exception. I'm not sure why python says "need more than 2 values to unpack" not "need 3 values" though. Hope this help, Rooy -- http://mail.python.org/mailman/listinfo/python-list
Re: dict problem
Alistair King wrote:
> Is there any other way of removing double and single quotes from a
> number, as a string, to give the float value again?
help(str) describes what you can do with a string (an object of type
'str', that is). among the methods listed, you'll find:
> | strip(...)
> | S.strip([chars]) -> string or unicode
> |
> | Return a copy of the string S with leading and trailing
> | whitespace removed.
> | If chars is given and not None, remove characters in chars instead.
> | If chars is unicode, S will be converted to unicode before stripping
which looks like it should be pretty useful for this specific case:
>>> value = "'0.0642501084'"
>>> value
"'0.0642501084'"
>>> value.strip("'")
'0.0642501084'
>>> value.strip("'\"")
'0.0642501084'
>>> float(value.strip("'\""))
0.0642501084
--
http://mail.python.org/mailman/listinfo/python-list
Re: wxPython for web development?
walterbyrd wrote: > I assume that wxWidgets can not be used if all you have is mod-python? > Correct. wxPython assumes access to some sort of screen-based interface, with direct keyboard and mouse input. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: Lookuperror : unknown encoding : utf-8
On Oct 30, 2:27 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > I installed it again but it makes no difference. It still throws me > > error for LookUp Error: unknown encoding : utf-8.Most likely you're not > > using the new python, you're still running old > one. > > -- Leo Actually, I have placed the exe created from python in seperate folder other than Python root folder. Is this the cause of the problem but I had set Path to C:\Python24\ in Environment Variables. Sachin. -- http://mail.python.org/mailman/listinfo/python-list
Re: [wxPython] wxFrame don't have Bind attribute ??
Jia Lu wrote: > Hi all > I am using wxPy 2.6.3.2-2, But when run an application with self.Bind > , I got an error that there is no Bind. > > How can I fix it. thanx > Perhaps you could show us the code that's failing, with the traceback - even better, use the knowledge you have already gained to write a *short* program that exhibits the same failure. Then post the code and the traceback. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: Very simple request about argument setting.
Hieu Hoang wrote: > So, this command assigns 2 values (x and foo) to 3 variables (x, foo > and bar), which raises that exception. I'm not sure why python says > "need more than 2 values to unpack" not "need 3 values" though. probably because if you look at the call site x,foo,bar=shuf(1,2,3,4,5,6,7,8) it's more helpful to learn that "shuf" returned 2 values than to learn that the code you're looking at requires three values. -- http://mail.python.org/mailman/listinfo/python-list
ANN: SPE 0.8.3.c Python IDE editor
This is a maintenance release (mostly bug fixing) to prove that SPE is alive and well! In case you are using wxPython2.7 you'll need to upgrade to this release. Submitted patches will be reviewed and included if approved for next release. Thanks for all your patient support and continuing donations. The SPE 0.8.2.a release got downloaded 110550 times on berlios and sourceforge together. Not bad. This means SPE has not seen an update for a while or is getting very popular. Maybe both ;-) Installers are available for python 2.3, 2.4 and 2.5 for Windows and as a rpm including wxPython. Other operating systems can choose the no-setup.zip or targ.gz archives. A .deb archive is being prepared for Debian Linux systems such as Ubuntu. wxGlade is unfortunately not compatible with wxPython2.7. So if you want to use, you'll need wxPython2.6. :**Fixes**: - output is now done with a fixed font - uml.py is now again a stand alone demo - upgraded and fixed wxGlade - fixed for wxPython2.7 (and still backwards compatible with wxPython2.6) - updated NotebookCtrl :**Contributors**: - Andrea Gavana (NoteBookCtrl) - Alberto Griggio (wxGlade) - Michael Foord (python 2.3 + 2.5 releases for windows) :**Donations**: The development of SPE is driven by donations. Each of these donors receives the pdf manual in thanks for their support of SPE. - James Carroll (60 euro) - John DeRosa (50 euro) - Fumph LLC (50 euro) - Ronald Britton (40 euro) - David Downes (40 euro) - Jorge Carrillo (40 euro) - Nicolas Berney (40 euro) - Francois Schnell (30 euro) - Olivier Cortes (30 euro) - Ayrshire Business Consulting Limited (30 euro) - Chris White (25 euro) - Thomas Wengerek (20 euro) - John Rudolph (20 euro) - Michael O'Keefe (20 euro) - Michael Brickenstein (20 euro) - Richard Walkington (20 euro) - Oliver Tomic (20 euro) - Jose Maria Cortes Arnal (20 euro) - Jeffrey Emminger (20 euro) - Eric Pederson (20 $) - Charles Bosson (15 euro) - Angelo Caruso (15 euro) - Chris Hengge (15 $) - Loïc Allys (15 euro) - Marcin Chojnowski (15 euro) - Boris Krasnoiarov (15 euro) - Paul Furber (15 euro) - Gary Robson (15 euro) - Ralf Wieseler (15 euro) - Samuel Schulenburg (10 euro) - Leland Hulbert II (10 euro) - Javier De La Mata Viader (10 euro) - Dorman Musical Instruments (10 euro) - Jaroslaw Sliwinski (10 euro) - Alessandro Patelli (10 euro) - James Pretorius (10 euro) - Richard Wayne Garganta (10 euro) - Maurizio Bracchitta (10 euro) - Larry Lynch (10 euro) - Kay Fricke (10 euro) - Henrik Binggl (10 euro) - Jerol Harrington (10 euro) - Victor Adan (10 euro) - James Fuqua (10 euro) - Christian Seberino (5 euro) - Serge Smeesters (5 euro) - Jarek Libert (5 euro) - Robin Friedrich (5 euro) - Udo Rabe (5 euro) - Roch Leduc (4 euro) - Rha Diseno y Desarrollo (2 euro) :**Installation**: - See http://pythonide.stani.be/manual/html/manual2.html :**Development**: - http://developer.berlios.de/mail/?group_id=4161 About SPE: SPE is a python IDE with auto-indentation, auto completion, call tips, syntax coloring, uml viewer, syntax highlighting, class explorer, source index, auto todo list, sticky notes, integrated pycrust shell, python file browser, recent file browser, drag&drop, context help, ... Special is its blender support with a blender 3d object browser and its ability to run interactively inside blender. Spe integrates with XRCed (gui designer) and ships with wxGlade (gui designer), PyChecker (source code doctor), Kiki (regular expression console) and WinPdb (remote, multi-threaded debugger). The development of SPE is driven by its donations. Anyone who donates can ask for an nice pdf version of the manual without ads (74 pages). -- http://mail.python.org/mailman/listinfo/python-list
Re: wxFrame don't have Bind attribute ??
Jia Lu schreef: > Hi all > I am using wxPy 2.6.3.2-2, But when run an application with self.Bind > , I got an error that there is no Bind. > > How can I fix it. thanx You can not bind an event to a wx application. You must bind an event to a wx frame or control. You'll get more and better support on the wxpython-user mailing list. Stani -- http://pythonide.stani.be -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython - which is the better sizer to use with notebook
Chris Brat schreef: > Hi, > > What sizers do people use to > - contain the notebook control in a Frame and, > - contain the contents of a single page of the notebook. > > At the moment Im using a GridBagSizer for both but this seems to be > overkill. > Is a BoxSizer a better option? Yes, use box sizer if you have to place only one control or when you need to place a row or column of controls. Stani -- http://pythonide.stani.be -- http://mail.python.org/mailman/listinfo/python-list
Re: wxFrame don't have Bind attribute ??
Steve Holden のメッセージ:
> Perhaps you could show us the code that's failing,
the code is :
#!/usr/bin/python -tt
__author__ = "Jia Lu <[EMAIL PROTECTED]>"
__verstion__ = "1.0.0"
import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "MyFrame", size=(300,300))
panel = wx.Panel(self, -1)
panel.Bind(wx.EVT_MOTION, self.OnMove)
wx.StaticText(panel, -1, "Pos:", pos=(100,105))
self.posCtrl = wx.TextCtrl(panel, -1, "", pos=(130,100))
def OnMove(self, event):
pos = event.GetPosition()
self.posCtrl.SetValue("%s, %s" % (pos.x, pos.y))
if __name__ == "__main__":
app = wx.PySimpleApp()
frame = MyFrame()
frame.Show(True)
app.MainLoop()
--
http://mail.python.org/mailman/listinfo/python-list
Re: wxFrame don't have Bind attribute ??
Jia Lu wrote:
> Steve Holden のメッセージ:
> > Perhaps you could show us the code that's failing,
>
> the code is :
>
>
> #!/usr/bin/python -tt
>
> __author__ = "Jia Lu <[EMAIL PROTECTED]>"
> __verstion__ = "1.0.0"
>
> import wx
>
> class MyFrame(wx.Frame):
> def __init__(self):
> wx.Frame.__init__(self, None, -1, "MyFrame", size=(300,300))
> panel = wx.Panel(self, -1)
> panel.Bind(wx.EVT_MOTION, self.OnMove)
> wx.StaticText(panel, -1, "Pos:", pos=(100,105))
> self.posCtrl = wx.TextCtrl(panel, -1, "", pos=(130,100))
>
> def OnMove(self, event):
> pos = event.GetPosition()
> self.posCtrl.SetValue("%s, %s" % (pos.x, pos.y))
>
> if __name__ == "__main__":
> app = wx.PySimpleApp()
> frame = MyFrame()
> frame.Show(True)
> app.MainLoop()
This works perfectly for me, using wxPython 2.6.3.2, on both Linux and
Windows.
What platform are you using?
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
ZODB: single database, multiple connections
Hello all
I am using Python 2.3 and ZODB (without the rest of Zope) with the
following pattern:
* One process which writes stuff to a ZODB instance (call it test.db)
* Another process which reads stuff from the above ZODB instance
test.db
What I find is that when the first process writes, the second doesn't
pick up the changes. I am sure this must be because I am using ZODB
wrongly, but I can't find any examples that show how to use ZODB in
this way, and I can't find any API docs for FileStorage, Connection,
etc. Reading the source code (from C:\python23\lib\site-packages) has
not thrown up anything useful.
Here's my test code:
A simple database class:
class Database(object):
PersistentObject = persistent.Persistent
PersistentDict = BTrees.OOBTree.OOBTree
def __init__(self, filename, read_only = False):
self.storage = FileStorage.FileStorage(filename, read_only =
read_only)
self.db = DB(self.storage)
self.connection = self.db.open()
self.dbroot = self.connection.root()
Write:
db = Database("test.db")
db.data = db.get_dictionary('data')
sz = len(db.data.keys())
class Datum(Persistent):
def __init__(self, value):
self.value = value
if __name__ == '__main__':
# insert 10 things
for i in range(0, 10):
val = i + sz
d = Datum(val)
db.data[val] = d
transaction.commit()
Read:
db = Database("test.db", read_only = True)
data = db.get_dictionary('data')
If I have a Python shell open and run the above two lines, if I run the
write process repeatedly, the above "data" object never contains any of
the newly added items. To pick them up I have to totally recreate the
"db" object.
I must be doing something wrongly, but I can't figure out what.
Any suggestions?
Thanks,
PC
--
http://mail.python.org/mailman/listinfo/python-list
Re: Easy PIL Question?
Fredrik Lundh wrote: > > it's explained in the documentation, of course: > > http://effbot.org/imagingbook/image.htm#Image.getdata > But as I read it, this gives me pixel values, i.e. colors. I want palette indexes instead (which is what is really stored in a palette image). I guess I can make a test and see :) /David -- http://mail.python.org/mailman/listinfo/python-list
MemoryError
Hi,I have found a "MemoryError" exception in my program. How can i output Python interpreterlog or how can i find the root cause of this "MemoryError" exception ? Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: MemoryError
Bugra Cakir wrote: > I have found a "MemoryError" exception in my program. How can i output > Python interpreter log or how can i find the root cause of this > "MemoryError" exception ? this means that you've run out of memory; the ordinary traceback print-out should tell you where. http://effbot.org/pyref/MemoryError.htm -- http://mail.python.org/mailman/listinfo/python-list
Re: ZODB: single database, multiple connections
[Petra Chong]
> I am using Python 2.3 and ZODB (without the rest of Zope) with the
> following pattern:
>
> * One process which writes stuff to a ZODB instance (call it test.db)
> * Another process which reads stuff from the above ZODB instance
> test.db
>
> What I find is that when the first process writes, the second doesn't
> pick up the changes. I am sure this must be because I am using ZODB
> wrongly, but I can't find any examples that show how to use ZODB in
> this way, and I can't find any API docs for FileStorage, Connection,
> etc. Reading the source code (from C:\python23\lib\site-packages) has
> not thrown up anything useful.
>
> Here's my test code:
>
> A simple database class:
>
> ...
>
> Write:
>
> ...
>
> Read:
>
> db = Database("test.db", read_only = True)
>
> data = db.get_dictionary('data')
>
> If I have a Python shell open and run the above two lines, if I run the
> write process repeatedly, the above "data" object never contains any of
> the newly added items. To pick them up I have to totally recreate the
> "db" object.
You say that like it's hard to do ;-)
It's a decent way to proceed. ZODB is a database, and has
transactional semantics: you never see new object state on the read
side because you're /in/ a transaction, and a transaction guarantees
to give you a consistent view of the data. The view would be
inconsistent if it showed you state committed by different
transactions on the write side while you're still in the same
transaction on the read side.
> I must be doing something wrongly, but I can't figure out what.
Seems to be a conceptual problem more than anything else.
> Any suggestions?
You already know that tossing your connection and opening a new
connection will give you a newer view of the database, and it's
unclear why you don't think that's good enough. Other approaches
amount to telling ZODB (on the read side) that you're done with the
current transaction. For example, try doing
transaction.abort()
on the read side when you're ready to see newer object state.
BTW, a better place to ask about ZODB is the zodb-dev list:
http://mail.zope.org/mailman/listinfo/zodb-dev
It's not just for developers /of/ ZODB. Note that you need to
subscribe to it in order to post to it (that's a heavyweight anti-spam
gimmick common to all Zope lists).
--
http://mail.python.org/mailman/listinfo/python-list
Re: what are XLRDError and CompDocError?
kath wrote: > Hi, > i am facing some problems with opening an excel file. I am using XLRD > module. > I am getting > > XLRDError: Can't find workbook in OLE2 compound document > > and > > CompDocError: Not a whole number of sectors > > exceptions in seperate try on different files. > > 1.Does any one know anout these exceptions? what is the cause? a. "XLRDError: Can't find workbook in OLE2 compound document" -- would indicate that the OLE internal directory is broken. Can't find an entry named Workbook or Book. b. "CompDocError: Not a whole number of sectors" -- would indicate that the file is truncated or otherwise malformed. > > 2. what I should do to resolve these problems.? > Send an e-mail message to the package author, providing in each case (1) the versions of Python and xlrd that you are using, on what platform (2) a full copy/paste of the error message *AND* the traceback (3) a copy of the file (4) what software (with version info, if possible) was used to create the file (5) what results you get when you try to open it with OpenOffice.org's calc, Gnumeric, Excel, Excel Viewer, ... Cheers -- http://mail.python.org/mailman/listinfo/python-list
Re: wxFrame don't have Bind attribute ??
Frank Millman のメッセージ: > This works perfectly for me, using wxPython 2.6.3.2, on both Linux and > Windows. > > What platform are you using? Yes this works OK for me too on my FedoraCore 5, but cannot work on my FedoraCore 6... -- http://mail.python.org/mailman/listinfo/python-list
Re: dict problem
Fredrik Lundh wrote:
> Alistair King wrote:
>
>
>> Is there any other way of removing double and single quotes from a
>> number, as a string, to give the float value again?
>>
>
> help(str) describes what you can do with a string (an object of type
> 'str', that is). among the methods listed, you'll find:
>
>
>> | strip(...)
>> | S.strip([chars]) -> string or unicode
>> |
>> | Return a copy of the string S with leading and trailing
>> | whitespace removed.
>> | If chars is given and not None, remove characters in chars instead.
>> | If chars is unicode, S will be converted to unicode before stripping
>>
>
> which looks like it should be pretty useful for this specific case:
>
> >>> value = "'0.0642501084'"
> >>> value
> "'0.0642501084'"
> >>> value.strip("'")
> '0.0642501084'
> >>> value.strip("'\"")
> '0.0642501084'
> >>> float(value.strip("'\""))
> 0.0642501084
>
>
>
>
Thanks..
the code works great now. I know these things are quite simple to learn
from books etc.. but i would be lost without this mailinglist, from lack
of time. Hopefully soon i can give something more complicated.
I ended up doing the dictionary formatting properly and the new code is:
..
heavy = raw_input("\n\n@@\n\nPlease enter the heaviest
atom for which you obtained percentage values for, but not Oxygen or
Hydrogen, ie, 'C', 'N', 'S', 'Br'...: ")
def updateDS1v(Fxas, x):
if Fxas !=0 and DS1v.get(x)!=None:
value = DSvalues.get(heavy)
floatvalue = float(value)
atoms = DS1v.get(x) + Fxas*floatvalue
else:
value = DSvalues.get(heavy)
floatvalue = float(value)
DS1v[x] = Fxas*floatvalue
updateDS1v(FCas, 'C')
updateDS1v(FHas, 'H')
updateDS1v(FOas, 'O')
updateDS1v(FNas, 'N')
updateDS1v(FSas, 'S')
updateDS1v(FClas, 'Cl')
updateDS1v(FBras, 'Br')
updateDS1v(FZnas, 'Zn')
..
it works perfectly now
thanks for the help
a
--
Dr. Alistair King
Research Chemist,
Laboratory of Organic Chemistry,
Department of Chemistry,
Faculty of Science
P.O. Box 55 (A.I. Virtasen aukio 1)
FIN-00014 University of Helsinki
Tel. +358 9 191 50392, Mobile +358 (0)50 5279446
Fax +358 9 191 50366
--
http://mail.python.org/mailman/listinfo/python-list
CHM help file for Python 2.5
Hello, For Python 2.4, documentation was available in .chm format. For new Python 2.5, I am missing this format (download page: http://docs.python.org/download.html). Can anyone point me to new location of this version of manual, or tell me why this format is no longer supported ... ? thanks -- Jiri Zahradil -- http://mail.python.org/mailman/listinfo/python-list
Re: wxFrame don't have Bind attribute ??
Jia Lu wrote: > Frank Millman のメッセージ: > > This works perfectly for me, using wxPython 2.6.3.2, on both Linux and > > Windows. > > > > What platform are you using? > Yes this works OK for me too on my FedoraCore 5, but cannot work on my > FedoraCore 6... Then it is probably an installation problem, which I doubt if I can help with. However, if you can answer the following questions, someone else may be able to assist - 1. What is the exact error message? 2. Which version of wxPython are you using? 3. How did you install wxPython - by compiling from source, or by installing an rpm? I don't think there are any FC6 rpm's available yet. If you don't get an answer here, ask on the wxPython mailing list - [EMAIL PROTECTED] Frank -- http://mail.python.org/mailman/listinfo/python-list
Re: CHM help file for Python 2.5
[EMAIL PROTECTED] wrote: > For Python 2.4, documentation was available in .chm format. For new > Python 2.5, > I am missing this format (download page: > http://docs.python.org/download.html). > Can anyone point me to new location of this version of manual, > or tell me why this format is no longer supported ... ? it's shipped with the standard installer. look for "Python 2.5" -> "Python manuals" in your program menu. -- http://mail.python.org/mailman/listinfo/python-list
Re: dict problem
Alistair King wrote:
> the code works great now. I know these things are quite simple to learn
> from books etc.. but i would be lost without this mailinglist, from lack
> of time. Hopefully soon i can give something more complicated.
> I ended up doing the dictionary formatting properly and the new code is:
> heavy = raw_input("\n\n@@\n\nPlease enter the heaviest
> atom for which you obtained percentage values for, but not Oxygen or
> Hydrogen, ie, 'C', 'N', 'S', 'Br'...: ")
>
> def updateDS1v(Fxas, x):
> if Fxas !=0 and DS1v.get(x)!=None:
> value = DSvalues.get(heavy)
> floatvalue = float(value)
> atoms = DS1v.get(x) + Fxas*floatvalue
> else:
> value = DSvalues.get(heavy)
> floatvalue = float(value)
> DS1v[x] = Fxas*floatvalue
>
> updateDS1v(FCas, 'C')
> updateDS1v(FHas, 'H')
> updateDS1v(FOas, 'O')
> updateDS1v(FNas, 'N')
> updateDS1v(FSas, 'S')
> updateDS1v(FClas, 'Cl')
> updateDS1v(FBras, 'Br')
> updateDS1v(FZnas, 'Zn')
> it works perfectly now
Probably not. Have you manually verified the result with more than one
example? Where does 'heavy' come from? Is that black hole 'atoms'
intentional?
# I'm just guessing here
for k, v in DSvalues.iteritems():
DSvalues[k] = float(v)
def updateDS1v(Fxas, x):
DS1v[x] = DS1v.get(x, 0) + Fxas*DSvalues[x]
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Re: ZODB: single database, multiple connections
> > If I have a Python shell open and run the above two lines, if I run the > > write process repeatedly, the above "data" object never contains any of > > the newly added items. To pick them up I have to totally recreate the > > "db" object. > > You say that like it's hard to do ;-) > It isn't, but this was the problem: It took 15 seconds to open the database, so I thought that I shouldn't be recreating the database and should be refreshing it. There is nothing in the docs that says that the right behaviour is to recreate it. However, I then put some debug statements around it (I know, I know, I could have used profiling) to find out exactly what was taking 15 seconds. Turned out there was some rubbish in the db that shouldn't have been there. I got rid of it, and now it doesn't take 15 seconds to recreate the database. So- I am now recreating the db, and my problem is solved. > > BTW, a better place to ask about ZODB is the zodb-dev list: > > http://mail.zope.org/mailman/listinfo/zodb-dev > > It's not just for developers /of/ ZODB. Note that you need to > subscribe to it in order to post to it (that's a heavyweight anti-spam > gimmick common to all Zope lists). Thanks for that- it's been hard to track down information on ZODB. Regards, PC -- http://mail.python.org/mailman/listinfo/python-list
Re: dict problem
Peter Otten wrote:
> Alistair King wrote:
>
>
>> the code works great now. I know these things are quite simple to learn
>> from books etc.. but i would be lost without this mailinglist, from lack
>> of time. Hopefully soon i can give something more complicated.
>> I ended up doing the dictionary formatting properly and the new code is:
>>
>
>
>> heavy = raw_input("\n\n@@\n\nPlease enter the heaviest
>> atom for which you obtained percentage values for, but not Oxygen or
>> Hydrogen, ie, 'C', 'N', 'S', 'Br'...: ")
>>
>> def updateDS1v(Fxas, x):
>> if Fxas !=0 and DS1v.get(x)!=None:
>> value = DSvalues.get(heavy)
>> floatvalue = float(value)
>> atoms = DS1v.get(x) + Fxas*floatvalue
>> else:
>> value = DSvalues.get(heavy)
>> floatvalue = float(value)
>> DS1v[x] = Fxas*floatvalue
>>
>> updateDS1v(FCas, 'C')
>> updateDS1v(FHas, 'H')
>> updateDS1v(FOas, 'O')
>> updateDS1v(FNas, 'N')
>> updateDS1v(FSas, 'S')
>> updateDS1v(FClas, 'Cl')
>> updateDS1v(FBras, 'Br')
>> updateDS1v(FZnas, 'Zn')
>>
>
>
>> it works perfectly now
>>
>
> Probably not. Have you manually verified the result with more than one
> example? Where does 'heavy' come from? Is that black hole 'atoms'
> intentional?
>
> # I'm just guessing here
> for k, v in DSvalues.iteritems():
> DSvalues[k] = float(v)
>
> def updateDS1v(Fxas, x):
> DS1v[x] = DS1v.get(x, 0) + Fxas*DSvalues[x]
>
> Peter
>
yea...sorry i snipped one line by accident for the email
should be:
def updateDS1v(Fxas, x):
if Fxas !=0 and DS1v.get(x)!=None:
value = DSvalues.get(heavy)
floatvalue = float(value)
atoms = DS1v.get(x) + Fxas*floatvalue
DS1v[x] = atoms
else:
value = DSvalues.get(heavy)
floatvalue = float(value)
DS1v[x] = Fxas*floatvalue
thanks
a
--
Dr. Alistair King
Research Chemist,
Laboratory of Organic Chemistry,
Department of Chemistry,
Faculty of Science
P.O. Box 55 (A.I. Virtasen aukio 1)
FIN-00014 University of Helsinki
Tel. +358 9 191 50392, Mobile +358 (0)50 5279446
Fax +358 9 191 50366
--
http://mail.python.org/mailman/listinfo/python-list
Re: ANN: SPE 0.8.3.c Python IDE editor
thanks Stani! SPE - Stani's Python Editor wrote: > This is a maintenance release (mostly bug fixing) to prove that SPE is > alive and well! In case you are using wxPython2.7 you'll need to > upgrade to this release. Submitted patches will be reviewed and > included if approved for next release. Thanks for all your patient > support and continuing donations. > > The SPE 0.8.2.a release got downloaded 110550 times on berlios and > sourceforge together. Not bad. This means SPE has not seen an update > for a while or is getting very popular. Maybe both ;-) > > Installers are available for python 2.3, 2.4 and 2.5 for Windows and as > a rpm including wxPython. Other operating systems can choose the > no-setup.zip or targ.gz archives. A .deb archive is being prepared for > Debian Linux systems such as Ubuntu. > > wxGlade is unfortunately not compatible with wxPython2.7. So if you > want to use, you'll need wxPython2.6. > > :**Fixes**: > > - output is now done with a fixed font > - uml.py is now again a stand alone demo > - upgraded and fixed wxGlade > - fixed for wxPython2.7 (and still backwards compatible with > wxPython2.6) > - updated NotebookCtrl > > :**Contributors**: > > - Andrea Gavana (NoteBookCtrl) > - Alberto Griggio (wxGlade) > - Michael Foord (python 2.3 + 2.5 releases for windows) > > :**Donations**: > > The development of SPE is driven by donations. Each of these donors > receives the pdf manual in thanks for their support of SPE. > > - James Carroll (60 euro) > - John DeRosa (50 euro) > - Fumph LLC (50 euro) > - Ronald Britton (40 euro) > - David Downes (40 euro) > - Jorge Carrillo (40 euro) > - Nicolas Berney (40 euro) > - Francois Schnell (30 euro) > - Olivier Cortes (30 euro) > - Ayrshire Business Consulting Limited (30 euro) > - Chris White (25 euro) > - Thomas Wengerek (20 euro) > - John Rudolph (20 euro) > - Michael O'Keefe (20 euro) > - Michael Brickenstein (20 euro) > - Richard Walkington (20 euro) > - Oliver Tomic (20 euro) > - Jose Maria Cortes Arnal (20 euro) > - Jeffrey Emminger (20 euro) > - Eric Pederson (20 $) > - Charles Bosson (15 euro) > - Angelo Caruso (15 euro) > - Chris Hengge (15 $) > - Loïc Allys (15 euro) > - Marcin Chojnowski (15 euro) > - Boris Krasnoiarov (15 euro) > - Paul Furber (15 euro) > - Gary Robson (15 euro) > - Ralf Wieseler (15 euro) > - Samuel Schulenburg (10 euro) > - Leland Hulbert II (10 euro) > - Javier De La Mata Viader (10 euro) > - Dorman Musical Instruments (10 euro) > - Jaroslaw Sliwinski (10 euro) > - Alessandro Patelli (10 euro) > - James Pretorius (10 euro) > - Richard Wayne Garganta (10 euro) > - Maurizio Bracchitta (10 euro) > - Larry Lynch (10 euro) > - Kay Fricke (10 euro) > - Henrik Binggl (10 euro) > - Jerol Harrington (10 euro) > - Victor Adan (10 euro) > - James Fuqua (10 euro) > - Christian Seberino (5 euro) > - Serge Smeesters (5 euro) > - Jarek Libert (5 euro) > - Robin Friedrich (5 euro) > - Udo Rabe (5 euro) > - Roch Leduc (4 euro) > - Rha Diseno y Desarrollo (2 euro) > > :**Installation**: > > - See http://pythonide.stani.be/manual/html/manual2.html > > :**Development**: > > - http://developer.berlios.de/mail/?group_id=4161 > > About SPE: > SPE is a python IDE with auto-indentation, auto completion, call tips, > syntax coloring, uml viewer, syntax highlighting, class explorer, > source index, auto todo list, sticky notes, integrated pycrust shell, > python file browser, recent file browser, drag&drop, context help, ... > Special is its blender support with a blender 3d object browser and its > ability to run interactively inside blender. Spe integrates with XRCed > (gui > designer) and ships with wxGlade (gui designer), PyChecker (source > code doctor), Kiki (regular expression console) and WinPdb (remote, > multi-threaded debugger). > > The development of SPE is driven by its donations. Anyone who donates > can ask for an nice pdf version of the manual without ads (74 pages). -- http://mail.python.org/mailman/listinfo/python-list
Re: What's the best IDE?
This is the answer Linux --- BOA constructor Eric (the best for python I think it has cool subversion support better than emacs for non f4cmd67-b jockies emacs sucks anyway you look at it and lisp is a terrible terrible bad joke unless you are gondi) oh and some other tool for python glade/gtk widgetmaroo Mac -- Xcode of course TextMate Windows who cares Personally Eric3 wins for general purpose python code look it up why did no one mention the best one? done Neil Cerutti wrote: > On 2006-10-26, John Salerno <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > >> as I have yet to try Vim - maybe I'll try tomarrow. > > > > Warning: Vim isn't something you just "try tomorrow" :) > > You can become proficient enough for basic editing in about 20 > minutes with the built-in tutorial. > > Getting it to work seemlessly with Python code will take > considerably longer. > > -- > Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
IE7 skulduggery?
Hello everyone: I use Firefox, but perhaps unwisely accepted the XP update to IE7 when it came in. When I check under folder options, my htm and html files are still associated with FireFox. However, now when I attempt to use my nice site launcher that I wrote in Python (which has worked fine for months), I get this new error: d:\python>l clp Traceback (most recent call last): File "d:\python\l.py", line 208, in ? launch(obj) File "d:\python\l.py", line 120, in launch webbrowser.open(sites[obj][1]) File "C:\Python24\lib\webbrowser.py", line 43, in open get().open(url, new, autoraise) File "C:\Python24\lib\webbrowser.py", line 250, in open os.startfile(url) WindowsError: [Errno 1155] No application is associated with the specified file for this operation: 'http://groups.google.com/group/comp.lang.python' On my other machines, which have not yet received the IE7 update, the same script runs fine and launches the sites in FireFox. Anybody else seeing something like this post IE7? Also, suddenly links don't open inside Thunderbird, but they do inside Outlook. How convenient. Upgrading to FireFox 2.0 didn't change anything. Live and learn. rd -- http://mail.python.org/mailman/listinfo/python-list
import in threads: crashes & strange exceptions on dual core machines
I get python crashes and (in better cases) strange Python exceptions when (in
most cases) importing and using cookielib lazy on demand in a thread.
It is mainly with cookielib, but remember the problem also with other imports
(e.g. urllib2 etc.).
And again very often in all these cases where I get weired Python exceptions,
the problem is around re-functions - usually during re.compile calls during
import (see some of the exceptions below). But not only.
Very strange: The errors occur almost only on machines with dual core/multi
processors - and very very rarely on very fast single core machines (>3GHz).
I'm using Python2.3.5 on Win with win32ui (build 210) - the cookielib taken
from Python 2.5.
I took care that I'm not starting off thread things or main application loop
etc. during an import (which would cause a simple & explainable deadlock freeze
on the import lock)
With real OS-level crashes I know from user reports (packaged app), that these
errors occur very likely early after app start - thus when lazy imports are
likely to do real execution.
I researched this bug for some time. I think I can meanwhile exclude
(ref-count, mem.leak) problems in win32ui (the only complex extension lib I
use) as cause for this. All statistics point towards import problems.
Any ideas?
Are there problems known with the import lock (Python 2.3.5) ?
(I cannot easily change from Python 2.3 and it takes weeks to get significant
feedback after random improvements)
-robert
PS:
The basic pattern of usage is:
==
def f():
...
opener = urlcookie_openers.get(user)
if not opener:
import cookielib#<1
cj=cookielib.CookieJar()#<2
build_opener = urllib2.build_opener
httpCookieProcessor = urllib2.HTTPCookieProcessor(cj)
if url2_proxy:
opener = build_opener(url2_proxy,httpCookieProcessor)
else:
opener = build_opener(httpCookieProcessor)
opener.addheaders #$pycheck_no
opener.addheaders= app_addheaders
urlcookie_openers[user] = opener
ufile = opener.open(urllib2.Request(url,data,dict(headers)))
...
thread.start_new(f,())
=
Symptoms:
__
sometimes ufile is None and other weired invalid states.
typical Python exceptions when in better cases there is no OS-level crash:
-
# Attributes randomly missing like:
#<2
"AttributeError: \'module\' object has no attribute \'CookieJar\'\\n"]
-
# weired invalid states during computation like:
#<1
... File "cookielib.pyo", line 184, in ?\\n\', \' File
"sre.pyo", line 179, in compile\\n\', \' File "sre.pyo", line 228, in
_compile\\n\', \' File
"sre_compile.pyo", line 467, in compile\\n\', \' File "sre_parse.pyo", line
624, in parse\\n\', \'
File "sre_parse.pyo", line 317, in _parse_sub\\n\', \' File "sre_parse.pyo",
line 588, in
_parse\\n\', \' File "sre_parse.pyo", line 92, in closegroup\\n\',
\'ValueError: list.remove(x): x
not in list\\n\']
...
'windows', "(5, 1, 2600, 2, 'Service Pack 2')/NP=2")
-
#<1
File "cookielib.pyo", line 116, in ?\\n\', \' File "sre.pyo", line 179, in
compile\\n\', \' File "sre.pyo", line 228, in _compile\\n\', \' File
"sre_compile.pyo", line 467, in compile\\n\', \' File "sre_parse.pyo", line
624, in parse\\n\', \' File "sre_parse.pyo", line 317, in _parse_sub\\n\', \'
File "sre_parse.pyo", line 494, in _parse\\n\', \' File "sre_parse.pyo", line
140, in __setitem__\\n\', \'IndexError: list assignment index out of range\\n\']
('windows', "(5, 1, 2600, 2, 'Service Pack 2')/NP=2"
-
# weired errors in other threads:
# after dlg.DoModal() in main thread
File "wintools.pyo", line 115, in PreTranslateMessage\\n\', \'TypeError: an
integer is required\\n\']
('windows', "(5, 1, 2600, 2, 'Service Pack 2')/NP=2")
-
# after win32ui.PumpWaitingMessages(wc.WM_PAINT, wc.WM_MOUSELAST) in main thread
\'TypeError: argument list must be a tuple\\n\'
...
--
http://mail.python.org/mailman/listinfo/python-list
How can I import a script with an arbitrary name ?
Hi all, I have a script responsible for loading and executing scripts on a daily basis. Something like this: import time t = time.gmtime() filename = t[0] + '-' + t[1] + '-' + t[2] + '.py' import filename So, I have a module with an arbitrary file name and I want to load it, and later access its function definitions. How can I do this ? In my example, the last line will obviously not work. -- http://mail.python.org/mailman/listinfo/python-list
Calling GNU/make from a Python Script
Hello, I need to call GNU/make from within a Python script. This raised some problems: 1. The script is not in the directory of the makefile, and changing the locations of either is not an option. Consequently, the makefile fails, since it can't find the targets/dependencies. 2. After searching around, it seems that os.system(..) should be avoided if there's an alternative. Is there one in this case? Many Thanks! Efrat -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I import a script with an arbitrary name ?
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi all, > > I have a script responsible for loading and executing scripts on a > daily basis. Something like this: > > import time > t = time.gmtime() > filename = t[0] + '-' + t[1] + '-' + t[2] + '.py' > import filename > > So, I have a module with an arbitrary file name and I want to load it, > and later access its function definitions. > How can I do this ? In my example, the last line will obviously not > work. > http://docs.python.org/lib/built-in-funcs.html The first one __import__ should do the trick. Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Calling GNU/make from a Python Script
Efrat Regev wrote in news:[EMAIL PROTECTED] in comp.lang.python: >Hello, > >I need to call GNU/make from within a Python script. This raised some > problems: > 1. The script is not in the directory of the makefile, and changing the > locations of either is not an option. Consequently, the makefile fails, > since it can't find the targets/dependencies. > 2. After searching around, it seems that os.system(..) should be avoided > if there's an alternative. Is there one in this case? > USe the subprocess module, in particular see Popen: http://docs.python.org/lib/node529.html and call: http://docs.python.org/lib/node530.html you will need to use the "cwd" argument. Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list
Compile Python With SSL On Solaris 10
Hi, I am trying to compile py2.4.3/2.5 on a Solaris 10x86 machine, but cannot get it to build an SSL enabled version. I have added the relevant sfw directories into the path/crle, with no success. I've even explicitly added ssl via the --with-libs directive, yet an import _ssl still fails. Has anyone else come across this? Thanks John -- http://mail.python.org/mailman/listinfo/python-list
Backup Mailman?
Does anyone out there know of a utility that will allow you to backup Mailman (including the subscribers and all messages)? TIA -- Karl Groves www.karlcore.com -- http://mail.python.org/mailman/listinfo/python-list
Re: importing class
Thanks for your help. Actually my idea was that command1 and command2
would be defined within the program, not the module, as I would have
different choices in different programs. Should I pass them in as a
parameter too?
Greg
Steve Holden wrote:
> [EMAIL PROTECTED] wrote:
> > Thanks, I got that part. The problem I'm still having is that it's not
> > seeing things like text_1, which are defined in the program. How can I
> > make it see that?
> >
> Your module is intended to work with many different main programs, so it
> shouldn't make any assumptions about the names that the main program
> uses for things. That would be rather bad programming style ("rigind
> coupling" is something to be avoided where possible). I wouldn't call
> that class App just because it's misleading: maybe you could change the
> name to YesNo, or Choice, or something more indicative of its function?
>
> You could pass text_1 and text_2 as arguments to the class's __init__
> method - that way you could just use them directly.
>
> > Another question I should ask is whether I should even bother doing
> > this. That is, it seems that the elegant and approved way of doing this
> > kind of thing may be to put a class in a module and then just use the
> > module over and over again in programs. I'm making a few GUIs which
> > present two options and ask the user to chose one, so I thought I could
> > just do it this way. Of course I could very easily just copy and paste
> > the class into each file, but that seems silly. I haven't had any
> > trouble using modules for functions, but for classes it is not working
> > right so far, and I'm having trouble finding examples to follow.
> >
> Seems like parameterization is the thing you are missing. Change the
> __init__ method declaration to
>
> def __init__(self, master, text_1="OK", text_2="Cancel"):
> ...
>
> leaving the rest of the code the same. (Though I note your module also
> fails to define a "command1" and "command2" function, this may just be
> because you are only quoting partial code).
>
> Then in your main program create the object with
>
> myDialog = YesNo(master, "Yes", "No")
>
> Looks like you are new to Python - perseverre and you will pick it up
> quite quickly!
>
> regards
> Steve
> --
> Steve Holden +44 150 684 7255 +1 800 494 3119
> Holden Web LLC/Ltd http://www.holdenweb.com
> Skype: holdenweb http://holdenweb.blogspot.com
> Recent Ramblings http://del.icio.us/steve.holden
--
http://mail.python.org/mailman/listinfo/python-list
Re: Observation on "Core Python Programming"
John Coleman wrote: > Greetings, >My copy of the second edition of Chun's "Core Python Programming" > just arrived from Amazon on Friday. Who would you say the book is aimed at? Advanced programmers? I thought about getting it, but I'm not sure if it will be either 1) too much repetition of the basics I've already learned (which isn't necessarily a bad thing), or 2) too advanced for me right now. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Calling GNU/make from a Python Script
Efrat Regev wrote:
> 1. The script is not in the directory of the makefile, and changing the
> locations of either is not an option. Consequently, the makefile fails,
> since it can't find the targets/dependencies.
build_dir = "path/to/makefile"
cwd = os.getcwd() # get current directory
try:
os.chdir(build_dir)
os.system("make")
finally:
os.chdir(cwd)
> 2. After searching around, it seems that os.system(..) should be avoided
> if there's an alternative. Is there one in this case?
"make" is not an operating system service, no.
--
http://mail.python.org/mailman/listinfo/python-list
Re: wxPython changed ??
Jia Lu wrote: > Hi all. > I'm using wxPython 2.6.3.2-2 on FC 6. > I wrote a demo used 'self.Bind(xx)' but I got an error says: >" MyFrame instance has no attribute 'Bind' " > > I did that when I used FC 5 and it worked. > > Is new wxPy changed about the Bind method?? > > thanx > Please post the code. -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython - which is the better sizer to use with notebook
SPE - Stani's Python Editor wrote: > Chris Brat schreef: > >> Hi, >> >> What sizers do people use to >> - contain the notebook control in a Frame and, >> - contain the contents of a single page of the notebook. >> >> At the moment Im using a GridBagSizer for both but this seems to be >> overkill. >> Is a BoxSizer a better option? > > Yes, use box sizer if you have to place only one control or when you > need to place a row or column of controls. And you don't need to specify an orientation either (vertical or horizontal), since it doesn't matter. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I import a script with an arbitrary name ?
[EMAIL PROTECTED] wrote:
> I have a script responsible for loading and executing scripts on a
> daily basis. Something like this:
>
> import time
> t = time.gmtime()
> filename = t[0] + '-' + t[1] + '-' + t[2] + '.py'
> import filename
>
> So, I have a module with an arbitrary file name and I want to load it,
> and later access its function definitions.
execfile() is probably your best bet:
namespace = {}
execfile(filename, namespace)
namespace["function"](argument)
also see:
http://effbot.org/zone/import-string.htm#importing-by-filename
--
http://mail.python.org/mailman/listinfo/python-list
Re: codecs - where are those on windows?
GHUM wrote: > I stumbled apon a paragraph in python-dev about "reducing the size of > Python" for an embedded device: > > """ > In my experience, the biggest gain can be obtained by dropping the > rarely-used > CJK codecs (for Asian languages). That should sum up to almost 800K > (uncompressed), IIRC. > """ > > So, my question is: on Windows. where are those CJK codecs? Are they by > any chance included in the 1.867.776 bytes of python24.dll ? > > Best wishes, > > Harald If your installation directory is C:\Python25, then look in C:\Python25\lib\encodings -- http://mail.python.org/mailman/listinfo/python-list
Re: codecs - where are those on windows?
Paul Watson wrote:
>> So, my question is: on Windows. where are those CJK codecs? Are they by
>> any chance included in the 1.867.776 bytes of python24.dll ?
>
> If your installation directory is C:\Python25, then look in
>
> C:\Python25\lib\encodings
that's only the glue code. the actual data sets are provided by a bunch
of built-in modules:
>>> import sys
>>> sys.builtin_module_names
('__builtin__', '__main__', '_ast', '_bisect', '_codecs',
'_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp',
'_codecs_kr', '_codecs_tw', ...
--
http://mail.python.org/mailman/listinfo/python-list
Re: Calling GNU/make from a Python Script
Fredrik> build_dir = "path/to/makefile"
Fredrik> cwd = os.getcwd() # get current directory
Fredrik> try:
Fredrik> os.chdir(build_dir)
Fredrik> os.system("make")
Fredrik> finally:
Fredrik> os.chdir(cwd)
Or even:
os.system("make -C %s" % build_dir)
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Re: Observation on "Core Python Programming"
John Salerno wrote:
> John Coleman wrote:
> > Greetings,
> >My copy of the second edition of Chun's "Core Python Programming"
> > just arrived from Amazon on Friday.
>
> Who would you say the book is aimed at? Advanced programmers? I thought
> about getting it, but I'm not sure if it will be either 1) too much
> repetition of the basics I've already learned (which isn't necessarily a
> bad thing), or 2) too advanced for me right now.
>
> Thanks.
It strikes me as being aimed at intermediate programmers who don't have
much familiarity with Python. I bought it since my only other book on
Python ("Learning Python" by Lutz) is somewhat dated now and because I
find that I'm a slow learner and it usually takes me a couple of books
by independent authors to "get" a language. The publisher's page is
more informative than what you see on Amazon. You can see the table of
contents and read a sample chapter there to help you decide if the book
is for you:
http://vig.prenhall.com/catalog/academic/product/1,4096,0130260363,00.html
HTH
-John Coleman
--
http://mail.python.org/mailman/listinfo/python-list
Re: Observation on "Core Python Programming"
John Coleman wrote:
> John Salerno wrote:
> > John Coleman wrote:
> > > Greetings,
> > >My copy of the second edition of Chun's "Core Python Programming"
> > > just arrived from Amazon on Friday.
> >
> > Who would you say the book is aimed at? Advanced programmers? I thought
> > about getting it, but I'm not sure if it will be either 1) too much
> > repetition of the basics I've already learned (which isn't necessarily a
> > bad thing), or 2) too advanced for me right now.
> >
> > Thanks.
>
> It strikes me as being aimed at intermediate programmers who don't have
> much familiarity with Python. I bought it since my only other book on
> Python ("Learning Python" by Lutz) is somewhat dated now and because I
> find that I'm a slow learner and it usually takes me a couple of books
> by independent authors to "get" a language. The publisher's page is
> more informative than what you see on Amazon. You can see the table of
> contents and read a sample chapter there to help you decide if the book
> is for you:
> http://vig.prenhall.com/catalog/academic/product/1,4096,0130260363,00.html
>
> HTH
>
> -John Coleman
I just realized that I gave the link to the first edition site. The
second edition site doesn't give a sample chapter (but does give the
complete preface) and still provides a good feel for the book:
http://vig.prenhall.com/catalog/academic/product/0,1144,0132269937,00.html
Sorry for any confusion
-John Coleman
--
http://mail.python.org/mailman/listinfo/python-list
Re: IE7 skulduggery?
Found fix for this at Mozilla: http://kb.mozillazine.org/Default_browser Apparently, even though it LOOKS and ACTS like Firefox is still your default browser after an IE7 upgrade, it's not. To fix, you must run: firefox.exe -silent -nosplash -setDefaultBrowser Which also fixes the webbrowser. py problem. At least so far. rd -- http://mail.python.org/mailman/listinfo/python-list
Re: Observation on "Core Python Programming"
John Coleman wrote:
> John Coleman wrote:
>> John Salerno wrote:
>>> John Coleman wrote:
Greetings,
My copy of the second edition of Chun's "Core Python Programming"
just arrived from Amazon on Friday.
>>> Who would you say the book is aimed at? Advanced programmers? I thought
>>> about getting it, but I'm not sure if it will be either 1) too much
>>> repetition of the basics I've already learned (which isn't necessarily a
>>> bad thing), or 2) too advanced for me right now.
>>>
>>> Thanks.
>> It strikes me as being aimed at intermediate programmers who don't have
>> much familiarity with Python. I bought it since my only other book on
>> Python ("Learning Python" by Lutz) is somewhat dated now and because I
>> find that I'm a slow learner and it usually takes me a couple of books
>> by independent authors to "get" a language. The publisher's page is
>> more informative than what you see on Amazon. You can see the table of
>> contents and read a sample chapter there to help you decide if the book
>> is for you:
>> http://vig.prenhall.com/catalog/academic/product/1,4096,0130260363,00.html
>>
>> HTH
>>
>> -John Coleman
>
> I just realized that I gave the link to the first edition site. The
> second edition site doesn't give a sample chapter (but does give the
> complete preface) and still provides a good feel for the book:
> http://vig.prenhall.com/catalog/academic/product/0,1144,0132269937,00.html
>
> Sorry for any confusion
>
> -John Coleman
>
Thanks very much.
--
http://mail.python.org/mailman/listinfo/python-list
checking if a sqlite connection and/or cursor is still open?
Is there a way to check if a SQLite connection and cursor object are still open? I took a look at the docs and the DB API but didn't see anything like this. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
create global variables?
Hi,
is there a simple way of creating global variables within a function?
ive tried simply adding the variables in:
def function(atom, Xaa, Xab):
Xaa = onefunction(atom)
Xab = anotherfunction(atom)
if i can give something like:
function('C')#where atom = 'C' but not necessarly include Xaa or Xab
i would like to recieve:
Caa = a float
Cab = another float
ive tried predefining Xaa and Xab before the function but they are
global values and wont change within my function. Is there a simple way
round this, even if i call the function with the variables ('C', Caa, Cab)?
..
some actual code:
# sample dictionaries
DS1v = {'C': 6}
pt = {'C': 12.0107}
def monoVarcalc(atom):
a = atom + 'aa'
Xaa = a.strip('\'')
m = atom + 'ma'
Xma = m.strip('\'')
Xaa = DS1v.get(atom)
Xma = pt.get(atom)
print Xma
print Xaa
monoVarcalc('C')
print Caa
print Cma
..
it seems to work but again i can only print the values of Xma and Xaa
?
Alistair
--
Dr. Alistair King
Research Chemist,
Laboratory of Organic Chemistry,
Department of Chemistry,
Faculty of Science
P.O. Box 55 (A.I. Virtasen aukio 1)
FIN-00014 University of Helsinki
Tel. +358 9 191 50392, Mobile +358 (0)50 5279446
Fax +358 9 191 50366
--
http://mail.python.org/mailman/listinfo/python-list
Re: IE7 skulduggery?
BartlebyScrivener wrote: > Found fix for this at Mozilla: > > http://kb.mozillazine.org/Default_browser > > Apparently, even though it LOOKS and ACTS like Firefox is still your > default browser after an IE7 upgrade, it's not. > > To fix, you must run: > > firefox.exe -silent -nosplash -setDefaultBrowser > > Which also fixes the webbrowser. py problem. > > At least so far. > > rd > > yes, annoying i know that this may not be related to python but occasionally when im using firefox under windows and /i think/ when i open IE7, firefox hangs and wont reopen until i restart. Is this likely to be anything related to IE7? -- Dr. Alistair King Research Chemist, Laboratory of Organic Chemistry, Department of Chemistry, Faculty of Science P.O. Box 55 (A.I. Virtasen aukio 1) FIN-00014 University of Helsinki Tel. +358 9 191 50392, Mobile +358 (0)50 5279446 Fax +358 9 191 50366 -- http://mail.python.org/mailman/listinfo/python-list
Re: create global variables?
Alistair King wrote:
> Hi,
>
> is there a simple way of creating global variables within a function?
>
>
Use the "global" statement within a function to bind a variable to a
global.
See http://docs.python.org/ref/global.html for details.
>>> def x():
... global g
... g = 123
...
>>> x()
>>> g
123
>>>
Gary Herron
> ive tried simply adding the variables in:
>
> def function(atom, Xaa, Xab):
> Xaa = onefunction(atom)
> Xab = anotherfunction(atom)
>
> if i can give something like:
>
> function('C')#where atom = 'C' but not necessarly include Xaa or Xab
>
> i would like to recieve:
>
> Caa = a float
> Cab = another float
>
> ive tried predefining Xaa and Xab before the function but they are
> global values and wont change within my function. Is there a simple way
> round this, even if i call the function with the variables ('C', Caa, Cab)?
> ..
>
> some actual code:
>
> # sample dictionaries
> DS1v = {'C': 6}
> pt = {'C': 12.0107}
>
> def monoVarcalc(atom):
> a = atom + 'aa'
> Xaa = a.strip('\'')
> m = atom + 'ma'
> Xma = m.strip('\'')
> Xaa = DS1v.get(atom)
> Xma = pt.get(atom)
> print Xma
> print Xaa
>
> monoVarcalc('C')
>
> print Caa
> print Cma
> ..
> it seems to work but again i can only print the values of Xma and Xaa
>
> ?
>
> Alistair
>
>
--
http://mail.python.org/mailman/listinfo/python-list
Re: create global variables?
Alistair King wrote: > Hi, > > is there a simple way of creating global variables within a function? > #module global: def f(atom): global a a=1 globals()[atom+'var']=2 def f(): a=b=1 globals().update(locals()) _global=sys.modules[__name__] def f(atom): _global.a = 1 setattr(_global,atom+'var', 2) # all/app global import myglobals def f(atom): myglobals.a=1 setattr(myglobals) your example application seems to point towards 'odd' use of these techniques. -robert -- http://mail.python.org/mailman/listinfo/python-list
Re: create global variables?
Alistair King wrote: > is there a simple way of creating global variables within a function? def foo(name): globals()[name] = "xxx" globals()[name + 'aa'] = "yyy" globals()[name + 'ab'] = "zzz" -- http://mail.python.org/mailman/listinfo/python-list
Re: create global variables?
Gary Herron wrote:
> Alistair King wrote:
>
>> Hi,
>>
>> is there a simple way of creating global variables within a function?
>>
>>
>>
> Use the "global" statement within a function to bind a variable to a
> global.
>
> See http://docs.python.org/ref/global.html for details.
>
>
>
def x():
> ... global g
> ... g = 123
> ...
>
x()
g
> 123
>
>
> Gary Herron
>
>
>
>
>
>> ive tried simply adding the variables in:
>>
>> def function(atom, Xaa, Xab):
>> Xaa = onefunction(atom)
>> Xab = anotherfunction(atom)
>>
>> if i can give something like:
>>
>> function('C')#where atom = 'C' but not necessarly include Xaa or Xab
>>
>> i would like to recieve:
>>
>> Caa = a float
>> Cab = another float
>>
>> ive tried predefining Xaa and Xab before the function but they are
>> global values and wont change within my function. Is there a simple way
>> round this, even if i call the function with the variables ('C', Caa, Cab)?
>> ..
>>
>> some actual code:
>>
>> # sample dictionaries
>> DS1v = {'C': 6}
>> pt = {'C': 12.0107}
>>
>> def monoVarcalc(atom):
>> a = atom + 'aa'
>> Xaa = a.strip('\'')
>> m = atom + 'ma'
>> Xma = m.strip('\'')
>> Xaa = DS1v.get(atom)
>> Xma = pt.get(atom)
>> print Xma
>> print Xaa
>>
>> monoVarcalc('C')
>>
>> print Caa
>> print Cma
>> ..
>> it seems to work but again i can only print the values of Xma and Xaa
>>
>> ?
>>
>> Alistair
>>
>>
>>
>
>
have tried:
def monoVarcalc(atom):
a = atom + 'aa'
Xaa = a.strip('\'')
m = atom + 'ma'
Xma = m.strip('\'')
global Xma
global Xaa
Xaa = DS1v.get(atom)
Xma = pt.get(atom)
print Xma
print Xaa
monoVarcalc('C')
print Caa
print Cma
...
where global Xma & Xaa are before and after any further functions
i get still get the error
Traceback (most recent call last):
File "DS1excessH2O.py", line 54, in ?
print Caa
NameError: name 'Caa' is not defined
--
Dr. Alistair King
Research Chemist,
Laboratory of Organic Chemistry,
Department of Chemistry,
Faculty of Science
P.O. Box 55 (A.I. Virtasen aukio 1)
FIN-00014 University of Helsinki
Tel. +358 9 191 50392, Mobile +358 (0)50 5279446
Fax +358 9 191 50366
--
http://mail.python.org/mailman/listinfo/python-list
How to convert " " in a string to blank space?
Is there any simple way to solve this problem? -- http://mail.python.org/mailman/listinfo/python-list
Re: enumerate improvement proposal
Ben Finney wrote: > > >>> def obstinate_economist_enumerate(items): > ... enum_iter = iter((i+1, x) for (i, x) in enumerate(items)) > ... return enum_iter iter is redundant here. def natural_enumerate_improvement(items, start=0): return ((i+start, x) for (i, x) in enumerate(items)) - Anders -- http://mail.python.org/mailman/listinfo/python-list
Re: How to convert " " in a string to blank space?
一首诗 wrote:
> Is there any simple way to solve this problem?
>>> myString = " "
>>> myString = myString.replace(" ", "")
--
http://mail.python.org/mailman/listinfo/python-list
Re: How to convert " " in a string to blank space?
Is this what you want?
py> s = 'This string contains two times - end'
py> print s.replace(' ', ' '*6)
This string containstwo times- end
see http://docs.python.org/lib/string-methods.html
On Oct 30, 6:26 pm, "一首诗" <[EMAIL PROTECTED]> wrote:
> Is there any simple way to solve this problem?
--
http://mail.python.org/mailman/listinfo/python-list
Re: How to convert " " in a string to blank space?
一首诗 wrote:
> Is there any simple way to solve this problem?
>
>
Yes, strings have a replace method:
>>> s = "abc def"
>>> s.replace(' ',' ')
'abc def'
Also various modules that are meant to deal with web and xml and such
have functions to do such operations.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
Re: How can I import a script with an arbitrary name ?
I had to do something like this a while back for a modular IRC bot that
I wrote.
__import__() will do the trick, however to avoid getting a cache of the
module I recomend doing something like...
mod = reload( __import__("%s-%s-%s" % ( t[0], t[1], t[2] ) ) )
[EMAIL PROTECTED] wrote:
> Hi all,
>
> I have a script responsible for loading and executing scripts on a
> daily basis. Something like this:
>
> import time
> t = time.gmtime()
> filename = t[0] + '-' + t[1] + '-' + t[2] + '.py'
> import filename
>
> So, I have a module with an arbitrary file name and I want to load it,
> and later access its function definitions.
> How can I do this ? In my example, the last line will obviously not
> work.
--
http://mail.python.org/mailman/listinfo/python-list
Re: How to convert " " in a string to blank space?
Oh, I didn't make myself clear.
What I mean is how to convert a piece of html to plain text bu keep as
much format as possible.
Such as convert " " to blank space and convert to "\r\n"
Gary Herron wrote:
> 一首诗 wrote:
> > Is there any simple way to solve this problem?
> >
> >
> Yes, strings have a replace method:
>
> >>> s = "abc def"
> >>> s.replace(' ',' ')
> 'abc def'
>
> Also various modules that are meant to deal with web and xml and such
> have functions to do such operations.
>
>
> Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
Re: Python 123 introduction
This is great! A excellent tutorial for somone who has prior experience in programming and is starting out in python. My friend keeps wanting me to teach him python, I think this would be the perfect link for him. Thanks. Jeremy Sanders wrote: > Here is a brief simple introduction to Python I wrote for a computing course > for graduate astronomers. It assumes some programming experience. Although > it is not a complete guide, I believe this could be a useful document for > other groups to learn Python, so I'm making it available for others to > download, and modify for their own needs (some of the content is site > specific). > > HTML version: > http://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/python_123/ > Postscript LaTeX output: > http://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/python_123.ps > PDF LaTeX output: > http://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/python_123.pdf > LaTeX source: > http://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/python_123.tex > > Jeremy > > -- > Jeremy Sanders > http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: create global variables?
Alistair King wrote:
> Hi,
>
> is there a simple way of creating global variables within a function?
>
> ive tried simply adding the variables in:
>
> def function(atom, Xaa, Xab):
> Xaa = onefunction(atom)
> Xab = anotherfunction(atom)
>
> if i can give something like:
>
> function('C')#where atom = 'C' but not necessarly include Xaa or Xab
>
> i would like to recieve:
>
> Caa = a float
> Cab = another float
>
> ive tried predefining Xaa and Xab before the function but they are
> global values and wont change within my function. Is there a simple way
> round this, even if i call the function with the variables ('C', Caa, Cab)?
> ...
>
> some actual code:
>
> # sample dictionaries
> DS1v = {'C': 6}
> pt = {'C': 12.0107}
>
> def monoVarcalc(atom):
> a = atom + 'aa'
> Xaa = a.strip('\'')
> m = atom + 'ma'
> Xma = m.strip('\'')
> Xaa = DS1v.get(atom)
> Xma = pt.get(atom)
> print Xma
> print Xaa
>
> monoVarcalc('C')
>
> print Caa
> print Cma
> ...
> it seems to work but again i can only print the values of Xma and Xaa
>
> ?
>
> Alistair
>
I suspect you are misusing the concept of a function. In most basic
cases, and I suspect your case applies just as well as most, a function
should take arguments and return results, with no other communication
between the calling code and the function itself. When you are inside
your function don't worry about the names of the variables outside. I'm
not sure exactly where your floats are coming from, but try something
like this:
>>> def monoVarCalc(relevant_data):
... float1 = relevant_data * 42.0
... float2 = relevant_data / 23.0
... return float1, float2
>>> C = 2001
>>> Caa, Cab = monoVarCalc(C)
>>> Caa
84042.0
>>> Cab
87.0
Notice that you don't need to use the variable C (or much less the
string "C", inside monoVarCalc at all. It gets bound to the name
relevant_data instead.
Also, if you are going to have a lot of these little results lying
around, (Cab, Cac ... Czy, Czz), you might consider making them a list
or a dictionary instead. I won't tell you how to do that, though. The
online tutorial has plenty of information on that.
http://docs.python.org/tut/tut.html
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
Re: Observation on "Core Python Programming"
(warning: LONG reply) thanks to those above for the kind remarks. tackling comments and questions, not quite in chronological order. :-) > Who would you say the book is aimed at? Advanced programmers? this book is targeted towards technical professionals already literate in another high-level language who wants to pick up Python as quickly as possible. it is not a topical coverage of a programming language's features. you know how after learning a new language, it takes a few months to really "feel comfortable" enough to *not* pick up a book in order to commence writing code? my goal is to reduce that time period while provide the reader a comprehensive understanding of how the standard types work, esp. in their relationship to Python's memory model. it is my belief that a solid foundation here will reduce or eliminate any potential bugs you would've written had you read a more conventional introductory text. > What really jumped out at me is an interesting feature about how > it sequences its topics, namely, (user-defined) functions are not > introduced until chapter 11, fully 400 pages into the book. i guess i found this post quite interesting because there is such a focus on "what should be introduced when." the purpose of chapter 2 (getting started) is to proxy for the standard "introduction to programming X" book. if you read it, you should be able to "get started in Python" immediately. you have enough info on functions to start coding and probably don't need var args, decorators, or any of that stuff yet. the chapter on functions occur later because most of the time, what we've shown you in "getting started" is enough to, ummm..., get you started, and that all successive chapters are meant to dive more deeply into each area. > seems to confirm the "batteries are included" philosophy of > Python. Perhaps there is less need to learn how to roll your > own batteries as soon as possible. this is definitely one of the hallmarks of the language. the current user base already knows this... it's just more difficult to get this out there to the general programming populus, esp. when there are already so many languages starting with "P". :-) > The revenge of lambdas. Will they stay or will they go?" ;-) they will stay. ;-) > am interested in seeing the extend to which Python is genuinely > "multi-paradigm" - able to blend the functional and imperative > (and OO) paradigms together. this comes from guido himself. he "wants you to be able to see the forest through the trees." i see Python as a "greatest hits" of many computer programming languages. for our benefit, he's given us the best stuff. > I cant' exactly figure out why yet, but he has a way of explaining > something, like, say, decorators, that in minimal words elucidates > for me the intent behind why they are useful. That helps me > understand how they work. "Python fits your brain." (bruce eckel) i don't see why python should have a monopoly on your brain. i want me share too. ;-) the thing that makes writing a pleasurable is when the language has so much to offer. i use this book in teaching my python courses, and the book mirrors my lecturing style. i suppose that rather than a dry college textbook, i'd rather write in a way as if i was having a conversation with you, or if you were actually sitting there attending one of my courses. readers (as well as course attendees) have remarked how questions they may come up with as they are learning a topic are answered in the next section or chapter (or 3-4 presentation slides) as the case may be. > The second edition site doesn't give a sample chapter (but > does give the complete preface) ahhh, the secret here is that you need to look in the right place. "prentice hall"s web page doesn't have it, but PHPTR's does, even if they are the same publishing house. for some reason, we've got the featured book of the month!! just go to http://phptr.com and click the book's link there. you'll find: - book's description - table of contents - preface - sample chapter (getting started, chapter 2!) - index the last three are in PDF format. if for some reason, october ends and it's gone from the front page, here is a direct link: http://phptr.com/title/0132269937 thanks to everyone for their support, esp. my excellent technical reviewers for keeping me honest! please send comments, suggestions, corrections, and other feedback to me. i am happy to hear about any issues you find in the book -- everything. it doesn't matter if it is the smallest grammatical edit, errors in the code, or just plain wrong or misleading information. don't believe everything you read! (sometimes writing at 2, 3, and 4a in the morning does something to your writing when you're trying to tackle a publisher's deadlines.) keep checking the book's errata page at http://corepython.com all book correspondence should go to corepython at yahoo dot com. cheers! -- wesley - - - - - - - - - - - - - - - -
Re: Python 123 introduction
[EMAIL PROTECTED] wrote: > This is great! A excellent tutorial for somone who has prior experience > in programming and is starting out in python. My friend keeps wanting > me to teach him python, I think this would be the perfect link for him. I'm glad you think it is useful. It needs a bit of cleaning up as it assumes things such as python being in /usr/local/bin... I may try to improve this later. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: How to convert " " in a string to blank space?
On Oct 30, 6:44 pm, "一首诗" <[EMAIL PROTECTED]> wrote:
> Oh, I didn't make myself clear.
>
> What I mean is how to convert a piece of html to plain text bu keep as
> much format as possible.
>
> Such as convert " " to blank space and convert to "\r\n"
>
Then you can explore the parser,
http://docs.python.org/lib/module-HTMLParser.html, like
#!/usr/bin/env python
from HTMLParser import HTMLParser
parsedtext = ''
class Parser(HTMLParser):
def handle_starttag(self, tag, attrs):
if tag == 'br':
global parsedtext
parsedtext += '\\r\\n'
def handle_data(self, data):
global parsedtext
parsedtext += data
def handle_entityref(self, name):
if name == 'nbsp':
pass
x = Parser()
x.feed('An text')
print parsedtext
> Gary Herron wrote:
> > 一首诗 wrote:
> > > Is there any simple way to solve this problem?
>
> > Yes, strings have a replace method:
>
> > >>> s = "abc def"
> > >>> s.replace(' ',' ')
> > 'abc def'
>
> > Also various modules that are meant to deal with web and xml and such
> > have functions to do such operations.
>
> > Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
Re: How to convert " " in a string to blank space?
一首诗 wrote:
> Is there any simple way to solve this problem?
corresponds to a non-breaking space, chr(160). if you're only
dealing with this specific XML/HTML entity, you can do
text = text.replace(" ", " ")
or
text = text.replace(" ", chr(160))
to handle arbitrary entities and character references, pass the data
through an HTML or XML parser, or use something like:
http://effbot.org/zone/re-sub.htm#unescape-html
--
http://mail.python.org/mailman/listinfo/python-list
Re: create global variables?
Wojciech Muła wrote: >> is there a simple way of creating global variables within a function? > > def foo(name): > globals()[name] = "xxx" > globals()[name + 'aa'] = "yyy" > globals()[name + 'ab'] = "zzz" that kind of coding is punishable by law in some jurisdictions. -- http://mail.python.org/mailman/listinfo/python-list
Re: Calling GNU/make from a Python Script
[EMAIL PROTECTED] wrote:
> Fredrik> build_dir = "path/to/makefile"
>
> Fredrik> cwd = os.getcwd() # get current directory
> Fredrik> try:
> Fredrik> os.chdir(build_dir)
> Fredrik> os.system("make")
> Fredrik> finally:
> Fredrik> os.chdir(cwd)
>
> Or even:
>
> os.system("make -C %s" % build_dir)
OP specified GNU make, so that works fine, but make sure you're not
going to need to use it with another make before settling on that
alternative. Frederik's works with more versions of make.
--
http://mail.python.org/mailman/listinfo/python-list
Re: Python 123 introduction
dakman> This is great! A excellent tutorial for somone who has prior dakman> experience in programming and is starting out in python. My dakman> friend keeps wanting me to teach him python, I think this would dakman> be the perfect link for him. I'm not trying to minimize Jeremy's efforts in any way, but how is his tutorial a significant improvement over the original (http://www.python.org/doc/current/tut/)? Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Calling GNU/make from a Python Script
>> os.system("make -C %s" % build_dir)
>> OP specified GNU make, so that works fine, but make sure you're not
>> going to need to use it with another make before settling on that
>> alternative. Frederik's works with more versions of make.
Understood. That was the only reason I suggested it.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Re: ANN: SPE 0.8.3.c Python IDE editor
Hi Stani, Not able to reach Berlios. The SourceForge page does not have the Windows installer. Any ideas when it will be available? Thanks. Chris Bernard wrote: > thanks Stani! > > SPE - Stani's Python Editor wrote: > > This is a maintenance release (mostly bug fixing) to prove that SPE is > > alive and well! In case you are using wxPython2.7 you'll need to > > upgrade to this release. Submitted patches will be reviewed and > > included if approved for next release. Thanks for all your patient > > support and continuing donations. > > > > The SPE 0.8.2.a release got downloaded 110550 times on berlios and > > sourceforge together. Not bad. This means SPE has not seen an update > > for a while or is getting very popular. Maybe both ;-) > > > > Installers are available for python 2.3, 2.4 and 2.5 for Windows and as > > a rpm including wxPython. Other operating systems can choose the > > no-setup.zip or targ.gz archives. A .deb archive is being prepared for > > Debian Linux systems such as Ubuntu. > > > > wxGlade is unfortunately not compatible with wxPython2.7. So if you > > want to use, you'll need wxPython2.6. > > > > :**Fixes**: > > > > - output is now done with a fixed font > > - uml.py is now again a stand alone demo > > - upgraded and fixed wxGlade > > - fixed for wxPython2.7 (and still backwards compatible with > > wxPython2.6) > > - updated NotebookCtrl > > > > :**Contributors**: > > > > - Andrea Gavana (NoteBookCtrl) > > - Alberto Griggio (wxGlade) > > - Michael Foord (python 2.3 + 2.5 releases for windows) > > > > :**Donations**: > > > > The development of SPE is driven by donations. Each of these donors > > receives the pdf manual in thanks for their support of SPE. > > > > - James Carroll (60 euro) > > - John DeRosa (50 euro) > > - Fumph LLC (50 euro) > > - Ronald Britton (40 euro) > > - David Downes (40 euro) > > - Jorge Carrillo (40 euro) > > - Nicolas Berney (40 euro) > > - Francois Schnell (30 euro) > > - Olivier Cortes (30 euro) > > - Ayrshire Business Consulting Limited (30 euro) > > - Chris White (25 euro) > > - Thomas Wengerek (20 euro) > > - John Rudolph (20 euro) > > - Michael O'Keefe (20 euro) > > - Michael Brickenstein (20 euro) > > - Richard Walkington (20 euro) > > - Oliver Tomic (20 euro) > > - Jose Maria Cortes Arnal (20 euro) > > - Jeffrey Emminger (20 euro) > > - Eric Pederson (20 $) > > - Charles Bosson (15 euro) > > - Angelo Caruso (15 euro) > > - Chris Hengge (15 $) > > - Loïc Allys (15 euro) > > - Marcin Chojnowski (15 euro) > > - Boris Krasnoiarov (15 euro) > > - Paul Furber (15 euro) > > - Gary Robson (15 euro) > > - Ralf Wieseler (15 euro) > > - Samuel Schulenburg (10 euro) > > - Leland Hulbert II (10 euro) > > - Javier De La Mata Viader (10 euro) > > - Dorman Musical Instruments (10 euro) > > - Jaroslaw Sliwinski (10 euro) > > - Alessandro Patelli (10 euro) > > - James Pretorius (10 euro) > > - Richard Wayne Garganta (10 euro) > > - Maurizio Bracchitta (10 euro) > > - Larry Lynch (10 euro) > > - Kay Fricke (10 euro) > > - Henrik Binggl (10 euro) > > - Jerol Harrington (10 euro) > > - Victor Adan (10 euro) > > - James Fuqua (10 euro) > > - Christian Seberino (5 euro) > > - Serge Smeesters (5 euro) > > - Jarek Libert (5 euro) > > - Robin Friedrich (5 euro) > > - Udo Rabe (5 euro) > > - Roch Leduc (4 euro) > > - Rha Diseno y Desarrollo (2 euro) > > > > :**Installation**: > > > > - See http://pythonide.stani.be/manual/html/manual2.html > > > > :**Development**: > > > > - http://developer.berlios.de/mail/?group_id=4161 > > > > About SPE: > > SPE is a python IDE with auto-indentation, auto completion, call tips, > > syntax coloring, uml viewer, syntax highlighting, class explorer, > > source index, auto todo list, sticky notes, integrated pycrust shell, > > python file browser, recent file browser, drag&drop, context help, ... > > Special is its blender support with a blender 3d object browser and its > > ability to run interactively inside blender. Spe integrates with XRCed > > (gui > > designer) and ships with wxGlade (gui designer), PyChecker (source > > code doctor), Kiki (regular expression console) and WinPdb (remote, > > multi-threaded debugger). > > > > The development of SPE is driven by its donations. Anyone who donates > > can ask for an nice pdf version of the manual without ads (74 pages). -- http://mail.python.org/mailman/listinfo/python-list
scared about refrences...
I'm really worried that python may is doing some things I wasn't expecting... but lets see... if I pass a list to a function def fn(myList): and in that function I modify an element in the list, then does the callers list get modied as well. def fn(list): list[1] = 0 myList = [1, 2, 3] print myList fn(myList) print myList >>> [1,2,3] >>> [1,0,3] How can I avoid this? In this case this is a really simplified example but the effects are the same... How do I specify or create deep copies of objects that may contain other objects that may contain other object that may contain other objects -- http://mail.python.org/mailman/listinfo/python-list
