Newbie question: Classes

2008-01-08 Thread Sam Garson
? it seems like nothing is any easier (except having variables locally). Is this right? Should I be creating more classes for different things or what? I can upload the .py if you want. Thanks, Sam -- I intend to live forever - so far, so good. SaM -- http://mail.python.org/mailman/listinfo/python

Taskbar/System Tray

2008-01-05 Thread Sam Garson
hello group, Using tkinter, is there any way to have the program not showing on the taskbar, and even better showin in the system tray? I realise tkinter does not have that much OS specific stuff but maybe there is a way? Thanks, Sam -- I intend to live forever - so far, so good. SaM

Im back...

2008-01-03 Thread Sam Garson
-1, putLabel) v = StringVar() current = Label(root, textvariable = v) current.grid(row = 3, columnspan = 2, sticky = W+E, padx = 3) root.mainloop() [end python code] how do i make it so it puts it into the variable *when* i click it? Any help will be greatly appreciated! Thanks, Sam -- I

Re: Using ctypes with lib not found via ldconfig

2007-12-20 Thread Sam
Hello, May be I misunderstand your problem, but is it not possible do link it as follow? import ctypes libgaak = ctypes.CDLL(/home/me/otherLibs/libgaak.so.6) Kind regards. Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: Allowing Arbitrary Indentation in Python

2007-12-19 Thread Sam
On Dec 19, 11:09 am, gDog [EMAIL PROTECTED] wrote: Hi, Sam- I'm not wanting to start a flame war, either, but may I ask why does your friend want to do that? I'm always intrigued by the folks who object to the indentation rules in Python, even though I've always tried to keep consistent

Text into a label

2007-12-18 Thread Sam Garson
\Notes.py, line 27, in module v.set = (box.get(int(number[0]))) IndexError: tuple index out of range How can i get it to only take the variable when i have selected something, or any other solution! Thanks, Sam -- I intend to live forever - so far, so good. SaM -- http://mail.python.org

Allowing Arbitrary Indentation in Python

2007-12-18 Thread Sam
A friend of mine is picking up some Python and is frustrated by Python's indentation rules (http://greatbiggary.livejournal.com/ 260460.html?thread=1835884#t1835884). Personally, I've never had any issues with Python's ways of indentation, but that conversation got me thinking about the issue.

Re: Allowing Arbitrary Indentation in Python

2007-12-18 Thread Sam
On Dec 18, 5:28 pm, Grant Edwards [EMAIL PROTECTED] wrote: On 2007-12-18, Sam [EMAIL PROTECTED] wrote: A friend of mine is picking up some Python and is frustrated by Python's indentation rules (http://greatbiggary.livejournal.com/ 260460.html?thread=1835884#t1835884). Personally, I've

Re: Allowing Arbitrary Indentation in Python

2007-12-18 Thread Sam
On Dec 18, 7:09 pm, Jonathan Gardner [EMAIL PROTECTED] wrote: On Dec 18, 2:16 pm, Sam [EMAIL PROTECTED] wrote: layouts = ['column', 'form', 'frame'] cmds.window(t='gwfUI Builder') cmds.paneLayout(configuration='vertical3', ps=((1, 25, 100), (3, 20, 100))) cmds.paneLayout

Label Variables

2007-12-17 Thread Sam Garson
\Notes.py, line 27, in module v.set = (box.get(int(number[0]))) IndexError: tuple index out of range How can i get it to only take the variable when i have selected something, or any other solution! Thanks, Sam -- I intend to live forever - so far, so good. SaM -- http://mail.python.org

Get()

2007-12-15 Thread Sam Garson
return self.func(*args) File C:\My Documents\My Python\Notes.py, line 6, in insert name = ent.get() AttributeError: 'NoneType' object has no attribute 'get' I am puzzled as to the last line... Help? Sam -- I intend to live forever - so far, so good. SaM -- http://mail.python.org/mailman

Dual Python Installed Environments..

2007-10-25 Thread sam
Hi.. I'm looking to install dual versions of python 2.3, 2.4 on the same box. I'm trying to figure out if there's something I'm missing, some kind of gotchas that I haven't seen. I'm also trying to figure out how to allow my script to determine which version to use??? Thanks --

RE: Dual Python Installed Environments..

2007-10-25 Thread sam
:48 PM To: python-list@python.org Subject: Re: Dual Python Installed Environments.. sam schrieb: Hi.. I'm looking to install dual versions of python 2.3, 2.4 on the same box. I'm trying to figure out if there's something I'm missing, some kind of gotchas that I haven't seen. THey shouldn't

[issue1146] TextWrap vs words 1-character shorter than the width

2007-09-11 Thread sam
New submission from sam: from textwrap import wrap wrap(foobarbaz reallylongwordgoeshere, width = 10) ['foobarbaz r', 'eallylongw', 'ordgoesher', 'e'] print [len(s) for s in _] [11, 10, 10, 1] This only seems to happen when the first word on the line is exactly one character shorter than

Re: Python and Javascript equivalence

2007-04-23 Thread Sam the Cat
I am writing some COM code in Python to control photoshop. Several functions of PS require an Array argument. In the examples of VBscript or javascript the Array type is used. I have tried what would appear to be the equivalent in Python -- Lists and Tuples -- but to no avail. Anyone

Python and Javascript equivalence

2007-04-22 Thread Sam the Cat
. Anyone have any insight on what via the COM interface is equivalent to an Array in javascript ? Cheers Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: Pep 3105: the end of print?

2007-02-16 Thread Sam
aliasing must happen in compat26.py. My suggested solution is this: #_compat30.py print2 = print #compat.py try: from _compat30 import print2 except SyntaxErorr, ImportError): def print2(): --Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: c++ for python programmers

2007-02-13 Thread Sam
and pointers), use Python, and if you want under-the-hood pointer-fu, use C. --Sam -- http://mail.python.org/mailman/listinfo/python-list

Make 1million in 6 weeks or less

2007-02-12 Thread Sam Wortzberg
Legal Consultants http://legal-rx.blogspot.com/index.html will show you how to make 1 million in less than 6 weeks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Socket and array

2007-02-07 Thread Sam
, perhaps, or a similar lightweight notation system if you are only sending lists) would be a good idea. --Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing class variables in staticmethods.

2007-01-21 Thread Sam
On 21 Jan 2007 12:49:17 -0800, Ramashish Baranwal [EMAIL PROTECTED] wrote: class Base: staticvar = 'Base' @staticmethod def printname(): # this doesn't work # print staticvar # this does work but derived classes wouldn't behave as I want print

problems caused by very large for-loop

2006-12-07 Thread sam
again... :) sam -- http://mail.python.org/mailman/listinfo/python-list

Re: problems caused by very large for-loop

2006-12-07 Thread sam
thanks, i'll remember that. it makes sense that there should be a way of doing it... sam -- http://mail.python.org/mailman/listinfo/python-list

Re: About the 79 character line recommendation

2006-12-05 Thread sam
, Steve Bergman I prefer to use 132 char per line, and like you I line up the = sign for readability. The reason for this convention arises from the fact that I am Dyslexic, and this convention helps me double check my typing. Sam Schulenburg -- http://mail.python.org/mailman/listinfo/python-list

accessing fortran modules from python

2006-11-16 Thread sam
realize there is a lot of material on this subject already available, but i am finding it difficult to make sense of, it's like trying to take a drink from a fire hose. any advice would be gratefully received. i will almost certainly be coding this on windows, for what it's worth. thank you, sam

Re: accessing fortran modules from python

2006-11-16 Thread sam
thanks guys, i'll follow this up more in a couple of weeks when i know what i need to do better. sam -- http://mail.python.org/mailman/listinfo/python-list

Re: multi split function taking delimiter list

2006-11-14 Thread Sam Pointon
/ is quite a cool package for doing this sort of thing. Using your example: #untested from pyparsing import * splitat = Or(:=, +) lexeme = Word(alphas) grammar = splitat | lexeme grammar.parseString(a:=b+c) #returns (the equivalent of) ['a', ':=', 'b', '+', 'c']. --Sam -- http://mail.python.org

Nested Dictionary Sorting

2006-11-06 Thread Sam Loxton
these first keys by the value of the 'ops' key from highest to lowest value to give the following result: [('2329492', {'ops': '80'}), ('2329490', {'ops': '50'}), ('2329513', {'ops': 20.0})] Thanks in advance for any help, Sam. -- http://mail.python.org/mailman/listinfo/python-list

program written to model population evolving over time

2006-11-04 Thread sam
i'd try and contribute something for once instead of just asking questions. sam PS it does actually work, in case you're wondering. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: print time comparison: IDLE versus terminal on ultra 20

2006-10-09 Thread sam
i forgot to mention that i'm running a version of python 2.3 (think it's 2.3.5), as that's what was installed and i'm not hooked up to the internet with the ultra 20 yet. that may account for some of the difference. sam -- http://mail.python.org/mailman/listinfo/python-list

print time comparison: IDLE versus terminal on ultra 20

2006-10-08 Thread sam
seconds in terminal: 0.001 seconds a difference of between 3 and 4 orders of magnitude is rather striking. anyone know what's going on here? is it a python, a unix thing, or something else? sam -- http://mail.python.org/mailman/listinfo/python-list

Re: print time comparison: IDLE versus terminal on ultra 20

2006-10-08 Thread sam
i was actually experimenting on windows on my own pc before the workstation arrived, and IDLE printed a lot faster on windows than in solaris for me too. i would indeed complain to sun if i had ever got the impression that anyone over there ever knew what was going on... : ) but on the

Re: error handling in user input: is this natural or just laborious

2006-10-07 Thread sam
be of interest. thanks again, sam -- http://mail.python.org/mailman/listinfo/python-list

error handling in user input: is this natural or just laborious

2006-10-06 Thread sam
for some fresh eyes on it. thanks, sam PS making check=True just saves the code from printing 'those numbers don't sum to 100' if they haven't all been entered, which looks kind of silly. -- http://mail.python.org/mailman/listinfo/python-list

Re: error handling in user input: is this natural or just laborious

2006-10-06 Thread sam
you're right, of course. it occurred to me that, even if it were manageable for a few items, it would quickly become absurd as the number of items grew. this: def get_pct(): while True: pct_list=[['cash', 0], ['bond', 0], ['blue', 0], ['tech', 0], ['dev', 0]]

Re: error handling in user input: is this natural or just laborious

2006-10-06 Thread sam
this does what i want, though i don't like the inner while loop having to be there def get_pct(): while True: pct_list=[['cash', 0], ['bond', 0], ['blue', 0], ['tech', 0], ['dev', 0]] total=0 for i in range(len(pct_list)):

how to reuse class deinitions?

2006-10-01 Thread sam
not searching with the right words. it's late here and my brain's switching off... cutting and pasting it into the interpreter is a bit of a bore. any help? much appreciated in advance, sam PS i've just reached first base with classes, and i think i'm starting to see what the big deal is about OOP. it's

Re: how to reuse class deinitions?

2006-10-01 Thread sam
should read 'definitions', of course. i hate stupid typos. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to reuse class deinitions?

2006-10-01 Thread sam
What I do: For each new major version of python, in .../site-packages I make a directory sdd (my initials). In it I put an empty file named __init__.py. When I have things I want to reuse, I put them in files named things like .../site-packages/sdd/goodidea.py, and I get use of them in

python interpreter on solaris 10

2006-09-25 Thread sam
and restored the python2.3 file to its original position, i find the same command prompt failing to work. have i messed it up by moving it around? my workstation remains a shiny box which does naught but hum malevolently. is there hope? thank you, sam -- http://mail.python.org/mailman/listinfo

Re: python interpreter on solaris 10

2006-09-25 Thread sam
'there is no installed viewer capable of displaying the document'? i have no idea what i need, or where i can get it. any ideas? sam -- http://mail.python.org/mailman/listinfo/python-list

Re: python interpreter on solaris 10

2006-09-25 Thread sam
[EMAIL PROTECTED] wrote: i think i've tracked down the equivalent files on my pc. one opens the interpreter in a white-backed text editor, the other at the black-backed command prompt. i have equivalent files of the same size on the workstation, which must be the same. does anyone know why

Re: python interpreter on solaris 10

2006-09-25 Thread sam
I would try to use the python executable located in /usr/bin if it is exists, otherwise use the python executable in /usr/sfw/bin. casevh lordy lord, is that where it was. i just found it now. i had been thinking that idle was the name of the python interpreter, not just the IDE, hence my

returning None instead of value: how to fix?

2006-09-22 Thread sam
returning something else? thanks in advance, sam -- http://mail.python.org/mailman/listinfo/python-list

Re: returning None instead of value: how to fix?

2006-09-22 Thread sam
for all the answers. it boggles the mind that one can have access to this almost immediate help at no charge. sam -- http://mail.python.org/mailman/listinfo/python-list

list index out of range error

2006-09-20 Thread sam
something trivial, but i can't seem to get round it by using while loops, and i had the same problem with cmp(), hence the explicit comparison above, which still doesn't work. can anyone help a beginner out with this? many thanks in advance, sam lynas -- http://mail.python.org/mailman/listinfo/python

Re: list index out of range error

2006-09-20 Thread sam
actually, that little bit of code i wrote is obscenely wrong anyway, so please don't bother analyzing the flow. any insight into the list index out of range error would still be welcome, though. -- http://mail.python.org/mailman/listinfo/python-list

Re: list index out of range error

2006-09-20 Thread sam
yes, yes, of course, thank you. not sure what i thought i was doing there. i'll see if i can get it running now... -- http://mail.python.org/mailman/listinfo/python-list

Re: list index out of range error

2006-09-20 Thread sam
for what it's worth. and it is approx. five times quicker than the bubblesort i wrote to begin with on a 286-word highly unordered list, so i wasn't wasting my time after all... __ import time file_input = open('wordlist.txt',

Re: list index out of range error

2006-09-20 Thread sam
're: your e-mail', or 'project stuff', or 'file for client' or suchlike. made it kind of difficult to find anything. figured a similar principle might apply here... ; ) thanks again all, sam -- http://mail.python.org/mailman/listinfo/python-list

Re: Specify string with uniform indentation ignored

2006-09-14 Thread Sam Pointon
() } Is there a built in way to do this? I don't much care for: string = function otherlang(){ string += doit() string += } textwrap.dedent ought to do exactly what you want. --Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting value of an int-derived class

2006-09-02 Thread Sam Pointon
are fairly good at picking up unused objects. ;) --Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: Pros/Cons of Turbogears/Rails?

2006-08-31 Thread Sam Smoot
fuzzylollipop wrote: I got my facts straight, Ruby is not tested in production environments. That's odd... it's running bank websites, credit-card processing, high traffic sites like ODEO and Penny-Arcade. Seems pretty production to me. And I am speaking from a BIG internet site scale. Yes

Re: Pros/Cons of Turbogears/Rails?

2006-08-28 Thread Sam Smoot
fuzzylollipop wrote: uh, no, Python predates Ruby by a good bit Rails might be older than Turbogears but it still JUST went 1.0 officially. Wow that's a lot of FUD, especially since you're beating up on Rails for it's docs and maturity, when I doubt (but couldn't prove) turbogears comes close.

Re: Coding style and else statements

2006-08-28 Thread Sam Pointon
Bruno Desthuilliers wrote: foo = lambda thing: thing and thing + 1 or -1 The and ... or trick is buggy (what if thing == -1?) and bad style. If you -do- want a conditional expression, 2.5 provides one: thing + 1 if thing else -1 No subtle logical bugs, and a good deal more obvious. On the

wxmsw26uh_vc.dll not found when using wxAgg backend

2006-08-16 Thread Sam
Hello, I've installed matplotlib recently because I want to add graphing functionality to a GUI that i'm making. I decided to try using the wxAgg backend instead of plain old wx because: a) I hear it's quicker, and b) when i use the wx backend, the axis labels don't seem to work properly - i

matplotlib, wxPanel inside a wxPanel

2006-08-12 Thread Sam
Hello, I'm currently creating a GUI, which consists of a main frame that contains a menu bar,a toolbar and an empty panel, let's call it main_panel. Ideally, I'd like the following functionality: upon choosing an item from the menu bar, a particular graph will be displayed inside main_panel. Now

Re: matplotlib, wxPanel inside a wxPanel

2006-08-12 Thread Sam
panels... Secondly, I stuffed up when trying to give graph_panel a parent of main_panel. It turns out I was actually never doing this, so the toolbar would appear, but none of the buttons would work. Thanks again for your comments, they were very helpful, Cheers Sam -- http://mail.python.org/mailman

Re: Which compiler will Python 2.5 / Windows (Intel) be built with?

2006-06-16 Thread sam
I have been using the latest VC.net to compile my SCSIPython extension dll for Python 2.3, 2.4, and 2.5 without any problems. I just have to make shure that I link with the correct Python.lib Sam Schulenburg -- http://mail.python.org/mailman/listinfo/python-list

Re: Most elegant way to generate 3-char sequence

2006-06-11 Thread sam
what I was trying to accomplish. Sam Schulenburg James Stroud wrote: Fredrik Lundh wrote: James Stroud wrote: See the actual question: How would you construct a generator to acheive this? if you don't think the context provided by the subject line and the sentence before

Re: Very nice python IDE (windows only)

2006-06-07 Thread sam
Very interesting, I have downloaded it,and I like what I see. ago wrote: I have just discovered Python Scripter by Kiriakos Vlahos and it was a pleasant surprise. I thought that it deserved to be signalled. It is slim and fairly fast, with embedded graphical debugger, class browser, file

Re: carshing the interpreter in two lines

2006-06-03 Thread sam
tomer: It is my opinion that you would loose performance if the Python interpreter had the additional task of verifying byte code. It might be more appropriate to have a preprocessor that did the verifying as it compiled the byte code. Sam Schulenburg gangesmaster wrote: the following (random

Re: carshing the interpreter in two lines

2006-06-03 Thread sam
Mel: Wow that book brings back memories. I scanned my copy to review the subject covered, and came to the conclusion that mind reading algorithms are the answer. Sam Schulenburg Mel Wilson wrote: sam wrote: tomer: It is my opinion that you would loose performance if the Python

Re: How do you practice Python?

2006-06-02 Thread sam
signed the standard intellectual property forms. Sam Schulenburg Jarek Zgoda wrote: [EMAIL PROTECTED] napisa³(a): In our field, we don't always get to program in the language we'd like to program. So... how do you practice Python in this case? Write code. Lots of it. Work on a project

Re: Seg fault in python extension module

2006-06-02 Thread sam
I recommend that you also replace the NULL after the METH_VARARGS with a valid documentations string such as: static PyMethodDef modglMethods[] = { { (char *)glVertex4f, _wrap_glVertex4f, METH_VARARGS, My Doc String}, { NULL, NULL, 0, NULL } }; Sam Schulenburg

Re: Seg fault in python extension module

2006-06-02 Thread sam
*/ const char *ml_doc;/* The __doc__ attribute, or NULL */ }; Sam Schulenburg John Machin wrote: On 3/06/2006 1:38 PM, sam wrote: I recommend that you also replace the NULL after the METH_VARARGS with a valid documentations string such as: static PyMethodDef modglMethods

Re: IronPython 1.0 Beta 7 Released

2006-05-24 Thread sam
vbgunz: When you download IronPython,the tutorial directory has some examples of interfacing With the .NET environment i.e.: 1: IronPython - C# 2: C# - IronPython 3: IronPython - VB 4: VB - IronPython Sam Schulenburg -- http://mail.python.org/mailman/listinfo/python-list

The use of PyW32_BEGIN_ALLOW_THREADS and PyW32_END_ALLOW_THREADS

2006-05-19 Thread sam
The foowing code lifted from Mark Hammond Pywin32 code shows and example of calling the Windows Kernel32 GetTickCount(),using PyW32_BEGIN_ALLOW_THREADS and PYW32_END_ALLOW_THREADS. My Code does not use this,but uses SetThreadAffinityMask(GetCurrentThread(),1). My questions are: 1) What is

ANN: SCSIPYTHON added to Sourceforge

2006-03-23 Thread sam
: http://starship.python.net/crew/samschul Sourceforge link: https://sourceforge.net/projects/scsipython Sam Schulenburg -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html

ANN: SCSIPYTHON on Sourceforge

2006-03-22 Thread sam
: http://starship.python.net/crew/samschul Sourceforge link: https://sourceforge.net/projects/scsipython Sam Schulenburg -- http://mail.python.org/mailman/listinfo/python-list

Re: pow (power) function

2006-03-15 Thread sam
I not shure which algorithm,but I am assumeing that all Python does,is to call the underlying C pow() function. Sam -- http://mail.python.org/mailman/listinfo/python-list

The old round off problem?

2006-03-04 Thread sam
have tried various graphing programs,and they all exihibit this problem. thanks in advance Sam Schulenburg f(x) = cosh^2(x) - sinh^2(x) = 1 from math import * for x in range(20): print x= %2d Sinh^2(x) = %20.3f f(x) = %2.10f %(x,pow(cosh(x),2),pow(cosh(x),2)- pow(sinh(x),2)) x= 0

Re: The old round off problem?

2006-03-04 Thread sam
David I beg I beg Can you answer the question? Also thanks for the information on using the Taylor series. Sam Schulenburg -- http://mail.python.org/mailman/listinfo/python-list

Re: The old round off problem?

2006-03-04 Thread sam
David Treadwell wrote: exp(x) is implemented by: 1. reducing x into the range |r| = 0.5 * ln(2), such that x = k * ln(2) + r 2. approximating exp(r) with a fifth-order polynomial, 3. re-scaling by multiplying by 2^k: exp(x) = 2^k * exp(r) sinh(x) is mathematically ( exp(x) - exp(-x)

Re: Pyserial never read

2006-02-22 Thread sam
) with inWaiting(), flush etc But no result. Thanks Luca Hope this helps Sam Schulenburg -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyserial never read

2006-02-22 Thread sam
Thanks for the info Grant. It'll teach me not to read the documentation :) Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: getting started, .py file

2006-02-20 Thread Sam Pointon
python -i source_file.py will do what you want. -Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: Building Pywin32 source code?

2006-01-09 Thread sam
Trent: Thanks for the reply. I tried again today and everthing worked. I did find a type in my CVSROOT string,and corrected it. Thanks for the examples posted in the included link. Sam Schulenburg -- http://mail.python.org/mailman/listinfo/python-list

Building Pywin32 source code?

2006-01-08 Thread sam
Has anyone been able to access the source code for Pywin32 at sourceforge? I have been able to use TortouseCVS to access other CVS projects,but with the Pywin32 cvs site, I can not log in. Sam Schulenburg -- http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft IronPython?

2006-01-07 Thread sam
After downloading and trying out Ironpython, I have the following comments: 1) I like the idea of Python under .net 2) I like the support for both Microsoft math lib,and Python's math lib Will Microsoft maintain the compatability between standard python with the addition of their libs? --

Re: Spelling mistakes!

2006-01-07 Thread Sam Pointon
[EMAIL PROTECTED] wrote: In fact, googling for referer and referrer reports a similar number of hits, unlike most misspellings. Terry You know, I almost mentioned that myself. Drives me crazy. Me too. I'm one of those people who, for better or worse, is a good speller. Words

Re: Regex anomaly

2006-01-03 Thread Sam Pointon
Would this particular inconsistency be candidate for change in Py3k? Seems to me the pos and endpos arguments are redundant with slicing, and the re.match function would benefit from having the same arguments as pattern.match. Of course, this is a backwards-incompatible change; that's why I

Re: UpDate For SCSIPython Storage device test library

2006-01-03 Thread sam
, and SCSITOOLS24USBV1.4.zip Sam Schulenburg -- http://mail.python.org/mailman/listinfo/python-list

Re: Line replace

2006-01-01 Thread Sam Pointon
Hello I need some help I have a text file which changes dynamically and has 200-1800 lines. I need to replace a line , this line can be located via a text marker like : somelines # THIS IS MY MARKER This is the line to be replaced somemorelines My question is how to do this

Re: loops breaks and returns

2006-01-01 Thread Sam Pointon
rbt wrote: Is it more appropriate to do this: while 1: if x: return x Or this: while 1: if x: break return x Or, does it matter? I would pick the first form if that's the only place where x would be returned from the function. However, if there would be

ANN: Update to SCSIPython mass storage access routines under windows

2005-12-30 Thread sam
Through layer. Using these routines,all mounted drives can be accesed using SCSI Commands. The following url will provide documentation and zip files that can be downloaded. These zip files contain all the source code for the libraries. http://starship.python.net/crew/samschul Sam Schulenburg [EMAIL

Re: UpDate For SCSIPython Storage device test library

2005-12-30 Thread sam
Just a added note,that these routines will access any storage drive that is mounted under Windows. The Scsi Pass Through layer maps all Pcmcia,IDE,andSCSI drives to use SCSI commands. This allows a user to access all these interfaces with a common command set. Sam Schulenburg -- http

UpDate For SCSIPython Storage device test library

2005-12-28 Thread sam
I have updated my page at http://starship.python.net/crew/samschul/ These tools allow for the user to issue low level SCSI commands via the windows SCSIPASSTHROUGH interface layer. These routines will work from IDLE, Pythonwin,and Python.exe. The changes include the following: 1) Deleted

Re: access to preallocated block of memory?

2005-12-15 Thread sam
I had a simular situation when I was writing Python routines to access the the storage (SCSIPASSTHROUGH) layer provided by Windows XP. My solution was to develope an extention in C that allocated all storage buffers within the extension. Then I added access extensions to controll reading and

Re: problems binding a dictionary

2005-12-10 Thread Sam Pointon
You're not 'exploding' the dict to the param1='blah' etc form - you-re actually passing it in as a single dict object. To solve this, add a ** to the front of a dict you want to explode in a function, just as you'd add a * to explode a sequence. --

Re: Checking length of each argument - seems like I'm fighting Python

2005-12-03 Thread Sam Pointon
It depends what you mean by 'scalar'. If you mean in the Perlish sense (ie, numbers, strings and references), then that's really the only way to do it in Python - there's no such thing as 'scalar context' or anything - a list is an object just as much as a number is. So, assuming you want a

Re: regexp non-greedy matching bug?

2005-12-03 Thread Sam Pointon
My understanding of .*? and its ilk is that they will match as little as is possible for the rest of the pattern to match, like .* will match as much as possible. In the first instance, the first (.*?) did not have to match anything, because all of the rest of the pattern can be matched 0 or more

Re: How to do new_variable = (variable) ? True : False; (php) on python?

2005-11-18 Thread Sam Pointon
Daniel Crespo wrote: Hello to all, How can I do new_variable = (variable) ? True : False; in Python in one line? I want to do something like this: dic = {'item1': (variable) ? True-part : False-part} Any suggestions? Daniel There's a trick using the short-circuiting boolean logic

Re: Multikey Dict?

2005-11-12 Thread Sam Pointon
self.by_name[value] The alternative is to use some sort of database for storing these values. It doesn't really matter which (hell, you could even reinvent a relational wheel pretty simply in Python), as any DB worth its salt will do exactly what you need. Hope that helps, -Sam -- http

cPAMIE/Python String and Date Comparisons

2005-11-07 Thread Sam R
Hi, I am new to Python, and PAMIE has been a very useful tool for my website functionality testing. I was wondering if anyone knows how to do the following testcases with either PAMIE or Python. 1. Load a page http://www.prophet.net/quotes/stocknews.jsp?symbol=MSFT Verify that the string 'News for

Re: Importing Modules

2005-11-02 Thread Sam Pointon
On the second point, a combination of sys.path, os.listdir and __import__ should do what you're after, although sifting through the whole of sys.path and subfolders from Python, rather than the interpreter itself, could be slow. (And it'll be redundant as well - __import__ will have do the same

Re: SNMP

2005-10-30 Thread Sam Merca
py wrote: From what I have seen Python does not come with an snmp module built in, can anyone suggest some other SNMP module (preferably one you have used/experienced)..I have googled and seen yapsnmp and pysnmp (which seem to be the two most active SNMP modules). Thanks I've used pysnmp

Re: Pickling and unpickling inherited attributes

2005-10-30 Thread Sam Pointon
The reason the state of obj.A and obj.B aren't preserved is because your __getstate__ and __setstate__ don't preserve them - they only save obj.C, and you don't make a call to the parent class's respective methods. Here's what I mean: import pickle class Child(Parent): __slots__=['C',]

Re: Pickling and unpickling inherited attributes

2005-10-30 Thread Sam Pointon
Of course, in __setstate__, there should be a tup = list(tup) as well - sheer forgetfulness and a confusing name in one. -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I sort these?

2005-10-28 Thread Sam Pointon
unzip doesn't seem to work for me... It's not a part of the standard Python distribution, but this is a naive implementation (it doesn't react well to the list's contents having different lengths). def unzip(seq): result = [[] for i in range(len(seq[0]))] for item in seq: for

<    1   2   3   4   5   6   >