wxPython Grid Question

2006-08-16 Thread Jordan
Hey Peoples, I'm wonderg if there is a way to make a subclass of wx.grid.Grid in which the coloumn labels for the grid appear on the bottom of the grid instead of the top. 1 2 3 4 5 a| | | | | | b| | | | | | c| | | | | | d| | | | | | e| | | | | |

Re: uploading files to file system/zipping/downloading problems

2006-08-20 Thread Jordan
Assuming your upload_file.file.read() function works, the overwriting should be the only issue. Just want to point out that total_data += data is not advisable for this example (speed/efficiency issue, although i'm sure it could probably be even faster than what I replace it with if u decided to u

Re: intercepting keypresses, mouse movements, joystick movements.

2006-10-09 Thread Jordan
on't think that's covered), or for detecting system or dead keys (unless pyHook has been updated recently, the last time I checked the docs said it didn't capture those keys). Good Luck, Jordan TheSeeker wrote: > bryan rasmussen wrote: > > Hi, > > > > I'

Re: external file closed

2006-10-17 Thread Jordan
loopholes, such as if there is more than one pdf open. Cheers, Jordan utabintarbo wrote: > Jerry wrote: > > On Oct 17, 12:43 pm, "kilnhead" <[EMAIL PROTECTED]> wrote: > > > I am opening a file using os.start('myfile.pdf') from python. How can I > >

Re: 3d programming without opengl

2006-11-01 Thread Jordan
I don't thnk you should have any problems using Slut with wxpython - wx would be much less amazing if it couldn't do something like that. On the other hand, I thought that you were looking for something that doesn't use openGL and I think that Slut is built around it. Cheers,

Re: help using smtplib to work ..

2006-11-08 Thread Jordan
Your post was definitely the most helpful for me. For some reason, smtp for gmail seems to require that you call server.ehlo() a second time, after having called server.starttls(), otherwise, the server won't accept authorization. Thanks. -Jordan Gabriel Genellina wrote: > At Wednes

Re: Python development time is faster.

2006-11-14 Thread Jordan
ly just to download python and tinker with it, maybe try making some python equivalents to whatever you've made in other languages. Cheers -Jordan Hendrik van Rooyen wrote: > "Chris Brat" <[EMAIL PROTECTED]> wrote: > > > > I've seen a few posts, columns an

Re: Running python from a usb drive

2006-09-11 Thread Jordan
If making a usb version of python was that easy, movable python would be open source. Check out http://www.voidspace.org.uk/python/movpy/ if you need a portable usb version of python for work or something. Copying the Python24 directory is a good start, but doesn't include the enormous number of r

Re: Writing Video conference software for Windows

2006-09-19 Thread Jordan
If you're going to need win32 system access use the win32all python extension (very, very good extension). Do you need single frame image capture, or constant video stream? PIL can be used for the first, it might also be usable for video, I'm not sure. For sound, python comes with some built in li

Re: XSLT speed comparisons

2006-09-29 Thread Jordan
If your using python 2.4.3 or essentially any of the 2.3, 2.4 series, i'd test out PyScripter as an IDE, it's one of the best that I've used. Unfortunately, they have yet to fully accomedate 2.5 code (you can still write 2.5 code with almost no problems, but you won't be able to use a 2.5 interact

Re: XSLT speed comparisons

2006-09-29 Thread Jordan
be able to use a 2.5 interactive interpeter). Good Luck Jordan Damian wrote: > Sorry about the multiple posts folks. I suspect it was the "FasterFox" > FireFox extension I installed yesterday tricking me. > > I had a brief look at libxml(?) on my Ubuntu machine but haven't r

Re: How to create a global hotkey?

2006-12-07 Thread Jordan
entional keyloggers built in C/C++ which hide themselves from the OS - the purpose was not actually to spy on the user but to create backups of what was typed - it still does a very good job and the latest release has a lot of options and extendability). If your OS is linux, unix, or mac... good

Tarfile .bz2

2006-12-11 Thread Jordan
h must end in "\\" for this to work info = archive.gettarinfo(nthing) archive.addfile(info,file(nthing,'rb')) archive.close() --- Thanks, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: Tarfile .bz2

2006-12-11 Thread Jordan
really on topic anymore but what's the method for tar.gz? And even more off the topic, does anyone know a good lossless compression method for images (mainly .jpg and .png)? Cheers, Jordan Wolfgang Draxinger wrote: > Jordan wrote: > > > When using python to create a tar.

Re: How to manage two (different) sockets without using threads?

2006-12-13 Thread Jordan
Why are you trying to make this asynchronous? I think part of the point of ftp using two sockets was to make it multithreaded. If you're going to make it asynchronous, It's probably going to be easier to do the "select"ing yourself, instead of relying on asyncore or asynchat. Unless you have an i

Re: pyHook or SetWindowsHookEx

2007-03-03 Thread Jordan
x27;t log the keystrokes of someone who is logged onto your machine from another; that would be a major security flaw. The only way (I think) this would work is if you wrote your own remote desktop program that logged keystrokes, and then sent it to the remote computer when logging off. Cheers, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading a portion of a file

2007-03-08 Thread Jordan
On Mar 8, 11:52 am, "Rune Strand" <[EMAIL PROTECTED]> wrote: > On Mar 8, 5:12 pm, [EMAIL PROTECTED] wrote: > > > I am using a script with a single file containing all data in multiple > > sections. Each section begins with "#VS:CMD:command:START" and ends > > with "#VS:CMD:command:STOP". There is a

Re: Reading a portion of a file

2007-03-08 Thread Jordan
On Mar 8, 12:46 pm, "Jordan" <[EMAIL PROTECTED]> wrote: > On Mar 8, 11:52 am, "Rune Strand" <[EMAIL PROTECTED]> wrote: > > > > > On Mar 8, 5:12 pm, [EMAIL PROTECTED] wrote: > > > > I am using a script with a single file containing

Re: logging and wx.Timer

2007-03-14 Thread Jordan
On Mar 14, 1:52 am, hg <[EMAIL PROTECTED]> wrote: > Hi, > > I read that logging was thread safe ... but can I use it under a GUI timer ? > > Thanks, > > hg That was barely enough information to be worthy of a reply. Need more than that. What do you mean under a gui timer? What gui? What type of

Re: python noob, multiple file i/o

2007-03-16 Thread Jordan
g open() over file() (although I admit to using file() myself more often than not) >>for filename in matching_file_list: >> infile = open(filename,'r') # add 'r' for clarity if nothing else >> outfile = open(filename[:-4] + '.out.txt','w') # assumes file ext of >> original file is .txt >> # Process the input file line by line... >> for line in infile: >> pass # do thing --> you don't have to iterate line by line, if you >> specified what you wanted to do to each file we could probably help out here >> if you need it. >> # Be explicit with file closures >> outfile.close() >> infile.close() Might also add some try/except statements to be safe ;). Cheers, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: running applications in python

2007-01-25 Thread Jordan
don't really need to redirect input/output/errors or other aspects of the opened application.Also, you'll probably want something more like: retcode = sp.call(...), so that you can check the return code to see if it was successful. Check out the subprocess module. Cheers, Jordan On J

Re: asyncore.dispatcher.handle_read

2007-01-25 Thread Jordan
help. Good luck. Cheers, Jordan On Jan 25, 12:18 pm, Indy <[EMAIL PROTECTED]> wrote: > Greetings. > > I am writing an asynchronous server, and I use the standard library's > module asyncore. > I subclass asyncore.dispatcher. handle_accept works just right, that >

Re: Running long script in the background

2007-02-07 Thread Jordan
On Feb 6, 8:26 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > > I am trying to write a python cgi that calls a script over ssh, the > problem is the script takes a very long time to execute so Apache > makes the CGI time out and I never see any output. The script is set > to print a

Re: Download parts not whole file in ones

2007-02-13 Thread Jordan
> In my example it just download the whole file, and then print it. > > Any suggestions? > > Regards > Andreas That's because urllib.urlopen() is not a low enough level function to allow what you want, it will simply open the . Take a look inside of urllib.py and maybe you'l

Re: Download parts not whole file in ones

2007-02-13 Thread Jordan
On Feb 13, 12:51 pm, "Jordan" <[EMAIL PROTECTED]> wrote: > On Feb 13, 8:09 am, NOSPAM plz <[EMAIL PROTECTED]> wrote: > > > > > Hey, > > > My problem is, is it possible to download parts of a file while. i think > > is it is called thread

Re: How to write a programe that include both pipe(low speed system call) and signal

2007-02-15 Thread Jordan
ou > > -- > LinuX Power Take a look at the subprocess module, which is meant to replace popen[1,2,3...](). Also, please try to explain the problem again, because I just can't decypher everything you're trying to do (and say). cheers, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: Help Required for Choosing Programming Language

2007-02-20 Thread Jordan
using C++ over Python for gui building is if for some obscure reason Python wasn't fast enough. On the other hand, this brings up the argument of which is faster: Python or C++ ;) so let's not get into that. Python + WxPython = Good Language with Good GUI Toolkit. Cheers, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading compressed files

2007-02-21 Thread Jordan
em if you know the syntax for each of these files. What you need to do is research each syntax and write a regexp or other string searching function to determine each format based on the archive header syntax. While you're at it, open a few archives with a hex editor or using open(...,'rb') and take a look at the syntax of each file to see if you can determine it yourself. Goodluck. Cheers, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I track/monitor an application and system resources.

2007-02-22 Thread Jordan
t search for taskmanager extensions on codeproject.com or look at the msdn on taskmanager to see how it gets all of its information (which is essentially what you want -- a taskmanager). Either way you'll almost defitely need pywin32, so look there first. Cheers, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: implement random selection in Python

2007-11-16 Thread Jordan
;t think of any other obvious way of generalising the behaviour of the N = 1 case. - Jordan On Nov 17, 10:50 am, Bruza <[EMAIL PROTECTED]> wrote: > On Nov 16, 4:47 pm, Bruza <[EMAIL PROTECTED]> wrote: > > > > > > > On Nov 16, 6:58 am, duncan smith <[EMAIL P

Re: implement random selection in Python

2007-11-16 Thread Jordan
weightings is 100.) Not sure if it satisfies the conditions in my last post either do some empirical testing, or some mathematics, or maybe a bit of both. On Nov 17, 12:02 pm, Jordan <[EMAIL PROTECTED]> wrote: > Maybe it would help to make your problem statement a litte rigorous so

Unicode File Names

2008-10-16 Thread Jordan
I've got a bunch of files with Japanese characters in their names and os.listdir() replaces those characters with ?'s. I'm trying to open the files several steps later, and obviously Python isn't going to find '01-.jpg' (formally '01-ひらがな.jpg') because it doesn't exist. I'm not sure where in th

Re: Unicode File Names

2008-10-16 Thread Jordan
On Oct 16, 9:20 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Oct 17, 11:43 am, Jordan <[EMAIL PROTECTED]> wrote: > > > I've got a bunch of files with Japanese characters in their names and > > os.listdir() replaces those characters with ?'s. I'm try

Re: Unicode File Names

2008-10-16 Thread Jordan
On Oct 16, 10:18 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Oct 17, 12:52 pm, Jordan <[EMAIL PROTECTED]> wrote: > > > > > On Oct 16, 9:20 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > > On Oct 17, 11:43 am, Jordan <[EMAIL PROTECTED]> wr

Re: Unicode File Names

2008-10-16 Thread Jordan
On Oct 16, 10:18 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Oct 17, 12:52 pm, Jordan <[EMAIL PROTECTED]> wrote: > > > > > On Oct 16, 9:20 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > > On Oct 17, 11:43 am, Jordan <[EMAIL PROTECTED]> wr

error when porting C code to Python (bitwise manipulation)

2008-07-09 Thread Jordan
I am trying to rewrite some C source code for a poker hand evaluator in Python. Putting aside all of the comments such as just using the C code, or using SWIG, etc. I have been having problems with my Python code not responding the same way as the C version. C verison: unsigned find_fast(unsign

Re: error when porting C code to Python (bitwise manipulation)

2008-07-09 Thread Jordan
I was actually just going through an example to show what was happening each step of the way and noticed the overflow!!! bah, stupid tricks tricks tricks!!! The problem is def the overflow, I notice that I start to get negative numbers in the C version, which makes me think that the & 0x t

Re: error when porting C code to Python (bitwise manipulation)

2008-07-09 Thread Jordan
I realize I did a pretty bad job of explaining the problem. The problem is the python version is returning an r that is WY to big. Here is an example run through that function in each language: C: u starts at 1050 u += 0xe91aaa35; u is now -384127409 u ^= u >> 16; u

Re: error when porting C code to Python (bitwise manipulation)

2008-07-09 Thread Jordan
if after the first step (u += 0xe91aaa35) you apply this function: invert = lambda x: ~int(hex(0x - x)[0:-1],16) it returns the correct value (corrected the overflow) but there is still something wrong, still looking into it, if someone knows how to do this, feel free to comment :) -- ht

Re: error when porting C code to Python (bitwise manipulation)

2008-07-10 Thread Jordan
Well, I have figured out something that works: def findit(u): u += 0xe91aaa35 u1 = ~(0x - u) ^ u >> 16 u1 += ((u1 << 8) & 0x) u1 ^= (u1 & 0x) >> 4 b = (u1 >> 8) & 0x1ff a = (u1 + (u1 << 2) & 0x) >> 19 r = int(a) ^ hash_adjust[int(b)]

Re: error when porting C code to Python (bitwise manipulation)

2008-07-10 Thread Jordan
On Jul 10, 1:35 pm, MRAB <[EMAIL PROTECTED]> wrote: > On Jul 10, 4:56 am, Jordan <[EMAIL PROTECTED]> wrote: > > > > > I am trying to rewrite some C source code for a poker hand evaluator > > in Python.  Putting aside all of the comments such as just using th

Re: error when porting C code to Python (bitwise manipulation)

2008-07-10 Thread Jordan
On Jul 10, 4:04 pm, Harald Luessen <[EMAIL PROTECTED]> wrote: > On Thu, 10 Jul 2008 Jordan wrote: > > > > >On Jul 10, 1:35 pm, MRAB <[EMAIL PROTECTED]> wrote: > >> On Jul 10, 4:56 am, Jordan <[EMAIL PROTECTED]> wrote: > > >> > I am try

Re: error when porting C code to Python (bitwise manipulation)

2008-07-10 Thread Jordan
Well, that about wraps this up...MRAB was 100% correct, that solution worked...not sure how I managed to mess it up when I tried it early. Based on the incoming values of u here is the code with the minimal number of maskings: def findit(u): mask = 0x u += 0xe91aaa35 u ^= u >>

Python ver of System.arraycopy() in Java

2008-07-14 Thread Jordan
I could seem to find a built in function that would serve the purpose of System.arraycopy() in java. I was able to accomplish it with something like this: def arraycopy(source, sourcepos, dest, destpos, numelem): dest[destpos:destpos+numelem] = source[sourcepos:sourcepos +numelem] is there

Re: graphing lifelines

2008-07-15 Thread Jordan
There are several different modules for graphing in Python which you can find easily by searching, but to my knowledge none of them will simply take in a set of tuples and turn them into what you want, although I am sure that it is certainly possible to program a app that could do that for you...

Re: How can I save command prompt screen

2008-07-15 Thread Jordan
Let me take a stab: I figure you either want to save something that is showing up in the standard output in which case you can: instead of using the print command to print to standard output, open a file and append to that instead of printing, and then you can open that up when you are done and s

Re: Testing for connection to a website

2008-07-15 Thread Jordan
On Jul 15, 3:43 pm, Alexnb <[EMAIL PROTECTED]> wrote: > Okay, I already made this post, but it kinda got lost. So anyway I need to > figure out how to test if the user is able to connect to a specific website. > Last time I got pointed to the urllib2 page, but if I do urlopen() and and > am not con

Re: % sign in python?

2008-07-17 Thread Jordan
n syntax uses of > non-alpha-or-digit ascii symbols.  When I finish and upload it > somewhere, I will post an announcement with the link. > > tjr That sounds great Terry! I look forward to seeing this. ~Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about inheritence

2008-07-22 Thread Jordan
On Jul 22, 12:26 pm, Catherine Heathcote <[EMAIL PROTECTED]> wrote: > If I create a new class inherited from another with a constructor, what > happens with the new class's constructer? > Thanks for your time. Well, the __init__ method of the subclass is called, and from within it you can call the

Attack a sacred Python Cow

2008-07-23 Thread Jordan
Hi everyone, I'm a big Python fan who used to be involved semi regularly in comp.lang.python (lots of lurking, occasional posting) but kind of trailed off a bit. I just wrote a frustration inspired rant on my blog, and I thought it was relevant enough as a wider issue to the Python community to po

Re: Attack a sacred Python Cow

2008-07-23 Thread Jordan
On Jul 24, 3:41 pm, Jordan <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm a big Python fan who used to be involved semi regularly in > comp.lang.python (lots of lurking, occasional posting) but kind of > trailed off a bit. I just wrote a frustration inspired rant on m

Re: Attack a sacred Python Cow

2008-07-24 Thread Jordan
Of course not. I just think Explicit is better than Implicit is taken seriously by a large segment the Python community as a guiding principle, and overall its influence does more harm than good. Clearly self being in every argument list was a decision arrived at long before the Zen was ever coin

Re: Attack a sacred Python Cow

2008-07-24 Thread Jordan
On Jul 24, 7:40 pm, Torsten Bronger <[EMAIL PROTECTED]> wrote: > Hallöchen! > > Bruno Desthuilliers writes: > > [...] > > > How would you handle this case with an implicit 'self' : > > > class Foo(object): > >    pass > > > def bar(self): > >    print self > > > Foo.bar = bar > > Just like this.  H

Re: Attack a sacred Python Cow

2008-07-24 Thread Jordan
OK, it seems my original reply to Bruno got lost in the Aether (apologies therefore if a paraphrased "quantum duplicate" of this message is eventually forthcoming.) Torsten has adequately responded to his second point, so I need only replicated what I said for the first. > Please get your facts,

Re: Attack a sacred Python Cow

2008-07-24 Thread Jordan
> This is just plain wrong for at least C# and C++.  C# wants you to > explicitly overload "!=", if you have overloaded "==", While this is as inconvenient as Python at least it doesn't catch you unawares. C# 1 (or maybe 0.5), Python 0. > C++ complains > about "!=" not being defined for class A.

Re: Attack a sacred Python Cow

2008-07-24 Thread Jordan
On Jul 24, 8:01 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message > <[EMAIL PROTECTED]>, Jordan > wrote: > > > Except when it comes to Classes. I added some classes to code that had > > previously just been funct

Re: Attack a sacred Python Cow

2008-07-24 Thread Jordan
> Personally, I think it has more to do with statements like "there are > plenty of smart Python programmers who will > justify all kinds of idiocy in the name of their holy crusade" than > with your position. You don't begin a discussion by discrediting > anyone who might disagree with you as some

Re: Attack a sacred Python Cow

2008-07-24 Thread Jordan
> I don't really mind, what you think about my response.  Python will suffer > from it as little as it will suffer from your complaints:  These things > will not change, whatever any of us says about them.  So this discussion > unlikely to produce any new insight, especially because this as been >

Re: Attack a sacred Python Cow

2008-07-24 Thread Jordan
> Then why do you write, let me quote: > > """ > (snip) coding __eq__ (snip) buys you > nothing from the != operator. != isn't (by default) a synonym for the > negation of == (unlike in, say, every other language ever); not only > will Python let you make them mean different things, without > docum

Re: Attack a sacred Python Cow

2008-07-24 Thread Jordan
> > You're not a lunatic. > > We, and Python itself, change quite readily. > > Neither of those mean your ideas in this instance have merit. You're right, these premises don't lead to this conclusion. Neither do they lead to its negation, of course. As it happens, you're wrong on both counts. I d

Re: Attack a sacred Python Cow

2008-07-25 Thread Jordan
Well this discussion is chugging along merrily now under its own steam, but as the OP I should probably clarify a few things about my own views since people continue to respond to them (and are in some cases misunderstanding me.) I *like* explicit self for instance variable access. There are argum

Python Script for Colorizing Traceroute Output

2012-11-17 Thread Jordan Bylsma
I'm looking into writing a python script that colorizes particular hops when using traceroute. Anyone run across something like this? I don't think it would be extremely difficult to write but some example code would help. Basically particular hops in traceroute output would match a table as eit

Re: Python Script for Colorizing Traceroute Output (apologies for top-post)

2012-11-17 Thread Jordan Bylsma
For this case the firewalls DO respond to TTL(in most cases) and will show in a traceroute. The objective here is to colorize particular devices to easily see what type of devices traffic would traverse across the network. I would be using a database of device hostnames that when they match in t

A case for "real" multiline comments

2012-04-18 Thread Jordan Perr
Object4]. I can't really see a good way to get around this without true multiline comments. - Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: Instant File I/O

2011-03-24 Thread Jordan Meyer
That did the trick! Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Directly Executable Files in Python

2011-03-28 Thread Jordan Meyer
Is it possible to make a directly executable (such as .exe on Windows) file from scripts written in Python? So as to prevent the end-user from having to download an interpreter to run the program. -- http://mail.python.org/mailman/listinfo/python-list

Stupid question, just need a quick and dirty fix

2016-07-21 Thread Jordan Bayless
I'm trying to modify some code to suit my purposes and I'm just trying to filter results as necessary. Basically, the code is returning one of a number from a subset of 150 numbers. I want to only do anything with it if the number is a 'good' one. I'm by no means a Python programmer (C# for me b

Re: Stupid question, just need a quick and dirty fix

2016-07-21 Thread Jordan Bayless
On Thursday, July 21, 2016 at 11:28:55 PM UTC-5, Chris Angelico wrote: > On Fri, Jul 22, 2016 at 2:19 PM, Jordan Bayless wrote: > > I get various errors no matter what I do to this to try and make it work. > > Variable not defined. Referenced before assignment. etc etc. I'm

Re: Stupid question, just need a quick and dirty fix

2016-07-21 Thread Jordan Bayless
No, I tried using a bunch of elif statements earlier and when I added more than around 3 of them it threw errors. I just assumed that was some kind of limit. We both agree that's piss-poor, lazy coding. I'm just trying to find something that works though. To this point, everything I try fails.

Re: reading a list from a file

2005-06-20 Thread Jordan Rastrick
Be careful, though - make sure you can absolutely trust your source of data before calling eval on it. If an unauthorised person could forseeably modify your file, then they could insert a string containing arbitrary Python code into it in place of your list, and then running your program would ca

Re: reading a list from a file

2005-06-20 Thread Jordan Rastrick
If you decide to steer clear of eval, the following comes close to what you want, and is somewhat Pythonic (I feel): def back_to_list(str): return str.strip("[]").split(", ") >>> s = "[1, 2, 3, 4, 5, 6]" >>> back_to_list(s) ['1', '2', '3', '4', '5', '6'] So parsing the list structure is prett

Re: references/addrresses in imperative languages

2005-06-20 Thread Jordan Rastrick
You can add Australia to the list :) Any volunteers for a fourth continent? Antarctica, perhaps? ;) - Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: Boss wants me to program

2005-06-28 Thread Jordan Rastrick
The problem with all posts that say "Use Visual Basic, its easy for small programs" is that small programs, seemingly inevitably, become bigger programs (unless they become dead, unmaintained programs). If your users - you, your boss, coworkers, whoever - find your software useful, and you start to

Re: Will Guido's "Python Regrets" ever get implemented/fixed?

2005-07-02 Thread Jordan Rastrick
Python 3000 is the proveribal and so far hypothetical version of the language in which backward incompatible changes will be allowed (and encouraged). See http://www.python.org/peps/pep-3000.html for details. [EMAIL PROTECTED] wrote: > Guido gave a nice "Python Regrets" Power Point talk at OSCO

Re: how to retrive highlighted text in a browser?

2005-07-03 Thread Jordan Rastrick
I don't know how hard this would be to do in Python - appending text to a file is straightforward, but it sounds like you'd need to extend the browser itself to get the functionality you want. The most obvious choice if you want an extensible browser is Mozilla Firefox (http://www.mozilla.org/produ

String Manipulation

2005-07-13 Thread Michael Jordan
i'll be straight with you and say that this is a homework assignment. ive tried to figure it out on my own but am now out of time. i need to go through a .txt file and get rid of all punctuation. also, every time i see the work "Fruitloops=1" or "Hamburgers=x" where x is ANY number i need to get

String Manipulation

2005-07-13 Thread Michael Jordan
hey, i have this huge text file and i need to go through and remove all punctuation and every instance of the phrase "fruitloops=$" where $ is any number 0-100" um, and yeah this is homework but i've tried to no avail. thanks guys. cheerio :). jen -- http://mail.python.org/mailman/listinfo/py

Re: Path inherits from basestring again

2005-07-27 Thread Jordan Rastrick
used for URLs too" debate, though). Ultimately, its just not different enough from backslash to be very confusing (hear I'll put in a disclaimer, that I don't have enough computing experience to know of any OS where neither type of slash is used in paths.) And thats my 14.5 cents :)

Re: Euclid's Algorithm in Python?

2005-08-04 Thread Jordan Rastrick
Raising an assertion error for a < b is a bit of overkill, since its not really a case of bad input. So normally you see Euclid done like this: def gcd(a,b): # All lowercase for a function is a bit more conventional. if a < b: a, b = b, a # Ensures a >= b by swapping a and b if nessec

Re: Metaclasses and new-style classes

2005-08-07 Thread Jordan Rastrick
Correct me if I'm wrong, but I think the OP was asking if metaclasses work with old-style classes, not new-style. [EMAIL PROTECTED] wrote: > This may be a limitation Zope imposes. > > I wrote this program: > #--- > class M(type):

Re: Euclid's Algorithm in Python?

2005-08-07 Thread Jordan Rastrick
Good point. I suppose I'd only ever seen it implemented with the if test, but you're right, the plain while loop should work fine. Silly me. def gcd(a,b): while b != 0: a, b = b, a%b return a Even nicer. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary inheritance

2005-08-12 Thread Jordan Rastrick
Talin asked: > Also, on a completely different subject: Has there been much discussion > about extending the use of the 'is' keyword to do type comparisons a la > C# (e.g. "if x is list:") ? > > -- Talin No, is already has a specific, well defined meaning - object identity. IDLE 1.1 >>> a = [1,2

Re: How can I exclude a word by using re?

2005-08-15 Thread Jordan Rastrick
could ildg said: > I want to use re because I want to extract something from a html. It > will be very complicated without using re. But while using re, I > found that I must exlude a hole word "", certainly, there are > many many "" in this html. Actually, for properly processing html, you shou

Re: question about binary and serial info

2005-08-17 Thread Jordan Rastrick
Sounds like you want the bitwise and operator, & >>> 2 & 3 2 >>> 32 & 16 0 >>> 31 & 12 12 etc. [EMAIL PROTECTED] inquired: > i have an interesting project at work going on. here is the challenge. > i am using the serial module to read data from a serial input. > it comes in as a hex. i need to m

Re: list insertion

2005-08-23 Thread Jordan Rastrick
tle for anybody else to work with. Regards, Jordan Randy Bush: > i am trying to insert into a singly linked list > > hold = self.next > self.next = DaClass(value) > self.next.next = hold > > but i suspect (from print statement insertions) that the result > is no

Re: How to write this iterator?

2005-09-20 Thread Jordan Rastrick
I've written this kind of iterator before, using collections.deque, which personally I find a little more elegant than the list based approach: from collections import deque def interleave(*iterables): iters = deque(iter(iterable) for iterable in iterables) while iters: it = iters

Suggesting a new feature - "Inverse Generators"

2005-03-25 Thread Jordan Rastrick
First, a disclaimer. I am a second year Maths and Computer Science undergraduate, and this is my first time ever on Usenet (I guess I'm part of the http generation). On top of that, I have been using Python for a grand total of about a fortnight now. Hence, I apologise if what follows is a stupid s

Re: Suggesting a new feature - "Inverse Generators"

2005-03-25 Thread Jordan Rastrick
Sorry about the mangled formatting... like i said, first time on Usenet Suggestions, comments, replies, etc most welcome. This definitely includes replies of the form: "This is stupid, because..." provided it isnt followed with "youre a jerk who knows nothing. Period." Heres a follow up rant in

Re: Suggesting a new feature - "Inverse Generators"

2005-03-25 Thread Jordan Rastrick
Thanks for the very fast feedback :) I specifically set optionalline = None to deal with that bug you mentioned, with the implicit assumption createRecord knows how to deal with a None argument. If that guard got destroyed in the copy paste process, my bad. As for you solution, yes, you could do

Re: Suggesting a new feature - "Inverse Generators"

2005-03-25 Thread Jordan Rastrick
Yes, granted. This is basically the same as Andrew's reply, except with Iterators in place of generators, so I'll let my answer to that stand. In fact, its my solution, but with iter.next() in place of accept :) This is probably something like how I wanted to solve the problem when I first was lo

Re: Suggesting a new feature - "Inverse Generators"

2005-03-25 Thread Jordan Rastrick
Wow, if I'm going to get replies (with implemented solutions!) this quickly, I'll post here more often :-) This is the most different to my solution, and also the shortest, and therefore the most interesting, reply so far. Its also the last one I'll reply to before I go to bed. Its taken

Re: Suggesting a new feature - "Inverse Generators"

2005-03-25 Thread Jordan Rastrick
> No, it's nothing special about groupby. record simply stores its state in a > mutable default parameter. This isn't general good practice: at least you have > to be careful with it. You can see the behavior in the following example: > >>> def accumulate(value, accum = []): > ... accum.

Re: Suggesting a new feature - "Inverse Generators"

2005-03-26 Thread Jordan Rastrick
Hmmm, I like the terminology consumers better than acceptors. The ability to have 'full coroutines', or at least more 'coroutiney behaviour' than is provided by generators alone, was I think what I was trying to get at with my original idea, although things got a bit sidetracked by the way I focus

Re: the bugs that try men's souls

2005-04-03 Thread Jordan Rastrick
d you really did want to test for inversion only against the reduced set of pairs, a more complete explanation of what kind of 'wrong answers' you are getting and what kind of 'right answers' you were expecting might help. As far as I can tell though, its quite natural the answers

Re: the bugs that try men's souls

2005-04-05 Thread Jordan Rastrick
ld a queue with the right elements in it, but in a seemingly arbitrary order. Turns out, there was a > sign that needed to be a >= sign. GRRR. I bet if I'd posted to this group it would have been spotted in about 3 seconds flat :) - Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting a list and counting interchanges

2005-04-06 Thread Jordan Rastrick
Unless I'm mistaken, this doesnt quite work, because it switches the parity of phase every time a comparison is made, rather than every time a swap is made. So: # phase = 1 def mycmp(x,y): global phase c = cmp(x,y) if c > 0: # i.e. a swap will be performed in the sort phase = -pha

Dynamically Cause A Function To Return

2011-09-19 Thread Jordan Evans
I want dynamically place the 'return' statement in a function via user input or achieve the same through some other means. If some other means, the user must be able initiate this at runtime during a raw_input(). This is what I have so far, this would be an awesome command line debugging tool if

Re: using names before they're defined

2006-07-19 Thread jordan . nick
Steve Holden wrote: > [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,

Re: Question about using python as a scripting language

2006-08-07 Thread Jordan Greenberg
ect (or medium sized, or anything more then a few lines, really) this gets really unwieldy really quickly (imagine if you had thousands of functions! Madness!) Terry's suggestion is a much better solution then this. If this looks easier, consider changing the rest of your program before klud

Re: proper format for this database table

2006-10-19 Thread Jordan Greenberg
or just an auto-inc) name, etc... Table Students2Education: studentID (id from Students) EducationID (id from Education) Table Education: id (probably just some auto-inc) university yearStart yearEnd degreesEarned This way, if you have

  1   2   >