Re: emacs user interface design? a talk by Bret Victor

2012-02-27 Thread Brad
On Feb 26, 7:01 pm, NanoThermite FBibustards wrote: > @Xah Lee, he only tell one point, fast interpreter avoiding Edit- > Compile-Run cycle, and make it INTERACTIVE, the guy did not teach > nothing of design. The principle was first given by Margaret Hamilton > and Zeldin. > Bret's main point is t

Python CPU

2011-04-01 Thread Brad
Hi All, I've heard of Java CPUs. Has anyone implemented a Python CPU in VHDL or Verilog? -Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread Brad
John Salerno wrote: > rick wrote: >> Why can't Python have a reverse() function/method like Ruby? > > I'm not steeped enough in daily programming to argue that it isn't > necessary, but my question is why do you need to reverse strings? Is it > something that happens often enough to warrant a me

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread Brad
Fredrik Lundh wrote: > rick wrote: > >> The Ruby approach makes sense to me as a human being. > > do the humans on your planet spend a lot of time reversing strings? it's > definitely not a very common thing to do over here. On our planet, we're all dyslexic. We tend to do things 'backwards' so

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread Brad
Steven D'Aprano wrote: > Gah!!! That's *awful* in so many ways. Thanks... I'm used to hearing encouragement like that. After a while you begin to believe that everything you do will be awful, so why even bother trying? It has been my experience that Python has discouraging forums with someo

Re: which "GUI module" you suggest me to use?

2007-06-06 Thread brad
ZioMiP wrote: > I know that WxPython work only under Windows WxPython works everywhere for me. I have some screenshots from Windows 98 - Vista, Mac OSX, and Debian GNU/Linux... all running the exact same Python & wxPython code: http://filebox.vt.edu/users/rtilley/public/find_ssns/index.html

Re: Who uses Python?

2007-06-06 Thread brad
walterbyrd wrote: > I mean other than sysadmins, programmers, and web-site developers? > Anything else? Finance? Web-analytics? SEO? Digital art? IT Security Analysts use it... see code and screenshots... these are not professional programmers: http://filebox.vt.edu/users/rtilley/public/find_ss

Learning Basics

2007-07-08 Thread Brad
So I've been studying python for a few months (it is my first foray into computer programming) and decided to write my own little simple journaling program. It's all pretty basic stuff but I decided that I'd learn more from it if more experienced programmers could offer some thoughts on how I could

catching empty strings (I guess that's what they are)

2007-07-09 Thread brad
ith noting in between) I thought I could do something like this: if user_file == None: pass Or this: if user_file == '': pass But, these don't work, the '' is still there. Any suggestions are appreciated! Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: catching empty strings (I guess that's what they are)

2007-07-09 Thread brad
Diez B. Roggisch wrote: > They are still there because you perform the stripping and lowercasing in > the append-call. Not beforehand. Thank you. I made the changes. It works. -- http://mail.python.org/mailman/listinfo/python-list

execute script in certain directory

2007-07-09 Thread brad
sktop. Is there a way to force py scripts to always run within the directory that they reside in? Thanks Brad /home/brad/Desktop/output - python from shell /home/brad/Desktop/output - python from idle /home/brad/output - python from Gnome 'right click' open with menu -- http://mai

Re: Open HTML file in IE

2007-07-18 Thread brad
gravey wrote: > Hello. > > Apologies if this is a basic question, but I want to open a HTML > file from my local drive (is generated by another Python script) > in Internet Explorer. I've had a look at the webbrowser module and > this doesn't seem to be what I need. Any help much appreciated. You

Re: Deleting files and folders used by other processes on Windows

2007-07-18 Thread brad
[EMAIL PROTECTED] wrote: > Hi, > > I have been looking into making my file cleaning script more > intelligent. The goal of the script is to delete everything on a > drive except for a couple of folders which are skipped by the script. > Recently, I noticed that some files where not being deleted

re.compile for names

2007-05-21 Thread brad
pproach this problem? Any ideas for improvement are welcome! I can provide more info off-list for those who would like. Thank you for your time, Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: re.compile for names

2007-05-21 Thread brad
en a problem needs an accurate yet broad solution. Too broad and the results are irrelevant as they'll include so many false positives, too accurate and the results will be missing a few names. It's a no-win :( Thanks for the advice. Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: A few questions

2007-05-21 Thread brad
Alex Martelli wrote: > Most popular, however, is no doubt wxWindows -- > mostly because you can freely use it to develop SW which you plan to > distribute under closed-source licenses, while Qt &c force you to choose > -- either pay, or, if you even distribute your code, it will have to be > under

Re: Python and GUI

2007-05-21 Thread brad
est of luck, Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and GUI

2007-05-21 Thread brad
eed to bundle the wx stuff. I develop on Linux, build on Windows (with PyInstaller) and it works great. The source runs on any platform, the Windows binaries is neat for the point and click users. Brad -- http://mail.python.org/mailman/listinfo/python-list

inet_addr() in Python

2007-07-23 Thread brad
Does Python have an equivalent to C's inet_addr()? Thanks, Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: inet_addr() in Python

2007-07-23 Thread brad
Steve Holden wrote: > brad wrote: >> Does Python have an equivalent to C's inet_addr()? >> > socket.inet_aton() produces a four-byte string you can pass as a struct > in_addr, if that's what you are looking for. If you want a number then > use the stru

Re: question about math module notation

2007-07-26 Thread brad
Stargaming wrote: > Explicitly converting it to `int` works for me. (Without the 3-digit- > block notation, of course.) Thank you! -- http://mail.python.org/mailman/listinfo/python-list

question about math module notation

2007-07-26 Thread brad
How does one make the math module spit out actual values without using engineer or scientific notation? I get this from print math.pow(2,64): 1.84467440737e+19 I want this: 18,446,744,073,709,551,616 I'm lazy... I don't want to convert it manually :) -- http://mail.python.org/mailman/listinfo/

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread brad
James Stroud wrote: > Midway through a semester in college, after a few days (or was it a few > weeks?) of...well...lets just say I was studying real hard...I got lost > on my way to o-chem and wandered into the interior design department by > accident and found what I like to call "the motherlo

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread brad
[EMAIL PROTECTED] wrote: > Python is a better language, with php support, anyway, but I am fed up > with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin > Perl experience for everyone. Instead of being helpful, snide remarks, > back-biting, scare tactings, and so on proliferate an

Re: question about math module notation

2007-07-26 Thread brad
Paul Rubin wrote: > print 2**64 Ah yes, that works too... thanks. I've settled on doing it this way: print int(math.pow(2,64)) I like the added parenthesis :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Directory

2007-07-31 Thread brad
Rohan wrote: > I would like to get a list of sub directories in a directory. > If I use os.listdir i get a list of directories and files in that . > i only want the list of directories in a directory and not the files > in it. > anyone has an idea regarding this. How far down do you want to go? A

Re: get directory and file names

2007-07-31 Thread brad
Alchemist wrote: > I am working with Python 2.5 on Windows XP (SP2). > > How can I traverse a folder, loop through a list of files and get > their file name and extension in an elegant, pythonic way? > > Thank you. > try this: for root, dirs, files in os.walk('.'): for f in files: print

Re: Determining if file is valid image file

2007-08-02 Thread brad
André wrote: > I should have added: I'm interesting in validating the file *content* > - not the filename :-) Some formats have identifying headers... I think jpeg is an example of this. Open it with a hex editor or just read the first few bytes and see for yourself. Br

passing vars to py scipts in cron jobs

2007-08-07 Thread brad
c2.d2(v,v,v) class c1: # User defined vars def d1(var1, var2, var3): pass class c2: # User defined vars def d2(var1, var2, var3): pass Thanks, Brad -- http://mail.python.org/mailman/listinfo/python-list

This bit of code hangs Python Indefinitely

2007-08-08 Thread brad
url_queue = Queue.Queue(256) for subnet in subnets: url_queue.put(subnet) The problem is that I have 512 things to add to the queue, but my limit is half that... whoops. Shouldn't the interpreter tell me that I'm an idiot for trying to do this instead of just hanging? A message such as thi

Re: This bit of code hangs Python Indefinitely

2007-08-08 Thread brad
Chris Mellon wrote: > ... the producer is designed to block if > the queue is full. You can use the put_nowait method to have it raise > an exception instead of blocking. I assumed that the behavior would have been the other way around. I should not have made that assumption. -- http://mail.pyt

Re: This bit of code hangs Python Indefinitely

2007-08-08 Thread brad
Marc 'BlackJack' Rintsch wrote: > Why did you put an upper bound to the queue? For clarity. Explicit is better than implicit, right? In our design, the queue should only have x number of things, so why not show that? Other than that, the limit is arbitrary and is not needed. -- http://mail.pyt

Re: tests

2007-08-09 Thread brad
[EMAIL PROTECTED] wrote: > You should be able to read chunks of each file in binary mode and do a > compare to check for equality. Some kind of loop should do the trick. Why not a simple md5 or sha with the hash library? -- http://mail.python.org/mailman/listinfo/python-list

Re: The Future of Python Threading

2007-08-10 Thread brad
;s all I've ever really used threads for, so I'm probably less of an expert than you are :) I guess it comes down to what you're doing with them. Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: The Future of Python Threading

2007-08-10 Thread brad
brad wrote: > This is all anecdotal... threads in Python work great for me. I like > Ruby's green threads too, I forgot to mention that Ruby is moving to a GIL over green threads in v2.0 -- http://mail.python.org/mailman/listinfo/python-list

Assignments and Variable Substitution

2007-08-13 Thread brad
I'd like to do something like this: var = '123' %s = [], %var So that, in the end, var is '123' and an empty list is named '123' as well. The list assignments are created during a loop. Thanks, Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: Assignments and Variable Substitution

2007-08-14 Thread brad
Steve Holden wrote: > Evan Klitzke wrote: >> On 8/13/07, brad <[EMAIL PROTECTED]> wrote: >>> I'd like to do something like this: >>> >>> var = '123' >>> %s = [], %var >>> >>> So that, in the end, var is '123

Re: Script to copy database

2007-08-14 Thread brad
Laurent Pointal wrote: > As you wrote about c: and f:, I imagine you are working under Windows. > IMHO you dont need Python for that. Unless you need error handling, reporting, etc. Bat scripts only go so far. -- http://mail.python.org/mailman/listinfo/python-list

post xml payload with urllib

2007-08-14 Thread brad
Has anyone sent an xml payload via post using urllib? I'd like to do something like this: logon_request = """ "the_password" "the_user" """ logon = urllib.urlopen("https://127.0.0.1/api/version/xml";, logon_request) print logon.read() logon.close() 127.0.0.1 expects xml via a https connec

Re: Microsoft Vista and os.exec

2007-08-21 Thread brad
franko353 wrote: > I have wxPython programs that work fine in Win2000/XP using os.exec(). > > They do not work in MS Vista. Has anyone else had any luck with > exec()? > > I keep getting an 'invalid option' error. > > It turn out it was really a security issue and I had to move to a > "win32proc

Re: Regular expression use

2007-08-24 Thread brad
Nick Maclaren wrote: > For reasons that I won't explain, as they are too complicated > and not terribly relevant, I am interested in discovering what > people actually use regular expressions for. Finding credit card numbers in files...among other things: http://filebox.vt.edu/users/rtilley/publi

Script to extract text from PDF files

2007-09-25 Thread brad
this now, let me know and I'll use that instead! So, if other more experienced programmer are interested in helping make the script better, please let me know. I can host a website and the latest revision and do all of the grunt work. Thanks, Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: Script to extract text from PDF files

2007-09-26 Thread brad
em on this? There are at least four PDF parsers > written in Python out there. I appreciate that suggestion, but again, none of the current solutions I've seen and tried, extract text from pdf documents. I'd love to be proven wrong on this point. So if one of those four cur

slice last 4 items from a list

2007-10-01 Thread brad
Is this the correct way to slice the last 4 items from a list? x = [1,2,3,4,5,6,7,8,9] print x[-4:] It works, but is it Pythonic? -- http://mail.python.org/mailman/listinfo/python-list

Dictionary invalid token error

2007-10-02 Thread brad
This works: >>> area_group = {001:06, 002:04, 003:04, 006:9} This does not (one the end, 09 is used instead of 9) >>> area_group = {001:06, 002:04, 003:04, 006:09} File "", line 1 area_group = {001:06, 002:04, 003:04, 006:09} SyntaxError: invalid token Why does 09 cause an invalid tok

Re: Dictionary invalid token error

2007-10-02 Thread brad
Tim Chase wrote: > Numbers with leading zeros are parsed as octal. 8 and 9 are invalid > digits in octal. Thus, it falls over. 00 through 07 will work fine, > but 08 and 09 will go kaput. > > http://docs.python.org/ref/integers.html > > -tkc Thanks... that makes sense. I'll store them as st

List Question

2007-10-02 Thread brad
How is this expressed in Python? If x is in y more than three times: print x y is a Python list. -- http://mail.python.org/mailman/listinfo/python-list

unit testing

2007-10-04 Thread brad
(the official unittest that is)... especially when there's a lot of source code. But this... if len(x) != y: sys.exit('...') is a hell of a lot easier and quicker that subclassing unittest.TestCase on small projects :) Do others do their own "informal" unit test

Re: Program with wx in Linux and Windows

2007-10-05 Thread brad
). I write/test > on Linux, and the programs pretty much "just work" on Windows. That sums up my experience with wxPython as well. I've never had any problems. I develop on Linux and run on Linux, Mac and Windows. Brad -- http://mail.python.org/mailman/listinfo/python-list

I'm starting to think like a Pythonista

2007-10-10 Thread brad
I was looking at a way to implement Ruby's upto method in python. I came up with the code below... three years ago, I would never have thought of list comprehension, today it seems second nature. This may be totally un-Pythonic, but I thought it was kind of clever. Man, for some reason, I feel

Re: I'm starting to think like a Pythonista

2007-10-10 Thread brad
Bjoern Schliessmann wrote: > brad wrote: >> low_odds = [1,3,5,7,9] >> # make a list containing 10 - 98 evens only >> big_evens = big_evens = [x for x in list(xrange(99)) if x % 2 == >> 0 and x >8] > > Why use xrange if you convert it to a full list in place

Re: I'm starting to think like a Pythonista

2007-10-10 Thread brad
Erik Jones wrote: > big_evens = range(10, 100, 2) > big_odds = range(11, 100, 2) Neat, but not as clever or as hard to read as mine... I'll bet it faster though... maybe not. The upto part is here: ok_numbers = low_odds + big_evens + [x for x in low_evens if x <= y] -- http://mail.python.org

Re: if then elif

2007-10-10 Thread brad
Shawn Minisall wrote: > I just learned about if, then elif statements and wrote this program. > The problem is, it's displaying all of the possibilities even after you > enter a 0, or if the fat grams are more then the total number of > calories , that is supposed to stop the program instead of

Finding Peoples' Names in Files

2007-10-11 Thread brad
Crazy question, but has anyone attempted this or seen Python code that does? For example, if a text file contained 'Guido' and or 'Robert' and or 'Susan', then we should return True, otherwise return False. -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding Peoples' Names in Files

2007-10-11 Thread brad
[EMAIL PROTECTED] wrote: > On Oct 11, 5:22 pm, brad <[EMAIL PROTECTED]> wrote: >> Crazy question, but has anyone attempted this or seen Python code that >> does? For example, if a text file contained 'Guido' and or 'Robert' and >> or 'Susan&

Re: Finding Peoples' Names in Files

2007-10-11 Thread brad
mes in it as well." Now then, I'd have less to review or perhaps as much as I have now, but I could push the files with numbers and names to the top of the list so that they would be reviewed first. Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding Peoples' Names in Files

2007-10-11 Thread brad
rtunately, there is no luhn check for SSNs. We follow the Social Security Administration verification guideline religiously... here's an web front-end to my logic: http://black.cirt.vt.edu/public/valid_ssn/index.html but still have many false positives on SSNs, so being able to id *names and

Re: Memory Problems in Windows 2003 Server

2007-10-12 Thread brad
lot of memory. So, just because you have 2GB, that does not mean you can access all of that at once. I would guess that 25% of memory is in constant use by the OS. So, do your IO/reads in smaller chunks similar to the example I gave earlier. Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory Problems in Windows 2003 Server

2007-10-12 Thread brad
amdescombes wrote: > Hi, > > I am using Python 2.5.1 > I have an application that reads a file and generates a key in a > dictionary for each line it reads. I have managed to read a 1GB file and > generate more than 8 million keys on an Windows XP machine with only 1GB > of memory and all works

Re: test if email

2007-10-12 Thread brad
Florian Lindner wrote: > Hello, > is there a function in the Python stdlib to test if a string is a valid > email address? Nope, most any string with an @ in it could be a valid email addy. Send a message to the addy, if it doesn't bounce, then it's valid. -- http://mail.python.org/mailman/listi

Re: test if email

2007-10-12 Thread brad
[EMAIL PROTECTED] wrote: > On Oct 12, 2:55 pm, Florian Lindner <[EMAIL PROTECTED]> wrote: >> Hello, >> is there a function in the Python stdlib to test if a string is a valid >> email address? here's a Perl re example... I don't know whether to laugh or cry... don't try to replicate this in Pytho

Re: test if email

2007-10-12 Thread brad
Grant Edwards wrote: > If you send an e-mail to an address and you get a response, > then it's valid. No response could be valid too. The user may not respond. For automated tasks, I go with the no bounce method. When things start bouncing, do domething, but so long as they don't bounce do some

Re: python2.5 and mysqldb

2007-10-29 Thread brad
sily allows for this sort of thing (like Debian) Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: A Python 3000 Question

2007-10-29 Thread brad
Rob Wolfe wrote: > I wonder why people always complain about `len` function but never > about `iter` or `pprint.pprint`? :) Not complaining. len is simple and understandable and IMO fits nicely with split(), strip(), etc... that's why I used it as an example, but list(), etc. could be used as e

A Python 3000 Question

2007-10-29 Thread brad
Will len(a_string) become a_string.len()? I was just reading http://docs.python.org/dev/3.0/whatsnew/3.0.html One of the criticisms of Python compared to other OO languages is that it isn't OO enough or as OO as others or that it is inconsistent. And little things such as this seem to support t

Re: setting variables in outer functions

2007-10-29 Thread brad
Tommy Nordgren wrote: >> def outer(avar=False): >> print avar >> if avar == True: >> return >> >> def inner(avar=True): >> print avar >> return avar >> >> outer(inner()) >> >> outer() > This is not a general solution to this problem. Run my exam

Re: setting variables in outer functions

2007-10-29 Thread brad
Tommy Nordgren wrote: > Given the following: > def outer(arg) > avar = '' > def inner1(arg2) > # How can I set 'avar' here ? Try this... works for me... maybe not for you? def outer(avar=False): print avar if avar == True: return def inner(avar=True):

Re: A Python 3000 Question

2007-10-30 Thread brad
Eduardo O. Padoan wrote: > This is a FAQ: > http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm Thanks to all for the feedback. I'm no language designer. I just see and hear these criticisms and I wanted to think thro

Understanding tempfile.TemporaryFile

2007-12-27 Thread Brad
Wondering if someone would help me to better understand tempfile. I attempt to create a tempfile, write to it, read it, but it is not behaving as I expect. Any tips? >>> x = tempfile.TemporaryFile() >>> print x ', mode 'w+b' at 0xab364968> >>> print x.read() >>> print len(x.read()) 0 >>> x

Patches to Python 2.5.1

2008-01-06 Thread Brad
I was just looking through the 2.5.1 source code. I noticed a few mis-spellings in the comments. No big deal really. Can patches be submitted that correct the spelling errors or should they just be pointed out to some mailing list? Thanks, Brad -- http://mail.python.org/mailman/listinfo

Python 3000 and import __hello__

2008-01-19 Thread Brad
Just playing around with Python3000 a2 release on Windows XP 32-bit x86. import __hello__ doesn't print 'hello world...' as it does on 2.5 The import doesn't fail or generate errors... just no output. Perhaps this is by design? Brad -- http://mail.python.org/mailman/listinfo/python-list

Email Directly from python

2008-02-13 Thread brad
n the machine? Thanks, Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: Email Directly from python

2008-02-13 Thread brad
Martin P. Hellwig wrote: > The tricky part is how to resolve the mail server for a mail address. > Usually you have to query the mx record of that domain. I solved that by > looking if I can find the nslookup binary. The from and to are static constants... they don't change. Mail just seems s

Understanding While Loop Execution

2008-02-18 Thread Brad
Hi folks, I'm still fairly new to programming in python and programming in general. A friend of mine is in a CompSci 101 course and was working on a slider game when he encountered a problem. We eventually figured out what the problem was and built a test case to help solve it, but I can't for the

Pass data from Python to C++

2008-05-15 Thread brad
utationally heavy info to c++ from within Pyhton. os.system is not ideal. Just wondering how other folks do this? I have source to some of the c++ code, but some of it is in binary from only. It can take stdin or arguments. Thanks for any tips, Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python for programming algorithms

2008-05-20 Thread brad
Vicent Giner wrote: The usual answer is that development time is more important than running time. This depends. Run time is not important until you are asked to scale to millions or billions of users or computations or large data sets. I've seen this first hand. Getting results back the sa

Re: problem boost::python::import

2008-05-22 Thread brad
Frédéric Degraeve wrote: Hello, I tried this code with vs7-8 and boost1.34.1-1.35.0 and my python is a 2.4.. Try the boost users list: To subscribe or unsubscribe via the World Wide Web, visit http://lists.boost.org/mailman/listinfo.cgi/boost-users -- http://mail.python.org/mailman/lis

Re: Shell-independent *nix setup script

2008-05-22 Thread brad
[EMAIL PROTECTED] wrote: Hi, Is it worthwhile maintaining a production application setup script in Python as opposed to shell-script? I do not think so. Perhaps 'in conjunction with', but not 'opposed to'... sh is the lowest common denominator of shells. Script for sh and your script will r

Re: Python is slow

2008-05-22 Thread Brad
cm_gui wrote: Python is slow. It ain't C++, but it ain't a punch card either... somewhere in between. I find it suitable for lots of stuff. I use C++ when performance really matters tho... right tool for the job. Learn a good interpreted language (Pyhton) and a good compiled language (C or C

Re: MVC

2008-05-22 Thread Brad
ts the use of design patter. So, here goes my question. Is that OK if I follow this? ... Yes. Python does not impose design patterens onto developers. Pick your poison. It is somewhat OOP, but allows for other development paradigms as well... rather like C++ IMO although a bit more OOP focused.

Looking for lots of words in lots of files

2008-06-18 Thread brad
Just wondering if anyone has ever solved this efficiently... not looking for specific solutions tho... just ideas. I have one thousand words and one thousand files. I need to read the files to see if some of the words are in the files. I can stop reading a file once I find 10 of the words in i

Re: Regular expression help

2008-07-18 Thread Brad
[EMAIL PROTECTED] wrote: Hello, I am new to Python, with a background in scientific computing. I'm trying to write a script that will take a file with lines like c afrac=.7 mmom=0 sev=-9.56646 erep=0 etot=-11.020107 emad=-3.597647 3pv=0 extract the values of afrac and etot... Why not just sp

Re: Wrapping C with Python

2008-08-04 Thread brad
RPM1 wrote: ... Basically you just compile your C code as a regular C code dll. ctypes then allows you to access the functions in the dll very easily. Does that work with C++ code too or just C? -- http://mail.python.org/mailman/listinfo/python-list

Re: What Python looks like

2008-08-05 Thread brad
Gary Herron wrote: My impression was (and still is): A page of Python code looks *clean*, with not a lot of punctuation/special symbols and (in particular) no useless lines containing {/} or begin/end or do/done (or whatever). what about all those 'self' thingys? :) -- http://mail.python.o

regex search loops instead of findall

2008-08-05 Thread brad
Hi guys... I'm trying to make my Python regex code behave like my C++ regex code. In order to search large strings for *all* occurrences of the thing I'm searching for, I loop like this in C++: void number_search(const std::string& portion, const boost::regex& Numbers) { boost::smatch m

Re: Suggestion for converting PDF files to HTML/txt files

2008-08-11 Thread brad
srinivasan srinivas wrote: Could someone suggest me ways to convert PDF files to HTML files?? Does Python have any modules to do that job?? Thanks, Srini Unless there is some recent development, the answer is no, it's not possible. Getting text out of PDF is difficult (to say the least) and a

Re: os.system question

2008-08-11 Thread Brad
Kevin Walzer wrote: >>> import os >>> foo = os.system('whoami') kevin >>> print foo 0 >>> The standard output of the system command 'whoami' is my login name. Yet the value of the 'foo' object is '0,' not 'kevin.' How can I get the value of 'kevin' associated with foo? Hi Kevin, check

Editing a file by substitution

2008-08-11 Thread Brad
Hi, what I'd like to do is edit an input file for a calculation with Python. Let's say that I have an input file like the following -->> BLAH BLAH BLAH Other inputs, Volume 940 m^3, maybe some more stuff STUFF STUFF -->> So let's say I

Re: Editing a file by substitution

2008-08-11 Thread Brad
alex23 wrote: On Aug 12, 12:03 pm, Brad <[EMAIL PROTECTED]> wrote: So let's say I want to edit this file and change Volume from 940 to 950. Personally, I'd recommend avoiding re and sticking with the standard string functions. Something like this should be pretty effective:

Re: Suggestion for converting PDF files to HTML/txt files

2008-08-12 Thread brad
alex23 wrote: PDFMiner is a set of CLI tools written in Python, one of which converts PDF to text, HTML and more: http://www.unixuser.org/~euske/python/pdfminer/index.html Very neat program. Would be cool if it could easily integrate into other py apps instead of being a standalone CLI tool.

Re: Suggestion for converting PDF files to HTML/txt files

2008-08-12 Thread brad
alex23 wrote: On Aug 12, 11:13 pm, brad <[EMAIL PROTECTED]> wrote: Very neat program. Would be cool if it could easily integrate into other py apps instead of being a standalone CLI tool. Perhaps, but I think you could get a long way using os.system(). Yes, that is possible, but the

Re: Formatting input text file

2008-08-14 Thread brad
[EMAIL PROTECTED] wrote: Hi, it's me again with tons of questions. I hava an input file structured like this: X XYData-1 1. 3.08333 > number1 number2 number3 number4 number5 number6 split is your friend. -- http://mail

some path issues on windows

2008-03-28 Thread Brad
When reading a file into a list that contains windows file paths like this: c:\documents and settings\brad\desktop\added_software\asus\a.txt I get a list that contains paths that look like this: c:\\documents and settings\\brad\\desktop\\added_software\\asus\\a.txt So, my list contains those

Re: some path issues on windows

2008-03-28 Thread Brad
Steven D'Aprano wrote: > On Fri, 28 Mar 2008 22:31:07 -0400, Brad wrote: > >> When reading a file into a list that contains windows file paths like >> this: >> >> c:\documents and settings\brad\desktop\added_software\asus\a.txt >> >> I get a list t

comparing dictionaries

2008-05-07 Thread brad
I want to compare two dicts that should have identical info just in a different data structure. The first dict's contents look like this. It is authoritative... I know for sure it has the correct key value pairs: {'001' : '01'} The second dict's contents are like this with a tuple instead of a

Python multimap

2008-08-27 Thread brad
Recently had a need to us a multimap container in C++. I now need to write equivalent Python code. How does Python handle this? k['1'] = 'Tom' k['1'] = 'Bob' k['1'] = 'Joe' ... Same key, but different values. No overwrites either....

Re: Python multimap

2008-08-27 Thread brad
Mike Kent wrote: Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. k = {} k['1'] = [] k['1'].append('Tom') k['1'].append('Bob') k['1'].append('Joe') k['1'] ['Tom', 'Bob', 'Joe']

Re: Python multimap

2008-08-27 Thread brad
castironpi wrote: I don't understand what a multimap does that a map of lists doesn't do. It counts both keys individually as separate keys. The Python workaround does not... see examples... notice the key(s) that are '4' Python output (using the k = [] idea): Key: 4 Value: [[13, 'Visa'],

Re: Python multimap

2008-08-28 Thread brad
Carl Banks wrote: Out of curiosity, what does a true multimap solve that a dictionary of lists not solve? Nothing really. I went with a variation of the suggested work around... it's just that with Python I don't normally have to use work arounds and normally one obvious approach is correct:

Re: Feature request: String-inferred names

2009-11-25 Thread Brad
On Nov 25, 10:49 pm, Chris Rebert wrote: > On Wed, Nov 25, 2009 at 6:35 PM, The Music Guy > > wrote: > > Hello all, > > > I just posted to my blog about a feature that I'd like to see added to > > Python. Before I go through the trouble of learning how to write a PEP or > > how to extend the Pyth

  1   2   >