Re: Spam Bot, broken pipe

2009-11-08 Thread Michael Torrie
Someone Something wrote: > I have a irc spam bot (only testing on my channel :P ) whose main loop is > the following: Poor choice of words on your part. Anything spam-related is evil and will not get a response. That said, "IRC bots" are certainly okay and common, and are useful tools. Some are

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-12-03 Thread Michael Torrie
Steven D'Aprano wrote: > But you're right, the convention of using verbs for functions isn't as > strong as the convention of using nouns for classes and types. The idea that functions should be verbs is plain wrong, coming from the traditional world of functional programming. Since functions s

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-12-03 Thread Michael Torrie
Steve Ferg wrote: > Is there any particular reason why this might be a *bad* language- > design idea? Syntactically, using braces, begin/end blocks, python white space, and your if/elif/then/endif structures, amounts to the same thing; they are all equivalent. Thus from a language pov, there's no

Re: Organization of GUIs

2009-12-03 Thread Michael Torrie
Lie Ryan wrote: > On 12/4/2009 12:44 AM, Michael Mossey wrote: >> I have a question about typical organization of GUIs. I will be using >> PyQt. >> > > Model-View-Controller (MVC) pattern. > > Model - all the business logic lives in the model. > View - your GUI > Controller - Takes input No, you

Re: Calendar GUI

2010-02-05 Thread Michael Torrie
Gabriel wrote: > On Fri, Feb 5, 2010 at 9:08 PM, William Gaggioli wrote: >> I'm working on setting up some software for a Peruvian non-profit to help >> them organize their incoming volunteers. One of the features I'd like to add >> is a calendar-like view of the different volunteers arrival dates

Re: Problems with threaded Hotkey application

2009-03-25 Thread Michael Torrie
Anita Whitney wrote: > A window comes up saying "hotkeyapp has stopped working." How do I > get in there to "move the RegisterHotKey line to within the thread's > run method," etc.? Im trying to do this myself and not pay Acer tech > support. Thanks, Anita Whitney Is this a wxPython application t

Re: how to arrange classes in .py files?

2009-03-27 Thread Michael Torrie
Kent wrote: > In java, usually a .java file contains One Class. I read some python > codes, I found one py file can have many classes and functions. Is > there any convention how to manage python classes into .py files? In python we have a real name space, the primary unit being the "module." Thi

Re: unpack the source tarball on Windows

2009-03-31 Thread Michael Torrie
Mensanator wrote: > Thanks. Still had to untar the ball, but I also downloaded a > trial version of Winzip which took care of that. Right. The proper command is: tar -xvjf tarball.tar.bz2 The recommended GUI for all things archival on Windows I think has to be 7zip. And it's not cursed sharewa

Re: is there a way to collect twitts with python?

2009-04-03 Thread Michael Torrie
'2+ wrote: > i found a guy twittin supercollider code > this means his followers can listen to a noiz by activating that 1 line > (well if he has sc installed) > if lots of sc users start twittin ... it would be no good to follow each > > collecting a sc related twitt can be done with python? > if

Re: is there a way to collect twitts with python?

2009-04-03 Thread Michael Torrie
Tim Wintle wrote: > On Fri, 2009-04-03 at 14:58 -0600, Michael Torrie wrote: >> Oh wow. If this is what Twitter does to one's ability to articulate >> clearly, I hope Twitter dies a horrible death and any APIs and Python >> bindings with it! > > Thank you, thank y

Re: Is there a programming language that is combination of Python and Basic?

2009-04-17 Thread Michael Torrie
baykus wrote: > I am looking for one of those experimental languages that might be > combination of python+basic. Now thta sounds weird and awkward I know. > The reason I am asking is that I always liked how I could reference- > call certain line number back in the days. It would be interesting to

Re: Is there a programming language that is combination of Python and Basic?

2009-04-17 Thread Michael Torrie
Mensanator wrote: > I once translated a BASIC program to Pascal (hint: no goto allowed). > The original code had GOSUBs that never executed a REURN because > the programmer jumped away to line numbers on a whim. Biggest piece > of crap I ever had to misfortune to deal with. It's clear that you hav

Re: Is there a programming language that is combination of Python and Basic?

2009-04-17 Thread Michael Torrie
Aahz wrote: > Why do you want to do that? Before you answer, make sure to read this: > http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html Somebody better tell the Linux kernel developers about that! They apparently haven't read that yet. Better tell CPU makers

Re: Exotic Logics

2009-06-18 Thread Michael Torrie
William Clifford wrote: > I've read one can do all of the 16 binary operations with clever uses > of NAND or NOR. That is correct. In fact semiconductor logic is done using these two principle gates. See http://en.wikipedia.org/wiki/NAND_logic . Quite interesting really. -- http://mail.python

Re: [Mac] file copy

2009-06-23 Thread Michael Torrie
Tobias Weber wrote: >> Apple's version of cp is aware of extended attributes. > > Yes, but the manual doesn't say to what extent, nor anything about ACLs mv, cp, etc (but not rsync) are completely aware of resource forks from Tiger on. This is well documented and known on the Mac forums. So shu

Re: C-extension 2 times slower than exe

2009-06-23 Thread Michael Torrie
Rolf Wester wrote: > The runtime is about 2.5 sec and 5.0 sec respectively. I not only use > the time command to measure the time consumed but I also measure the > time within the C-code using clock() and get similar result. So the > Python startup time is not the reason for the runtime difference

Re: [Mac] file copy

2009-06-23 Thread Michael Torrie
Tobias Weber wrote: > Why "so"? shutil does not use bin/cp! That's good to know. I had always thought that that was what shutils did, but you're right; it does not. That said, since cp indeed *can* copy resource forks on Tiger and up, you could use subprocess to call it. Just as an aside, your

Re: A superclass using a child classes' methods

2009-06-24 Thread Michael Torrie
Kurt Schwehr wrote: > I'm trying to build an OO system for encoding and decoding > datapackets. I'd like the parent class to have an encode function > that uses each of the child classes' packing methods. It appears that > this works for attributes of children accessed by the parent, but not > fo

Re: 3.2*2 is 9.6 ... or maybe it isn't?

2009-06-25 Thread Michael Torrie
Bojan Sudarevic wrote: > The first thing I typed into it was 3.2*3 (don't ask why I typed *that*, > I don*t know, I just did). And the answer wasn't 9.6. > > Here it is: > 3.2*3 > 9.6014 I'm surprised how often people encounter this and wonder about it. As I began programming

Re: 3.2*2 is 9.6 ... or maybe it isn't?

2009-06-26 Thread Michael Torrie
Robert Kern wrote: > In the former case, you can claim that decimal floating point is more > accurate > *for those problems*. But as soon as you have a division operation, decimal > floating point has the same accuracy problems as binary floating point. True. Poor choice of words on my part.

Re: Advantages of Python (for web/desktop apps)?

2009-06-29 Thread Michael Torrie
iceangel89 wrote: > i am mainly a PHP (mainly using Zend Framework MVC now) Web Developer. used > .NET (VB & C#) for Desktop apps. i nv used Python and am looking at Python > now (for desktop apps since its open source and just want to try what it > offers, but will like to know what good it has fo

Re: Wrapping comments

2009-07-05 Thread Michael Torrie
Lawrence D'Oliveiro wrote: > I tried using Emacs via SSH from a Mac once. Made me run screaming for the > nearest Windows box > . Interesting rant, but the problem is with the key bindings they chose to use in Terminal.

Re: Examples of Python driven Microsoft UI Automation wanted

2009-07-09 Thread Michael Torrie
DuaneKaufman wrote: > With MS utilities like UISpy and the like, I can 'see' the controls in > the application, but I > do not seem to be able to manipulate them programatically, and I > believe it us simply due > to my not understanding of the UI Automation API. You're probably better off using a

Re: Examples of Python driven Microsoft UI Automation wanted

2009-07-09 Thread Michael Torrie
TheSeeker wrote: > Alternatives to Microsoft's UI Automation are welcome too, but I have > tried using winguiauto and watsup (along with AutoIt), and there seems > to be severe limitations when using these tools with WinForm > applications. http://www.autoitscript.com/forum/index.php?showtopic=967

Re: getopt code NameError exception on logTail.py

2009-07-17 Thread Michael Torrie
LoD MoD wrote: > In this instance the trackback was somewhat unhelpful.There problem was > here: > >file = open(filename, 'r') > > should be > >file = open(a, 'r') > > args should be passed within the getopt riff Well given the code you posted, this little "problem" you

Re: Question regarding style/design..

2009-07-17 Thread Michael Torrie
Wells Oliver wrote: > Sometimes I see relatively small application, generally task scripts, > written as essentially a list of statements. Other times, I see them neatly > divided into functions and then the "if __name__ == '__main__':" convention. > Is there a preference? Is there an... applicatio

Re: GTK+ ques

2009-07-22 Thread Michael Torrie
nipun batra wrote: > I need to develop a GUI preferably in GTK using c or PYGTK.I have little > idea about Python. > Following are requiremnts of the application: > should be GUI > Sould be real time > Should interface serial port > should display moving maps,like google earth > It is basically for

Re: Does python have the capability for driver development ?

2009-07-30 Thread Michael Torrie
MalC0de wrote: > please introduce me some resource for system programming, I know that > python is very well at system programming level. > thanks Although it is possible (as others have said) to embed Python the interpreter into a driver, no one has done that that I know of. You'd have to write

Re: Queryable Daemon

2009-08-03 Thread Michael Torrie
Justin DeCell wrote: > I was hoping for a little help with a project I'm working on. I'm > writing a daemon in python that I want to be queryable (i.e. I should > be able to run foo -s and it will report some internal information > about the foo daemon if it's running) but I can't figure out

Re: What python can NOT do?

2009-08-29 Thread Michael Torrie
qwe rty wrote: > On Aug 29, 5:11 am, Nobody wrote: >> On Fri, 28 Aug 2009 17:26:06 -0700, qwe rty wrote: >>> if you don't know the answer please don't reply >> If you don't understand the question, don't post it in the first place. > > don't be so angry ,not good for your health You forgot your

Re: looking for some libraries

2010-02-12 Thread Michael Torrie
rantingrick wrote: > Well a GUI kit comes to mind. And since you did not mention a > preference (or much really) i would suggest Tkinter in the stdlib as a > starting point. Here is a big hint! I think the original poster is looking for a way to automate an existing GUI process, and screen-scrape

converting datetime with tzinfo to unix timestamp

2010-03-12 Thread Michael Torrie
On Python 2.5 here. I've searched and searched but I can't find any way to convert a datetime object that includes a timezone (tzinfo) to a unix timestamp. Folks on the net say to simply use the timetuple() method of the object and feed that to time.mktime(). But that just doesn't seem to work fo

Re: Searching for most pythonic/least stupid way to do something simple

2010-03-16 Thread Michael Torrie
david jensen wrote: > of course, changing nn's to: > def getOutcomes(myList=[2,5,8,3,5]): >low_id = int(myList[0]>myList[1]) >amountToShare = 2*myList[low_id] >remainder = myList[not low_id]-myList[low_id] >tail=list(myList[2:]) >outcomes = [[amountToShare*perc, remainder+amount

Re: Python is cool!!

2010-03-23 Thread Michael Torrie
Jose Manuel wrote: > Would it be easy to integrate Python in Web pages with HTML? I have > read many info on Internet saying it is, and I hope so Django is, among several other similar projects and frameworks, very popular for generating web apps in Python. I have only used Django and it wor

Re: Unicode blues in Python3

2010-03-24 Thread Michael Torrie
Steven D'Aprano wrote: > I think your question is malformed. You need to work out what behaviour > you actually want, before you can ask for help on how to get it. It may or may not be malformed, but I understand the question. So let eme translate for you. How can he write arbitrary bytes ( 0x0

Re: Getting Local MAC Address

2010-04-02 Thread Michael Torrie
On 04/02/2010 03:30 PM, Dan McLeran wrote: > i'm running python 2.6 on win xp sp3 and i get: Your code isn't portable to non-Windows OS's. On my Mac and on my Linux workstations it simply doesn't work. Using '/usr/sbin/ifconfig' as the executable name in Popen does work, however. The OP didn't

Re: Getting Local MAC Address

2010-04-02 Thread Michael Torrie
On 04/02/2010 02:14 PM, Booter wrote: > I am new to python ans was wondering if there was a way to get the mac > address from the local NIC? As Dan has indicated, you have to Popen an external command to get this information. Every OS has different commands and syntaxes for this. You'll have to h

Re: Getting Local MAC Address

2010-04-04 Thread Michael Torrie
On 04/02/2010 04:01 PM, Dan McLeran wrote: > which is why my OP stated the solution was for windows: > > "for windows parse > p.stdout.read():" Gotcha. Definitely missed that! -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommend Commercial graphing library

2010-04-06 Thread Michael Torrie
On 04/06/2010 10:05 AM, AlienBaby wrote: > The requirement for a commercial license comes down to being > restricted to not using any open source code. If it's an open source > license it can't be used in our context. Python itself and all its standard libraries are open source, under the PSF lice

Re: python as pen and paper substitute

2010-04-07 Thread Michael Torrie
On 04/06/2010 12:40 PM, Manuel Graune wrote: > Hello everyone, > > I am looking for ways to use a python file as a substitute for simple > pen and paper calculations. At the moment I mainly use a combination > of triple-quoted strings, exec and print (Yes, I know it's not exactly > elegant). Thi

Re: python as pen and paper substitute

2010-04-09 Thread Michael Torrie
On 04/08/2010 02:54 PM, Manuel Graune wrote: > > Well, the subject does say python and not elisp, but I'm a vim-user > anyways. Did you look at the link to Owen Taylor's reinteract program? I think it's closer to what you want than any other thing mentioned here, with the exception that it's a

Re: Add a method to a gtk class?

2010-04-29 Thread Michael Torrie
On 04/29/2010 10:03 AM, Wolfnoliir wrote: > On 29/04/2010 17:03, Joe Riopel wrote: >> On Thu, Apr 29, 2010 at 11:43 AM, Wolfnoliir wrote: >>> I would like to add a method to the gtk.TextBuffer class to save a text >>> buffer to a file, but I get an error: >> >> I don't know gtk, but can you inheri

Re: Compare source code

2010-11-03 Thread Michael Torrie
On 11/03/2010 02:39 PM, Seebs wrote: > Furthermore, I don't WANT to skip closing braces. EXPLICIT IS BETTER > THAN IMPLICIT. I *WANT* to have the beginnings and ends marked. I suggest, then that Pascal or Ruby would suit your needs better than Python. > I want end braces or "end" or something a

Re: Compare source code

2010-11-08 Thread Michael Torrie
On 11/06/2010 02:27 AM, Seebs wrote: > On 2010-11-06, Steve Holden wrote: >> If someone were to use a text editor which had always historically >> mangled whitespace I would find myself wondering why they found it >> necessary to restrict themselves to such stone-age tools. > > I have yet to find

Re: is list comprehension necessary?

2010-11-21 Thread Michael Torrie
On 10/27/2010 05:37 AM, Roy Smith wrote: > I agree. I resisted LCs when they first came out, passing them off as > unnecessary, confusing, etc. Eventually, I came to be comfortable with > them and use them often. I do use LCs fairly often, but only then a for loop would be ugly or inefficient.

Re: Print to an IPP printer (pkipplib?)

2011-01-10 Thread Michael Torrie
On 10/16/2010 10:49 AM, Adam Tauno Williams wrote: > I've found the module pkipplib which seems to work well for things like > interrogating an IPP (CUPS) server. But is there a way to send a print > job to an IPP print queue? [and no, the local system knows nothing about > the print architecture

Re: Tkinter: The good, the bad, and the ugly!

2011-01-19 Thread Michael Torrie
On 01/19/2011 05:01 PM, geremy condra wrote: > On Wed, Jan 19, 2011 at 3:04 PM, rantingrick wrote: >> And you've also lost all >> connection with the people. I am desperately trying to to snap you out >> of this psychosis before it is too late! Tkinter will be the downfall >> of Python if we canno

Re: Tkinter: The good, the bad, and the ugly!

2011-01-21 Thread Michael Torrie
On 01/20/2011 11:17 AM, Emile van Sebille wrote: > The problem with QT is the license. PyQT indeed is licensed poorly for anything that's not GPL. But Qt itself is dual-licensed under GPL and the LGPL, as of version 4.6 I think. The LGPL license would seem to be quite acceptable even for commerc

Re: WxPython versus Tkinter.

2011-01-25 Thread Michael Torrie
On Sun, 23 Jan 2011 09:21:57 -0800, rantingrick wrote: > Wait a minute, i am confused? What language is Python written in? Oh > thats right Lisp! I am so dumb. How did i even get this job? :-) What job is this? Inquiring minds wish to know. -- http://mail.python.org/mailman/listinfo/python-list

Re: WxPython versus Tkinter.

2011-01-25 Thread Michael Torrie
On 01/23/2011 02:11 PM, Littlefield, Tyler wrote: > I hardly think that your tone, attitude and arguments are going to help > you in your battle to prove that WXPython is superior to anything at > all, if you can't manage to provide cross-platform bug-free code. Sadly you're wasting your breath

Re: How to create an entry in the "Program menu" of Windows?

2011-02-01 Thread Michael Torrie
On 02/01/2011 02:43 PM, Diesel wrote: > I'd like to add menu entry in the Program Menu as part of the > installation of an application. Is it possible to do that from Python? > > Any examples or link? I have not been able to find anything with > google... Use an installer program like nsis to cr

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-01 Thread Michael Torrie
On 02/01/2011 08:26 AM, Noah Hall wrote: > On Tue, Feb 1, 2011 at 3:14 PM, rantingrick wrote: >> #-- Embedded Trolls and Minions --# > These people, including myself, aren't trolls nor minions. They just > don't agree with you. I strongly disagree with rr and find him to be an egotistical troll w

Re: How to use Python well?

2011-02-17 Thread Michael Torrie
On 02/16/2011 04:00 PM, Steven D'Aprano wrote: > You should read about bottom-up and top-down programming. You'll probably > end up doing some of both, but mostly top-down. Most of my development is done by designing top-down and then coding bottom-up. Coding top down is fine, but I'd expect to

Re: Newbie getting desperate with for

2011-02-18 Thread Michael Torrie
On 02/17/2011 04:10 PM, Werner wrote: > It is meant to put load on a CPU, RAM and disk (swap). The code now > looks like this: > #!/usr/bin/python > while True: > i = 0 > for i in range(2000): > break Just for your information, your code is the equivalent of: while True: t

Re: Newbie getting desperate with for

2011-02-18 Thread Michael Torrie
On 02/17/2011 09:15 PM, Larry Hudson wrote: > A true time waster indeed -- it's an infinite loop that will _never_ end. > > Others have already about the need of the shebang line to run as a python > script, but I'm > surprised no one mentioned how truly useless this code is. > > The i = 0 line

Re: Python vs. Fedora and CentOS

2010-06-01 Thread Michael Torrie
On 05/31/2010 05:13 AM, Jason D wrote: > There is however never been an issue to locate different version of python > in your system as you deem fit without problems. > So I dont understand why your concern. Actually, replacing python on RHEL is a major endeavor. Almost all Red Hat utilities ar

Re: Python vs. Fedora and CentOS

2010-06-01 Thread Michael Torrie
On 06/01/2010 05:01 AM, Adam Tauno Williams wrote: > Yes, we install Python 2.6 on CentOS and run a production app on it - no > problems. > > rpm -Uvh > http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1-4.ius.el5.noarch.rpm > > yum -y install python26 python26-setuptools Than

Re: Python Forum

2010-06-04 Thread Michael Torrie
On 06/03/2010 04:15 AM, Adam Tauno Williams wrote: > The best solution I've seen is what is used by the Mono project; > which provides both a "web forum" and a mail list interface. > > > I just checked the archives

Re: GUIs - A Modest Proposal

2010-06-05 Thread Michael Torrie
On 06/05/2010 08:22 PM, ant wrote: > WxPython and PyGtk are both powerful, but quirky in different ways. > PyQt is tied to one platform. And there are dozens more. In what way is PyQt (or the new PySide bindings) tied to one platform? PyQt is "native" on Win32, Mac, and Linux. Would your univers

Re: GUIs - A Modest Proposal

2010-06-07 Thread Michael Torrie
On 06/06/2010 02:13 AM, Gabriele Lanaro wrote: > I'd really like to s/tkinter/WxWidgets/g, the multiplatformness is (almost) > the same but wx looks infinitely better. IMHO a good intention is to best > the API of wx. Does WX still do weird things like use event message maps instead of a sane sign

Re: GUIs - A Modest Proposal

2010-06-07 Thread Michael Torrie
On 06/06/2010 04:55 PM, ant wrote: > What an interesting set of responses I got! > And - even more interesting - how few of them actually seem to think > there is a problem, let > alone make any attempt to move the situation forward. You simply haven't made a case that there is a problem to be sol

Re: GUIs - A Modest Proposal

2010-06-07 Thread Michael Torrie
On 06/07/2010 09:19 PM, rantingrick wrote: > On Jun 7, 5:05 pm, Michael Torrie wrote: > >> Thus for Python to really be successful in a broader sense, we need >> good, solid, bindings for Cocoa, or Windows forms (whatever they are >> using these days), as well as

Re: GUIs - A Modest Proposal

2010-06-13 Thread Michael Torrie
On 06/13/2010 05:29 AM, lkcl wrote: > really? drat. i could have done with knowing that at the time. > hmmm, perhaps i will return to the pyqt4 port after all. We're now wandering well off-topic here, but then again this thread was never really on any particular topic. I have to say I'm really

Re: Community (A Modest Proposal)

2010-06-15 Thread Michael Torrie
On 06/15/2010 01:30 AM, Steven D'Aprano wrote: > I know that lots of people swear by IDEs, and back in Ancient Days I used > to use the THINK Pascal IDE on a Macintosh so I'm not hostile to the > idea. But in those days you could only run one app at a time, so you > needed an IDE or you'd go ins

Re: basic doubt

2010-06-16 Thread Michael Torrie
On 06/16/2010 11:06 PM, madhuri vio wrote: > def h(self,event): > handle = open("myco.fasta","r") > for seq_record in SeqIO.parse(handle, "fasta"): > messenger_rna = coding_myco.fasta.transcribe() > han1 = open("mycorna.fasta","wU") > han1.close() > retur

Re: Python 2.4.4 Tkinter GUI Example for Modeless Dialog with Menu, Edit, List, Buttons, File Save etc.

2010-06-16 Thread Michael Torrie
On 06/16/2010 04:05 PM, My Python wrote: > I would like to see some substantial example of an App written for a > Modeless Dialog (fixed size, non resizable window) (If you have used > WIndows MFC or Visual Basic you all know how elegant it is) What is elegant about a fixed-size, non-re-sizable w

Re: Python 2.4.4 Tkinter GUI Example for Modeless Dialog with Menu, Edit, List, Buttons, File Save etc.

2010-06-16 Thread Michael Torrie
On 06/17/2010 12:50 AM, Michael Torrie wrote: > On 06/16/2010 04:05 PM, My Python wrote: >> I would like to see some substantial example of an App written for a >> Modeless Dialog (fixed size, non resizable window) > > Tk? PyQt? PyGTK? wxPython? Nevermind that question. Yo

Re: scraping from bundes-telefonbuch.de with python

2010-06-19 Thread Michael Torrie
On 06/19/2010 04:23 AM, davidgp wrote: > opener = urllib2.build_opener() > opener.addheaders = [('User-Agent', 'Mozilla/5.0 (compatible; > Konqueror/3.5; Linux) KHTML/3.5.4 (like Gecko)')] > urllib2.install_opener(opener) > > data = urllib.urlencode({'F0': 'mySearchKeyword','B': 'T','F8': 'A || >

Re: How to send a non-standard IMAP command?

2010-06-24 Thread Michael Torrie
On 06/24/2010 03:47 AM, Xianwen Chen wrote: > . This is what I'm now working for. I tried: > > IMAP4.xatom('','ID ("GUID" "1")','',) > > and > > dest_srv.xatom('ID ("GUID" "1")') > > , but I got error messages. Any hint please? What error messages? -- http://mail.python.org/mailman/listinfo/p

Re: How to send a non-standard IMAP command?

2010-06-24 Thread Michael Torrie
On 06/24/2010 03:47 AM, Xianwen Chen wrote: > , but I got error messages. Any hint please? Why not just use a proxy server: http://sourceforge.net/projects/imapidproxy/ -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to increment an IntVar?

2010-06-26 Thread Michael Torrie
On 06/25/2010 04:15 PM, Emile van Sebille wrote: > Idle is dead -- long live idlefork! > > http://osdir.com/ml/python.idle/2002-09/msg00105.html Actually idlefork is dead. It was merged back into Idle sometime around Python 2.3. At least that's what its homepage claims. -- http://mail.python.o

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Michael Torrie
On 06/28/2010 05:48 AM, Dave Pawson wrote: > Main queries are: Ease of calling out to bash to use something like > imageMagick or Java? Ease of grabbing return parameters? E.g. convert > can return both height and width of an image. Can this be returned to > the Python program? Can Python access th

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Michael Torrie
On 06/28/2010 12:05 PM, Dave Pawson wrote: > On 28 June 2010 18:39, Michael Torrie wrote: > >> Sure. I've created a module called runcmd that does 90% of what I >> want (easy access to stdout, stderr, error code). I've attached >> it to this e-mail. Feel

Re: Python dynamic attribute creation

2010-06-28 Thread Michael Torrie
On 06/25/2010 09:39 PM, WANG Cong wrote: > Thanks, I have to admit that I know nothing about Smalltalk. If you know nothing about Smalltalk then you really aren't in a position to talk about what is and is not OOP. Smalltalk is one of the original OOP languages and purists define OOP as the model

Re: Python dynamic attribute creation

2010-06-28 Thread Michael Torrie
On 06/27/2010 11:58 PM, Stephen Hansen wrote: > To say you can't really know "much about" OOP without knowing "much > about" Smalltalk seems basically, well, wrong. True. But you can't really criticize a language's implementation of OOP without a good understanding of the "pure" OO language. Fo

Re: Python dynamic attribute creation

2010-06-28 Thread Michael Torrie
On 06/28/2010 02:31 PM, Aahz wrote: > In article , > Michael Torrie wrote: >> True. But you can't really criticize a language's implementation of OOP >> without a good understanding of the "pure" OO language. For example, in >> Smalltalk If/The

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Michael Torrie
On 06/28/2010 02:06 PM, Mithrandir wrote: > I can't see Python as an alt. to bash. (As I recall) Python is much more > object-oriented than bash, but also there are many commands (such as apt- > get, etc.) that would need Python equivs. However, I can see Python being > used as a scripting alt. t

Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Michael Torrie
On 06/29/2010 06:25 PM, Lawrence D'Oliveiro wrote: > I have yet to find an architecture or C compiler where it DOESN’T work. > > Feel free to try and prove me wrong. Okay, I will. Your code passes a char** when a char* is expected. Every compiler I know of will give you a *warning*. Mistaking c

Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Michael Torrie
On 06/29/2010 06:26 PM, Lawrence D'Oliveiro wrote: >> I'm not sure you understood me correctly, because I advocate >> *not* doing input sanitization. Hard or not -- I don't want to know, >> because I don't want to do it. > > But no-one has yet managed to come up with an alternative that involves l

Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Michael Torrie
On 06/29/2010 10:05 PM, Michael Torrie wrote: > #include > > int main(int argc, char ** argv) > { > char *buf = malloc(512 * sizeof(char)); > const int a = 2, b = 3; > snprintf(&buf, sizeof buf, "%d + %d = %d\n", a, b, a + b);

Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Michael Torrie
On 06/29/2010 10:17 PM, Michael Torrie wrote: > On 06/29/2010 10:05 PM, Michael Torrie wrote: >> #include >> >> int main(int argc, char ** argv) >> { >> char *buf = malloc(512 * sizeof(char)); >> const int a = 2, b = 3; >> snprintf(&a

Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Michael Torrie
On 06/30/2010 03:00 AM, Jorgen Grahn wrote: > On Wed, 2010-06-30, Michael Torrie wrote: >> On 06/29/2010 10:17 PM, Michael Torrie wrote: >>> On 06/29/2010 10:05 PM, Michael Torrie wrote: >>>> #include >>>> >>>> int main(int argc, char ** arg

Re: [farther OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Michael Torrie
On 06/30/2010 06:36 PM, Lawrence D'Oliveiro wrote: > In message , > Michael Torrie wrote: > >> Okay, I will. Your code passes a char** when a char* is expected. > > No it doesn’t. You're right; it doesn't. Your code passes char (*)[512]. warning: p

Re: [farther OT] Re: Why Is Escaping Data Considered So Magical?

2010-07-01 Thread Michael Torrie
On 07/01/2010 01:24 AM, Nobody wrote: > No, the type of "buf" is "char [512]", i.e. "array of 512 chars". If you > use "buf" as an rvalue (rather than an lvalue), it will be implicitly > converted to char*. Yes this is true. I misstated. I meant that most text books I've seen say to just use the

Re: drag & drop in a python GUI application

2010-07-02 Thread Michael Torrie
On 07/01/2010 08:57 AM, Alan wrote: > I know drag & drop is not possible with TK. Is this a Python Tk limitation or a Tk limitation in general? Google suggests that Tk itself supports some form of dnd. > Which widget could I use for my > python application to be able to work with drag & drop?

Re: Getting the name of the file that imported current module

2010-07-04 Thread Michael Torrie
On 07/04/2010 03:17 PM, Mark Lawrence wrote: > On 04/07/2010 22:05, Tobiah wrote: >> foo.py: >> >> import bar >> bar.show_importer() >> >> output: >> >> 'foo' or 'foo.py' or 'path/to/foo' etc. >> >> Possible? >> >> Thanks, >> >> Tobiah > > >>> import re > >>> re.__file__ > 'C:\\Python26\\lib\\re

Re: Python as a scripting language. Alternative to bash script?

2010-07-06 Thread Michael Torrie
On 07/06/2010 04:12 AM, sturlamolden wrote: > On 28 Jun, 19:39, Michael Torrie wrote: > >> In python I could simply take the output of "ps ax" and use python's >> own, superior, cutting routines (using my module): >> >> (err, stdout, stder

Re: Python as a scripting language. Alternative to bash script?

2010-07-07 Thread Michael Torrie
On 07/06/2010 09:34 PM, Chris Rebert wrote: > On Tue, Jul 6, 2010 at 6:40 AM, Michael Torrie wrote: >> While it's possible to set up pipes and spawn programs in parallel to >> operate on the pipes, in practice it's simpler to tell subprocess.Popen >> to use a she

Re: any issues with long running python apps?

2010-07-09 Thread Michael Torrie
On 07/09/2010 01:13 PM, Les Schaffer wrote: > or need we only concern ourselves with the nuts behind the wheel:that > is, we the developers? It never hurts to separate the data collection and visualization/analysis parts into separate programs. That way you can keep the critical, long-running da

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Michael Torrie
On 07/11/2010 12:50 AM, rantingrick wrote: > Ah yes, when nothing else seems to work fall back to you default > programming... FUD and ad hominem attacks Please stop calling things what they are not. Stephen's post was not an ad hominem attack, nor was it FUD. Someone who is countering your pre

Re: Easy questions from a python beginner

2010-07-11 Thread Michael Torrie
On 07/11/2010 11:48 AM, wheres pythonmonks wrote: > I'm an old Perl-hacker, and am trying to Dive in Python. I have some > easy issues (Python 2.6) > which probably can be answered in two seconds: > > 1. Why is it that I cannot use print in booleans?? e.g.: True and print "It is true!" Th

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-12 Thread Michael Torrie
On 07/12/2010 06:18 PM, Steven D'Aprano wrote: > Early versions of BASIC used -1 as true and 0 as false. They did this for good reason. BASIC had no logical operators. AND, OR, and NOT were all actually bitwise operators. By making the True value -1, the bitwise operations yielded the result on

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-12 Thread Michael Torrie
On 07/12/2010 06:36 PM, Paul Rubin wrote: > I'd personally prefer > > if not bool(myValue): > > which would call the myValue's __bool__ method if it chose to implement > one. Explicit is better than implicit. That's just ugly. Probably a more explicit way would be to have an is_true() and

Re: detect endianness of a binary with python

2010-07-21 Thread Michael Torrie
On 07/21/2010 08:02 AM, Grant Edwards wrote: > On 2010-07-21, Holger brunck wrote: > >> I use python 2.5 and I am looking for a possibility to determine a >> file type. Especially the endianness of a file is needed for me. Is >> there a way to detect this easily in python? > > Only if you alread

Re: Why is python not written in C++ ?

2010-08-01 Thread Michael Torrie
On 08/01/2010 07:09 PM, John Bokma wrote: >> One thing that comes to mind is that it's much easier to distribute C >> libraries than C++ libraries. > > In the beginning of C++ there were programs that just converted C++ to C > (frontends). At least that is how the C++ compiler Acorn sold worked.

Re: constructing and using large lexicon in a program

2010-08-02 Thread Michael Torrie
On 08/02/2010 11:46 AM, Majdi Sawalha wrote: > I am developing a morphological analyzer that depends on a large lexicon. i > construct a Lexicon class that reades a text file and construct a dictionary > of > the lexicon entries. > the other class will use the lexicon class to chech if the word

Re: Why is python not written in C++ ?

2010-08-02 Thread Michael Torrie
On 08/02/2010 03:42 PM, Mark Lawrence wrote: > I can't understand why any serious programmer mentions C++. As soon as I > read it, I have to rush either to the kitchen to find a bowl to throw up > in, or head for the toilet so I can talk to the great white telephone. Sometimes, C++ is just the r

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread Michael Torrie
On 08/06/2010 07:56 PM, dmtr wrote: > Ultimately a dict that can store ~20,000,000 entries: (u'short > string' : (int, int, int, int, int, int, int)). I think you really need a real database engine. With the proper indexes, MySQL could be very fast storing and retrieving this information for you.

Re: new to python - trouble calling a function from another function

2010-08-06 Thread Michael Torrie
On 08/05/2010 01:25 AM, Brandon McCombs wrote: > How can that be? I don't get any errors when the script > executes. Surely this isn't some limitation I'm encountering? > > > yield (p.destination - self.currenteFloor) * TRAVELTIME, self ^ To be succinct, goUp(

Re: Python Portability

2010-08-07 Thread Michael Torrie
On 08/07/2010 01:17 PM, W. eWatson wrote: > Presumably I have him somehow delete the numpy site-package, the numpy > 1.2.0 package? Just drill his way dow from the .../lib/site_packages? > Then install 1.2.0. He's missed the boat on that before by not following > instructions. Wait. I'm confus

  1   2   3   4   5   6   7   8   9   10   >