Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Brett Hoerner
On Apr 25, 8:11 am, "Ciprian Dorin, Craciun" wrote: >     Well in fact I would have written it like: > > def validate_commandline(rexes, line) : >     if not compare (rexes, line, re.match) : >         if len (rexes) != len (line) : >             raise ValueError ("mismatch len") >         mismatc

Re: getting the size of an object

2007-06-18 Thread Brett Hoerner
On Jun 18, 2:48 pm, "filox" <[EMAIL PROTECTED]> wrote: > is there a long answer? what i want is to find out the number of bytes the > object takes up in memory (during runtime). since python has a lot of > introspection mechanisms i thought that should be no problem... There isn't an automatic way

Re: getting the size of an object

2007-06-18 Thread Brett Hoerner
On Jun 18, 11:07 am, "filox" <[EMAIL PROTECTED]> wrote: > is there a way to find out the size of an object in Python? e.g., how could > i get the size of a list or a tuple? "Size" can mean a lot of things, len(my_list) len(my_tuple) Although I have the feeling you mean "how many bytes does this

Re: calling a class instance of function

2006-12-20 Thread Brett Hoerner
Brett Hoerner wrote: > Also, in order to call a function without arguments you still need to > use (), so you probably wanted to use pid.original() in your pid.add > call. Sorry, never mind this bit, I misread the line. But you do probably want to change the class test into a func

Re: calling a class instance of function

2006-12-20 Thread Brett Hoerner
nted to use pid.original() in your pid.add call. Brett Hoerner -- http://mail.python.org/mailman/listinfo/python-list

Re: Negative integers and string formating

2006-10-23 Thread Brett Hoerner
Steven D'Aprano wrote: > Are there any string formatting codes that will place a space between the > sign and the number? Not that I know of, why not use the absolute value (after checking if it is negative), In [1]: abs(-1) Out[1]: 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Image.draft -- what are the modes that I can use?

2006-10-18 Thread Brett Hoerner
an't use anything but CPython software...? Brett Hoerner -- http://mail.python.org/mailman/listinfo/python-list

Re: why should dict not be callable?

2006-10-17 Thread Brett Hoerner
[EMAIL PROTECTED] wrote: > A couple of times recently I've come across this problem: I have a > large list to sort and I need to the the "key=function" argument to > sort appropriately. But I actually have the key mapping in a big > dictionary. Is this what you mean? I suppose the lambda is an

Re: Ok. This IS homework ...

2006-10-14 Thread Brett Hoerner
spawn wrote: > Actually, they do end. If I > move my "guess" variable outside the outermost loop, then it becomes > infinte. I know, I tried it. Huh? When does "running" ever evaluate to false (therefore breaking either of the loops)? -- http://mail.python.org/mailman/listinfo/python-list

Re: Ok. This IS homework ...

2006-10-14 Thread Brett Hoerner
tal = guess + subtotal You keep adding the original input (subtotal) to the most recent guess, and printing "running_total". You never re-assign subtotal or make use of running_total in your deepest loop. Also, you never break out of your deepest loop, why are you using two nested inf

Re: preserving color ouput of a shell command via os.popen()

2006-09-26 Thread Brett Hoerner
t;> f = a.read() >>> f 'bin\nboot\ndev\netc\nhome\nlib\nlost+found\nmedia\nmisc\nmnt\nnet\nopt\nproc\nroot\nsbin\nselinux\nsrv\nsys\ntmp\nusr\nvar\n' >>> See the difference? :) Brett Hoerner -- http://mail.python.org/mailman/listinfo/python-list

Re: question about dictionaries

2006-01-19 Thread Brett Hoerner
Chris wrote: > Is there a way to stop this behavior? I want to process this dictionary > in the order it's in, element by element. I'm running Python 2.3, if > that helps. As said previously, you either want a list (which are ordered), or an ordered-dictionary (not a Python native type, see http:/

Re: how to find not the next sibling but the 2nd sibling or findsibling "a" OR sinbling "b"

2006-01-19 Thread Brett Hoerner
[EMAIL PROTECTED] wrote: > hey fredrik, > > i don't understand what you are saying Do what he showed in the Python interactive shell, > Fredrik Lundh wrote: > > 'food' or 'drink' doesn't do what you think it does: > > > > >>> 'food' or 'drink' > > 'food' > > > > >>> {'class': 'food' o

Re: new in programing

2005-12-09 Thread Brett Hoerner
Efrain Marrero wrote: > i want to now how to do this in python > this is java > > > for(int i=1 ; i<=lim ; i++){ > > for(int j=i+1; j<=lim+1; j++){ > > for(int k =j+1; k<=lim+2;k++){ > > for(int l=k+1 ; l<=lim+3;l++){ > >

Re: Favorite flavor of Linux? (for python or anything else)

2005-12-04 Thread Brett Hoerner
I have to add another vote for Gentoo. I agree that you just "have less problems" on Gentoo. Updates are from source, but you don't have to update mid-day while working on a project... if you really want the new version of KDE (etc) then start an update and go to sleep, not a big deal. Portage (

Re: Basic about Python class

2005-11-27 Thread Brett Hoerner
Manuel11g wrote: > Hello, > I am a new programmer in Python and a need some help. Where can i get a > basic tutorial about Class. I don't know nothing about Object Oriented > Programming. Can you help me? http://diveintopython.org/object_oriented_framework/index.html -- http://mail.python.org/ma

Re: newbie - How do I import automatically?

2005-11-15 Thread Brett Hoerner
> I have written some functions in a file called btools.py. I would like > to import them automatically when I start up Python shell. Today I must > do it by hand like this > > >>> from btools import * > >>> dir() > ['__builtins__', '__doc__', '__name__', 'func1', 'func2', 'func3'] > >>> > > Is the

Re: How can I package a python script and modules into a single script?

2005-11-03 Thread Brett Hoerner
Would PythonEggs be close? It's basically a zip format with all the Python files inside, it would maintain the structure and not be a single script file, but would be a single .egg file... the end user would just run the script and all would be installed, essentially. http://peak.telecommunity.co

Re: putting an Icon in "My Computer"

2005-11-03 Thread Brett Hoerner
> I've been asked by my boss to put an Icon in WinXP's "My Computer" for > a utility we use around the shop. My tool of choice is of course > Python and therefore what I am using to attempt my given task. I have > no trouble putting Icons in the WinXP Toolbar using Python, but have > totally fail

Re: Python for .NET and IronPython

2005-11-02 Thread Brett Hoerner
hrh1818 wrote: > For more information on Iron Python see http://www.ironpython.com/ > My take on Iron Python is the new job the develolper of Iron Python > started last year takes up just about all of his time and the developer > is currently spending very little time actively developing Iron Pyth

Re: Web based applications are possible with wxPython?

2005-10-18 Thread Brett Hoerner
I don't think this is possible, unless I am grossly misunderstanding. For the web, pretty much every "UI" is build with some variation of HTML (XHTML is the new standard) with JavaScript thrown in for fancy GUI-like interfaces. You can't use OS-native widgets in the web browser, no. -- http://m

Re: installer for amd64 build of python?

2005-10-13 Thread Brett Hoerner
Trent Mick wrote: > Yes. The MS Platform SDK is free and includes a compiler that can target > x86, ia64 and x64 (the latter is what MS -- and Sun -- are calling > AMD64). Thanks, looking at their site I can't find a Platform SDK for XP... am I looking for the Windows 2003 Server SDK...? Seems co

Re: installer for amd64 build of python?

2005-10-13 Thread Brett Hoerner
As an aside to this, are there any freely available C compilers for Windows that can compile 64-bit binaries? I find nothing for Cygwin or MinGW... -- http://mail.python.org/mailman/listinfo/python-list

Re: installer for amd64 build of python?

2005-10-12 Thread Brett Hoerner
> Alternatively, does anyone have experience > of using the visual studio files in the PCBuild > directory under amd64? I don't have an answer for you, but just to clarity for future readers... based on the quote above, I assume you mean a native 64-bit build for Windows, right? You never stated

Re: Newbie needs help. Setting PYTHONDOCS to read HTML.

2005-10-11 Thread Brett Hoerner
That's because the Python docs come zipped up within a folder, for example: python_docs.tar.bz2 has a folder inside it called Python-Docs-2.4.2. You need to have C:\Python24\Python-Docs-2.4.2\ as the value if thats where that folder is, or wherever you unzipped it. I, personally, just took all t

Re: Newbie needs help. Setting PYTHONDOCS to read HTML.

2005-10-10 Thread Brett Hoerner
You can use Python regardless of the docs... of course. Not sure what you mean there. As far as setting an Environment Variable, though: (1) Right-Click My Computer, go to Properties (2) Go to the Advanced tab (3) Click Environment Variables (bottom middle-ish) (4) Under "User Variables" clic

Re: best Pythonic way to do this sort: Python newb

2005-10-09 Thread Brett Hoerner
(sorted is a built-in function in 2.4) def myFunction( data ): """ Take one of your set of 3, grab [2] (the 3rd) and do calcs, return value """ "do some math calculations to data[2]" return "result of calculations" sorted_list = sorted(myList, key=myFunction) List is sorted in the or

Re: change a value to NULL?

2005-10-05 Thread Brett Hoerner
I'm not sure what you mean, really, do you need an official Python "Null" value? Try None? In [6]: myCells = ['Mary', 'Bob', None, 'Joe'] In [7]: for cell in myCells: ...: if cell: ...: print cell ...: else: ...: print "NULL VALUE" ...: Mary Bob NULL VALUE J

Re: How is wxWindows related to Python?

2005-10-01 Thread Brett Hoerner
I guess it is referring to the closely related (maybe even same dev group? I don't know why the wxWindows docs would mention Python unless they specifically support the wxPython project, too.) "wxWindows + Python = wxPython wxPython is a Python extension module that provides a set of bindings fro

Re: Set up Windows environment with python

2005-09-29 Thread Brett Hoerner
I don't have experience with scipting this... but I know that resolution for example is stored in registry, and _that_ is what is loaded when you boot. I think most, if not all, of your changes will be found in the registry (for permenance). Also, have you checked out PyWin32? It's just a big pr

Re: What tools are used to write and generate Python Librarydocumentation.

2005-09-27 Thread Brett Hoerner
You get to spend all day in ipython? Can I have your job? -- http://mail.python.org/mailman/listinfo/python-list

Re: number of python users

2005-09-27 Thread Brett Hoerner
RHEL isn't really "big" on Distrowatch because Distrowatch is geared more towards users. RHEL 4.1 is using Python 2.3.4 now, btw. -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling python scripts from C# programs

2005-09-22 Thread Brett Hoerner
David Wilson wrote: > http://www.ironpython.com/ It should be noted that they (?) don't seem to update that site anymore, you can find 0.9.1 here: http://workspaces.gotdotnet.com/ironpython There is also Boo, which is Python-like (with some differences) but is a .NET Language itself. I never und

Re: How am I doing?

2005-09-19 Thread Brett Hoerner
Wouldn't the standard idiom be to actually put the code under the if-name, and not make a whole new main() function? I'm not sure I see the reason behind main(), couldn't that also interfere with other modules since main() seems like it might be common, not sure how it would work as I'm pretty new

Re: Better console for Windows?

2005-06-27 Thread Brett Hoerner
Philippe C. Martin wrote: > You might want to check out ipyhton. I use it. :) I love it. When I meant console I meant the shell app that runs any text-based programs. The windows console was giving me loud beeps, etc, which I've now fixed. Thanks for your reply though, Brett -- http://mail

Re: Better console for Windows?

2005-06-27 Thread Brett Hoerner
Benji York wrote: > To make the console full screen hit Alt-Enter. The same thing makes it > windowed again. To accommodate very long lines click the "C:\" icon in > the upper left corner of the window, choose "Properties" and then change > the "Screen Buffer Size" Width and Height to something m

Re: Better console for Windows?

2005-06-27 Thread Brett Hoerner
Rune Strand wrote: > I know that problem... it's extremely annoying! > Here's one way to solve it; > > 1. Start 'Device manager'. > 2. On the menu, click 'View' and check off "Show hidden devices" > 3. Locate 'Beep' 'under Non-Plug and Play Drivers' > 4. Right-click 'Beep', select 'Disable' Christ

Better console for Windows?

2005-06-27 Thread Brett Hoerner
This is a pretty basic, mostly un-python-related question, although I'm asking because of Python. Is there a different shell I can use (other than cmd.com) to run Python in, where I can full-screen the window (if I pleased), etc? As it is, things that would run far off the right have to be word w