sub typing built in type with common attributes. Am I right?

2008-07-18 Thread King
I am new to python and getting into classes. Here I am trying to create subtype of built in types with some additional attributes and function. 'Attributes' is the main class and holds all the common attributes that requires by these subtypes. This is what I came out with. I need to know whether ev

Re: sub typing built in type with common attributes. Am I right?

2008-07-18 Thread King
My mistake... The correct __slots__ is like: __slots__ = ['_Attribute_name', '_Attribute_type', '_Attribute_range', 'label'] Could you please suggest an alternative or code improvement for the matter. Prashant -- http://mail.python.org/mailman/listinfo/python-list

Re: sub typing built in type with common attributes. Am I right?

2008-07-18 Thread King
Thanks Michaud, You have actually solved an another problem by 'make_subtype_with_attr' function. What actually I am trying to do here is to create custom types using built in types to use in my application. For example , float2, float3, color, vector, point, normal, matrix etc. The reason being

Safe guard .pyc files

2008-07-21 Thread King
After google a lot I didn't find any way to safe guard .pyc files from decompilation. One way I can think of is to wrap important functions/classes as a libraby using SWIG/PyRex, but again is going to be a lot more of work and doesn't sound good. any body out there has done something for this? --

instance comparison

2008-07-24 Thread King
I am facing a problem where I am really confused about it. I am trying to compare to instances using: if inst1 == inst2 These instances have a overridden method __str__ which returns same string. The condition result is true although they are different instances. If I use: if id(inst1) == id(

Re: instance comparison

2008-07-24 Thread King
The only methods I do have in class is __init__ and __str__. How ever inst1 and inst2 is coming from a dictionary where I stored them with a unique id. inst1 = stored[id] inst2 = stored[id] Is this makes a difference? I will rip down the piece of code giving me problem and post. -- http://mail.p

Re: instance comparison

2008-07-24 Thread King
No, The the class is not subclass of another one. Problem still persist. The code is pretty huge and I am trying to post the information as clear as possible. -- http://mail.python.org/mailman/listinfo/python-list

object persistency, store instances relationship externally

2008-07-24 Thread King
This is a new test for object persistency. I am trying to store the relationship between instances externally. It's not working as expected. May be I am doing it in wrong way. Any suggestions? import shelve class attrib(object): pass class node(object): def __init__(self): self.

Re: 2d graphics - what module to use?

2008-07-25 Thread King
Use python's default GUI tkinter's drawing functions or you can use wxPython GUI kit or you can use pyopengl. If you are only interested to draw sin waves or math functions that you should give try to matlab at www.mathworks.com -- http://mail.python.org/mailman/listinfo/python-list

Re: object persistency, store instances relationship externally

2008-07-25 Thread King
Thanks Fredrik, It helped a lot and this is really an amazing this I have discovered today. :-)) -- http://mail.python.org/mailman/listinfo/python-list

Read .txt file like .py file

2008-07-27 Thread King
I have a text file and contents are: Help=""" Code is written by xteam. """ value = 0.0 How do I read this file like python syntax. What I mean is first readline operation should return complete declaration of 'Help' variable. If I evaluate this string then it should create a 'Help' variable wit

Re: Read .txt file like .py file

2008-07-28 Thread King
Well, I have a look to into compiler module and gave it a try using compiler.parseFile and compiler.walk but I haven't got what I need here. -- http://mail.python.org/mailman/listinfo/python-list

Multiline text in XML file

2008-08-02 Thread King
Is there any other way to define multiline text in a XML file: -- http://mail.python.org/mailman/listinfo/python-list

python subprocess know how

2008-08-31 Thread King
Hi, I am using subprocess module to execute a command and print results back. startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW my_process = subprocess.Popen(cmnd, startupinfo=startupinfo) print repr(my_process.communicate()[0]) This code executes on p

what is next for you, a great opportunity waiting for

2008-09-03 Thread king
www.hrconsultant.tk -- http://mail.python.org/mailman/listinfo/python-list

conditional __init__

2009-11-02 Thread King
class A(object): def __init__(self): pass def printme(self): print "I am A" class B(object): def __init__(self): pass def printme(self): print "I am B" class K(A, B): def __init__(self, value=0): if value == 0: A.__init__(sel

object indexing and item assignment

2009-11-13 Thread King
class MyFloat(object): def __init__(self, value=0.): self.value = value def set(self, value): self.value = value def get(self): return self.value class MyColor(object): def __init__(self, value=(0,0,0)): self.value = (MyFloat(value[0]),

object serialization as python scripts

2009-11-13 Thread King
I have looked upon various object serialization de-serialization techniques. (shelve, pickle, anydbm, custom xml format etc.) What I personally feel that instead of all these methods for saving the objects it would be easier to save the data as python scripts itself. In this case, loading the data

Re: object serialization as python scripts

2009-11-13 Thread King
> Why is it easier than the above mentioned - they are *there* (except the > custom xml), and just can be used. What don't they do you want to do? > > Other than that, and even security issues put aside, I don't see much > difference between pickle and python code, except the latter being more > ve

Get attribute this way

2009-11-16 Thread King
Python's getattr, setattr and __getattribute__ commands works fine with python types. For example: print o.__getattribute__("name") print getattr(o, "name") This is the easiest way to get an attribute using a string. In my case the "Node" class load/creates all the attributes from a xml file. Exam

Re: Get attribute this way

2009-11-16 Thread King
Writing/Reading data to xml is not a problem. The problem is when I have to write to attributes in xml, where a connections has been established. XML: While reading back I have to convert both source and destination strings into object so that I can call connections function using source and targ

Re: Get attribute this way

2009-11-16 Thread King
"eval" can solve this problem right away but I am concerned about security issues. If not "eval" could you suggest something more efficient way. It won't be a big deal to change the format as application is still at development stage? Thanks Prashant Python 2.6.2 Win XP 32 -- http://mail.python.

No duplicate variable

2009-11-20 Thread King
class A(object): def __init__(self, value=0.): self.value = value class B(A): def __init__(self, value=None): A.__init__(self) self.value = value obj = B() When "B" initializes, it overwrite "value" variable of "A". How do I make sure that no variable should not b

Python compiled modules are too big in size (even after strip)

2010-04-27 Thread King
Hi, I have just compiled python 2.6.5 from sources on ubuntu "hardy" 8.04. I have used a simple script to do everything in one go: ./configure --enable-shared make make install Python is compiled and installed successfully. However the modules(_socket.so, _random.so etc) are two big in terms of

Re: Python compiled modules are too big in size (even after strip)

2010-04-27 Thread King
Hi Jon, I do have a limited skill sets in c/c++ and also new on linux. I think I am missing some flags or anything when I am compiling python from sources. Still hoping that some one point me out the missing link. Cheers Prashant -- http://mail.python.org/mailman/listinfo/python-list

executable builder

2010-07-01 Thread King
Hi, I am trying to build python a cross platform python executable builder to deploy python app. I tried various tools such as py2exe, pyinstaller, cx_freeze but some how they are not upto the mark except py2exe. Unfortunately py2exe is working only on windows based systems. The task is divide in

simple python deployment tool

2010-07-08 Thread King
Hi, I am writing a python package deployment tool for linux based platforms. I have tried various existing tool sets but none of them is up to the mark and they have their own issues. Initially I'll start with simple approach. 1. Find all the modules/packages and copy to "lib" directory. 2. Find

Re: simple python deployment tool

2010-07-08 Thread King
On Jul 8, 2:21 pm, Alexander Kapps wrote: > King wrote: > > Hi, > > > I am writing a python package deployment tool for linux based > > platforms. I have tried various existing > > tool sets but none of them is up to the mark and they have their own > > issu

zipimport (.pyd & .so) files.

2010-07-09 Thread King
Hi, The 'zipimport' modules can only import (.py & .pyc) files from a zip file and doesn't support importing .pyd & .so files. Recently I was examining the code of Py2Exe (python package deployment tool) and I have found that it is using a module 'zipextimporter' that can import dlls(.pyd) modules

Re: zipimport (.pyd & .so) files.

2010-07-10 Thread King
I think I am trying to open a can of worms. It's better to leave the idea for now. Prashant -- http://mail.python.org/mailman/listinfo/python-list

Node based architecture

2010-07-12 Thread King
Hi, I am planning to build a generic node based framework using python. I would start with a simple image editing application. I hope that experienced users understands what am I trying to say here. In simple words: LoaderNode : Load Image from disk OperatorNode : Performs a specific task on data

Compile python executable only for package deployment on Linux

2010-07-20 Thread King
Hi, I have created a simple tool(python script) that creates a self sufficient package ready for deployment. Current implementation is based on shell scripting to set environment for the app and finally execute "python main.py". I am planning to convert "main.py" into an executable. The plan is t

Re: Compile python executable only for package deployment on Linux

2010-07-20 Thread King
Hi Stefan, Well, the idea is similar to package tools like pyinstaller or cx_freeze. There approach is slightly different then what I intend to do here. You have to pass the name of the script to python executable("python main.py") in order to execute it. What I mean here is to create python exec

Undo-Redo, copy instance, custom events and a problem

2010-07-25 Thread King
Hi, I am developing an app using wxPython. The Undo-Redo implementation is based on storing pre & post state of an attribute. You store the instance before changing the value and store the instance after changing the values. While undoing or redoing, you copy/replace the current state with stored o

relative imports and sub-module execution

2010-09-27 Thread King
Hi, After reading couple of docs and articles, I have implemented a simple test package with nested modules. When running "main.py", everything is working fine. Some of my sub- modules has some small test routines for debug purpose. It's because I am using relative package imports at the top, I am

Re: Python Gotcha's?

2012-04-05 Thread Iain King
A common one used to be expecting .sort() to return, rather than mutate (as it does). Same with .reverse() - sorted and reversed have this covered, not sure how common a gotcha it is any more. Iain On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote: > Greetings, > > I'm going to

Re: tiny script has memory leak

2012-05-17 Thread Iain King
On Friday, 11 May 2012 22:29:39 UTC+1, gry wrote: > sys.version --> '2.6 (r26:66714, Feb 21 2009, 02:16:04) \n[GCC 4.3.2 > [gcc-4_3-branch revision 141291]] > I thought this script would be very lean and fast, but with a large > value for n (like 15), it uses 26G of virtural memory, and things

problem python

2012-06-06 Thread Tom King
hi im new in python and i have a problem about when i type python in my command line console i get an error message  'import site' failed; use -v for traceback Python 2.4.3 (#1, May  5 2011, 18:44:23) [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2 Type "help", "copyright", "credits" or "lice

Re: use of index (beginner's question)

2011-04-28 Thread Iain King
On Apr 28, 2:45 am, Chris Angelico wrote: > Incidentally, you're allowed to put the comma on the last item too: > >  lists = [ >   ['pig', 'horse', 'moose'], >   ['62327', '49123', '79115'], > ] > > Often makes for easier maintenance, especially when you append > array/list elements. > > Chris Ang

Re: Code Review

2011-05-25 Thread Iain King
On May 25, 2:44 pm, ad wrote: > On May 25, 4:06 am, Ulrich Eckhardt > wrote: > > > > > ad wrote: > > > Please review the code pasted below. I am wondering what other ways > > > there are of performing the same tasks. > > > On a unix system, you would call "find" with according arguments and then

Re: How can I set the size of a window with tkinter?

2005-09-28 Thread Iain King
Tor Erik Sønvisen wrote: > Hi > > I create a canvas that is to big for the default window-size, so it gets cut > to fit... > How can I increase the window-size to make sure the canvas fits? > > regards tores root=Tk() root.minsize(300,300) root.geometry("500x500") will limit the window to be at

Re: backreferences

2005-09-28 Thread Iain King
Amy Dillavou wrote: > Can someone help me with understanding how python uses backreferences? > I need to remember the item that was last matched by the re engine but i > cant seem to understand anything that I find on backreferences. if I > want to access the last match do i use \number or is the

Re: [PIL]: Question On Changing Colour

2005-10-14 Thread Iain King
Andrea Gavana wrote: > I have tried your solution, Terry: > > > new_hue # your 'basic color', just the hue part > > rgb_base # color from the basic button image > > rgb_new # the new color you want to replace rgb_base with > > > > rgb_new = hsv_to_rgb( (new_hue,) + rgb_to_hsv(rgb_base)[1:]) >

Re: Python vs Ruby

2005-10-24 Thread Iain King
Tom Anderson wrote: > On Fri, 21 Oct 2005, vdrab wrote: > > > You can tell everything is well in the world of dynamic languages when > > someone posts a question with nuclear flame war potential like "python > > vs. ruby" and after a while people go off singing hymns about the beauty > > of Scheme

Re: more than 100 capturing groups in a regex

2005-10-25 Thread Iain King
Fredrik Lundh wrote: > Joerg Schuster wrote: > > > I just want to use more than 100 capturing groups. > > define "more" (101, 200, 1000, 10, ... ?) > > The Zero-One-Infinity Rule: http://www.catb.org/~esr/jargon/html/Z/Zero-One-Infinity-Rule.html Iain -- http://mail.python.org/mailman/li

Re: more than 100 capturing groups in a regex

2005-10-25 Thread Iain King
Steven D'Aprano wrote: > On Tue, 25 Oct 2005 05:17:52 -0700, Iain King wrote: > > > > > Fredrik Lundh wrote: > >> Joerg Schuster wrote: > >> > >> > I just want to use more than 100 capturing groups. > >> > >> define "mo

Re: more than 100 capturing groups in a regex

2005-10-25 Thread Iain King
Steven D'Aprano wrote: > On Tue, 25 Oct 2005 06:30:35 -0700, Iain King wrote: > > > > > Steven D'Aprano wrote: > >> On Tue, 25 Oct 2005 05:17:52 -0700, Iain King wrote: > >> > >> > > >> > Fredrik Lundh wrote: > >&

Re: more than 100 capturing groups in a regex

2005-10-26 Thread Iain King
Fredrik Lundh wrote: > Iain King wrote: > > > Anyway, back to the OP: in this specific case, the cap of 100 groups in > > a RE seems random to me, so I think the rule applies. > > perhaps in the "indistinguishable from magic" sense. > > if you want to kno

Re: Looping Problem (Generating files - only the last record generates a file)

2005-10-26 Thread Iain King
[EMAIL PROTECTED] wrote: > Hello All, > > I have a problem with the program that should generate x number of txt > files (x is the number of records in the file datafile.txt). > > Once I execute the program (see below) only one file (instead of x > files) is created. The file created is based on t

Re: Microsoft Hatred FAQ

2005-10-26 Thread Iain King
David Blomstrom wrote: > A bit off topic, but it amazes me that people in the > web design/Internet industry don't take a more active > stance against Microsoft. > > Think about it: The health care industry has been > privatized in the U.S. I spent sixteen years in > education, another institution

Double replace or single re.sub?

2005-10-26 Thread Iain King
I have some code that converts html into xhtml. For example, convert all tags into . Right now I need to do to string.replace calls for every tag: html = html.replace('','') html = html.replace('','') I can change this to a single call to re.sub: html = re.sub('<([/]*)i>', r'<\1em>', html) W

Re: Top-quoting defined [was: namespace dictionaries ok?]

2005-10-26 Thread Iain King
Duncan Booth wrote: > James Stroud wrote: > > > On Tuesday 25 October 2005 00:31, Duncan Booth wrote: > >> P.S. James, *please* could you avoid top-quoting > > > > Were it not for Steve Holden's providing me with a link off the list, > > I would have never known to what it is you are referring. I

Re: Double replace or single re.sub?

2005-10-26 Thread Iain King
Mike Meyer wrote: > "Iain King" <[EMAIL PROTECTED]> writes: > > > I have some code that converts html into xhtml. For example, convert > > all tags into . Right now I need to do to string.replace calls > > for every tag: > > > >

Re: Microsoft Hatred FAQ

2005-10-27 Thread Iain King
or not? > > The real reason PCs were not available without Windows was because not > enough people wanted them that way to justify setting up a business to > provide them that way, and Microsoft was not going to let a business > parasitically use Windows to build a business that tou

Re: Microsoft Hatred FAQ

2005-10-27 Thread Iain King
David Schwartz wrote: > Roedy Green wrote: > > > The particular way MS threatened to put me out of business was by > > threatening to arm twist all wholesalers to refuse to sell MS product > > to me, which any retailer needed to survive in those days. > > Right, I get that. You owed your entir

Re: need help extracting data from a text file

2005-11-07 Thread Iain King
[EMAIL PROTECTED] wrote: > Hey there, > i have a text file with a bunch of values scattered throughout it. > i am needing to pull out a value that is in parenthesis right after a > certain word, > like the first time the word 'foo' is found, retrieve the values in the > next set of parenthesis (ba

Re: need help extracting data from a text file

2005-11-07 Thread Iain King
[EMAIL PROTECTED] wrote: > this is cool, it is only going to run about 10 times a day, > > the text is not written out like foo(bar) its more like > foo blah blah blah (bar) > then I guess you worked this out, but just for completeness: keywordPos = textfile.find("foo") start = textfile.find("("

PNG processing with only base python install

2005-11-08 Thread Iain King
My web server supports python CGI scripts, but I can't install anything else there - I can just use what they've provided. I want to process some PNG images - any ideas how I can do this with just the basic modules? Is there an image processing module written purely in Python? Iain -- http://m

Re: How to paste python code on wordpress?

2005-11-22 Thread Iain King
Dan Lowe wrote: > On Nov 22, 2005, at 12:30 AM, could ildg wrote: > > > Thank you~ > > It works! > > but how can paste "<" and ">", please? > > these 2 symbols will also confuse wordpress and I can't publish > > what I want. > > Replace < with < > > Replace > with > > > (where those abbreviations

Re: Documentation suggestions

2005-12-07 Thread Iain King
> The library reference has so many modules that the table of contents > is very large. Again, not really a problem that we can fix; splitting > it up into separate manuals doesn't seem like it would help. I like the Global Module Index in general - it allows quick access to exactly what I want.

Re: Documentation suggestions

2005-12-07 Thread Iain King
[EMAIL PROTECTED] wrote: > >> The library reference has so many modules that the table of contents > >> is very large. Again, not really a problem that we can fix; > >> splitting it up into separate manuals doesn't seem like it would > >> help. > > Iain> I like the Global Module I

Re: Documentation suggestions

2005-12-07 Thread Iain King
[EMAIL PROTECTED] wrote: > Iain> Well, the point of the GMI is to lookup whatever module you are > Iain> currently having to use for the first time (at least it is for > Iain> me). Giving easy access to the modules I've already had to look > Iain> up (because they are common) doesn't

socket setdefaulttimeout

2005-08-12 Thread Sheila King
ossible? Thanks for any tips. Example code follows signature... -- Sheila King http://www.thinkspot.net/sheila/ #!/usr/local/bin/python2.4 import socket import sys from time import time, asctime, localtime socket.setdefaulttimeout(.1) debugfile = "socketdebug.txt" def debug(data

Re: socket setdefaulttimeout

2005-08-12 Thread Sheila King
I do note that the setdefaulttimeout is accomplishing something in my full program. I am testing some error handling in the code at the moment, and am raising an exception to make the code go into the "except" blocks... The part that sends an error email notice bombed due to socket timeout. (well

Re: socket setdefaulttimeout

2005-08-12 Thread Sheila King
On 08/12/2005 22:37:22 Bryan Olson <[EMAIL PROTECTED]> wrote: > Sheila King wrote: >> I'm doing DNS lookups [...] it is important to make sure that the socket >> doesn't just hang there waiting for a response. >> After a recent system upgrade to Python 2.

Re: socket setdefaulttimeout

2005-08-13 Thread Sheila King
Bryan: Thanks for the tips/suggestion. I will definitely look into that. (It will be my first foray into coding with threads...I do appreciate that you've laid a great deal of it out. I will certainly refer to my references and do substantial testing on this...) Thanks! -- Sheila King

Re: overload builtin operator

2005-08-29 Thread Iain King
Robert Kern wrote: > Shaun wrote: > > Thanks for your replies, obviously this isn't a simple thing to do so > > I'll take a different tack. > > > > The exact problem I am trying to solve here is to avoid the > > ZeroDivisionError in division. > > I have c++ code which delegates to python to calcul

Re: how to join two Dictionary together?

2005-08-30 Thread Iain King
DENG wrote: > dict1={...something...} > > dict2={...somethind else ..} > > dict1 + dict2 > > > that's does works ..:(, it's not like List... > > > anyone can tell me how to get it? > Uh, I'm just learning python too, so there may be a much simpler way to do this, but you could: dict3 = {} for k,

Re: how to join two Dictionary together?

2005-08-30 Thread Iain King
Iain King wrote: > DENG wrote: > > dict1={...something...} > > > > dict2={...somethind else ..} > > > > dict1 + dict2 > > > > > > that's does works ..:(, it's not like List... > > > > > > anyone can tell me how to g

Re: how to join two Dictionary together?

2005-08-30 Thread Iain King
[EMAIL PROTECTED] wrote: > update works like append for lists > > a = {} > a['a']='a' > a['c']='c' > b={} > b['b'] = 'b' > c={} > c.update(a) > c.update(b) > So what do you think is the better way to do it, based on speed or aesthetics? (1) c=a.copy() c.update(b) or (2) c={} c.update(a) c.upd

wxPython, using sizers.

2005-09-16 Thread Iain King
I'm making a program to view log files. The main display is a multi column listbox. I want to add combobox filters above the listbox headers. The filters contain each unique instance in the list column below it, and if any filter has text selected in it then the listbox will only display rows in

time.strftime in 2.4.1 claims data out of range when not

2005-04-21 Thread Sheila King
Also, the phrasing of the error message is a bit odd? "day of year out of range" I'm not sure what the day of a year would be??? Sheila King http://www.thinkspot.net/sheila/ -- http://mail.python.org/mailman/listinfo/python-list

Async/Concurrent HTTP Requests

2015-02-12 Thread Ari King
Hi, I'd like to query two (or more) RESTful APIs concurrently. What is the pythonic way of doing so? Is it better to use built in functions or are third-party packages? Thanks. Best, Ari -- https://mail.python.org/mailman/listinfo/python-list

Validating Data Extracted from Files

2014-06-30 Thread Ari King
Hi, I'm sourcing data from multiple excel files (workbooks) each with multiple worksheets. Prior to persisting the aggregated data, I want to validate it. I was thinking of creating classes to hold the data and validate type and content via methods. I'd appreciate feedback on this approach, sug

How to Nest Structs?

2013-03-04 Thread Ari King
Hi, I'm trying to nest the "info_header", "info_body", and "info_trailer" structs (see below) into a "data_packet" struct. Does anyone know how I can/should accomplish this? Thanks. batch_header_format = struct.Struct('!c2h') info_header_format = struct.Struct('!2hl') mkt_status_format = struct

Re: question about what lamda does

2006-07-19 Thread Iain King
Steve Holden wrote: > tac-tics wrote: > > [EMAIL PROTECTED] wrote: > > > >>Hey there, > >>i have been learning python for the past few months, but i can seem to > >>get what exactly a lamda is for. What would i use a lamda for that i > >>could not or would not use a def for ? Is there a notable di

Re: using names before they're defined

2006-07-19 Thread Iain King
[EMAIL PROTECTED] wrote: > I have a problem. I'm writing a simulation program with a number of > mechanical components represented as objects. When I create instances > of objects, I need to reference (link) each object to the objects > upstream and downstream of it, i.e. > > supply = supply() > c

Re: using names before they're defined

2006-07-20 Thread Iain King
[EMAIL PROTECTED] wrote: > Iain, thanks - very helpful. > > Really I'm trying to write a simulation program that goes through a > number of objects that are linked to one another and does calculations > at each object. The calculations might be backwards or fowards (i.e. > starting at the supply o

Re: random shuffles

2006-07-21 Thread Iain King
Dustan wrote: > Boris Borcic wrote: > > does > > > > x.sort(cmp = lambda x,y : cmp(random.random(),0.5)) > > > > pick a random shuffle of x with uniform distribution ? > > > > Intuitively, assuming list.sort() does a minimal number of comparisons to > > achieve the sort, I'd say the answer is yes.

Re: FOR LOOPS

2006-08-01 Thread Iain King
OriginalBrownster wrote: > I am using a class called UploadedFile. > I want to create a for loop to itterate through the objects within file > name > > class UploadedFile(SQLObject): > filename = StringCol(alternateID=True) > abspath = StringCol() > uniqueid = IntCol() > > I'll s

Re: help - iter & dict

2006-08-04 Thread Alistair King
= abs(z - exvalue) # Create a var to store the closest key result = u # Iterate through the rest of the dict. for u, z in diter: # Compute the closeness. v = abs(z - exvalue) # Check if it's closer than the closest. if v < closest: # If so, store the new closest. closest = v # And stor

Re: help - iter & dict

2006-08-04 Thread Alistair King
gt; float, in line 142 of your code (in the findClosest function). So the problem > is > that 'target' is a float while 'v' is a string. > > 'v' should be a float as well, but it's a string since the values in your > dictionary are strings instead

Re: help - iter & dict

2006-08-05 Thread Alistair King
thanks to Simon Forman, his solution worked, the key value pairs were entered the wrong way round in the dictionary...Doh! -- 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

variable creation

2006-08-08 Thread Alistair King
f the dictionary containing typical elements: pt = {'H': 1.00794, 'He': 4.002602, 'Li': 6.941, 'Be': 9.012182, 'B': 10.811} Ali -- Dr. Alistair King Research Chemist, Laboratory of Organic Chemistry, Department of Chemistry, Faculty of Scien

Re: The Semicolon Wars as a software industry and human condition

2006-08-17 Thread Iain King
Xah Lee wrote: > Of interest: > > • The Semicolon Wars, by Brian Hayes. 2006. > http://www.americanscientist.org/template/AssetDetail/assetid/51982 > > in conjunction to this article, i recommend: > > • Software Needs Philosophers, by Steve Yegge, 2006 > http://xahlee.org/Periodic_dosage_dir/_p/s

Re: Looking For mp3 ID Tag Module

2006-08-18 Thread Iain King
Tim Daneliuk wrote: > Iñigo Serna wrote: > > On 8/18/06, Tim Daneliuk <[EMAIL PROTECTED]> wrote: > >> > try mutagen. > >> http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen > >> > >> This module is more-or-less exactly what I needed. However, I am running > >> into problems when the fil

Re: edit a torrent file with python

2006-10-13 Thread Iain King
di0rz` wrote: > hi, > I am looking for a python script to edit .torrent files > if anybody know one thx Not sure exactly what you are looking for, but the original bittorrent client is written in Python, so you could grab a copy of it and check the code. Iain -- http://mail.python.org/mailman/

dict problem

2006-10-25 Thread Alistair King
, XDS) updateDS1v(FHas, H, XDS) updateDS1v(FOas, O, XDS) updateDS1v(FNas, N, XDS) updateDS1v(FSas, S, XDS) updateDS1v(FClas, Cl, XDS) updateDS1v(FBras, Br, XDS) updateDS1v(FZnas, Zn, XDS) print DS1v I know there is probably a simple solution but im quite new to python and am lost? Ali -- Dr

dict problem

2006-10-25 Thread Alistair King
Jon Clements wrote: > > Alistair King wrote: > > > > > >> >> Hi, >> >> >> >> ive been trying to update a dictionary containing a molecular formula, >> >> but seem to be getting this error: >> >> >> &

Re: dict problem

2006-10-25 Thread Alistair King
ou 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. -- Dr. Alistair King Research Chemist,

dict problem

2006-10-30 Thread Alistair King
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 >>> do

Re: dict problem

2006-10-30 Thread Alistair King
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 >

Re: dict problem

2006-10-30 Thread Alistair King
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 complicat

create global variables?

2006-10-30 Thread Alistair King
.. 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 a

Re: IE7 skulduggery?

2006-10-30 Thread Alistair King
refox 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

Re: create global variables?

2006-10-30 Thread Alistair King
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.

Re: create global variables?

2006-10-31 Thread Alistair King
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > >> J. Clifford Dyer wrote: >> >> >>> Alistair King wrote: >>> > > [... advice and help ...] > > >> this worked a treat: >> >> def monoVarcalc(atom): >> &

Re: create global variables?-the full story

2006-10-31 Thread Alistair King
Steve Holden wrote: > Alistair King wrote: > >> Steve Holden wrote: >> >> >>> [EMAIL PROTECTED] wrote: >>> >>> >>> >>>> J. Clifford Dyer wrote: >>>> >>>> >

Re: create global variables?-the full story

2006-11-07 Thread Alistair King
Happy pythoning! > > Cheers, > Cliff > Thanks Cliff, this is what i need, it seems to make much more sense to do this way. I think once i learn to include datastructures within each other im gonna try to make up this 3D 'array' (i think this is a word from C, is there a python equ

Python deployment options.

2006-11-08 Thread king kikapu
that the program only use or am i forced to download the language to the user machine so the .py files can be run ?? Thanks in advance, king kikapu -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   >