Re: How to get started in GUI Programming?

2005-11-26 Thread Jonathan Gardner
I would argue with your assertion that either TKinter of PyGTK are the best. There are several other good alternatives, including wxPython and PyQt, which are very comparable, if not better. I would strongly suggest starting with PyQt. It's my personal favorite. I wrote a short tutorial on the

Re: How can I do this in Python?

2005-11-27 Thread Jonathan Gardner
I don't know what engine you are using. Basically all you have to do is render the login form at the url of the page that needs the login. You're going to have to hook in the authentication code before you render the page normally. For instance, this is a common way I've been doing it in various

Re: still a valid book?

2006-02-08 Thread Jonathan Gardner
You may want to read http://python.org/doc/2.4.2/whatsnew/whatsnew24.html to get an idea of what has changed from 2.3 to 2.4 if you buy the 2.3 book. -- http://mail.python.org/mailman/listinfo/python-list

Soduku

2006-02-14 Thread Jonathan Gardner
Here at my job, Python gets no respect. A programmer here wanted to see which language among Python, Perl, and Java was better. So he wrote a Python, perl, and Java version. Except the Python version was 20x slower than the perl and Java versions. Well, luckily he asked around in our little

Re: Soduku

2006-02-14 Thread Jonathan Gardner
27ms == 0.027s How do you have a 16x16 grid for soduku? Are you using 16 digits? 0-F? The one I am using has 9 digits, 9 squares of 9 cells each, or 9x9 cells. The least efficient part of the algorithm is that part to calculate what to put in a hole (as anyone might've guessed.) My algorithm

Re: How to cat None

2006-02-14 Thread Jonathan Gardner
You can just surround the offending value with str(...). You should probably be doing that anyway, because the value might be a number or something else not stringish. -- http://mail.python.org/mailman/listinfo/python-list

Re: Databases and python

2006-02-15 Thread Jonathan Gardner
I'm no expert in BDBs, but I have spent a fair amount of time working with PostgreSQL and Oracle. It sounds like you need to put some optimization into your algorithm and data representation. I would do pretty much like you are doing, except I would only have the following relations: - word to

Re: Databases and python

2006-02-17 Thread Jonathan Gardner
About the filename ID - word ID table: Any good database (good with large amounts of data) will handle the memory management for you. If you get enough data, it may make sense to get bothered with PostgreSQL. That has a pretty good record on handling very large sets of data, and intermediate sets

Re: Databases and python

2006-02-17 Thread Jonathan Gardner
About indexes everywhere: Yes, you don't have to be a DB expert to know that indexes everywhere is bad. But look at this example. There are really two ways that the data is going to get accessed in regular use. Either they are going to ask for all files that have a word (most likely) or they are

Re: Merging two lists of data (Pythonic way)

2006-02-17 Thread Jonathan Gardner
codes = map(lambda x: x[0], list1) for d in list2: if d['code'] in codes: d['VERIFIED'] = 1 Is this what you were looking for? -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference: __iadd__ and __add__

2006-02-17 Thread Jonathan Gardner
I would like to point out that it isn't entirely obvious where to find documentation for this particular thing. I know from experience where to go, but I remember spending a long time trying to hunt this down. For reference, you may want to check out the index of the language reference manual.

Re: Best python module for Oracle, but portable to other RDBMSes

2006-02-24 Thread Jonathan Gardner
On database portability... While it is noble to try to have a generic interface to these libraries, the end result is that the databases are always different enough that the interface just has to work differently. My experience in going from one database to another is that you should revisit your

Re: Playing with modules

2006-02-24 Thread Jonathan Gardner
You're going to have to create the home.base module somewhere. If you want to put in that some code that basically imports another module's namespace into the home.base module's namespace, then that may do what you want. -- http://mail.python.org/mailman/listinfo/python-list

Re: type = instance instead of dict

2006-02-27 Thread Jonathan Gardner
You should probably spend a bit more time in the documentation reading things for yourself. Read http://www.python.org/doc/2.4.2/ref/types.html under Class Instances for your answer. -- http://mail.python.org/mailman/listinfo/python-list

Re: Catch exceptions

2006-02-27 Thread Jonathan Gardner
(A) You'll have to be more specific about your problem if you want us to help. Under which circumstances did it work or not? What exactly is the problem? (B) Where you put your error-handling is up to you. It depends on what the function does and how it is to respond. Do you want the function to

Re: Python seems to be ignoring my except clause...

2008-02-19 Thread Jonathan Gardner
On Feb 19, 6:14 am, Adam W. [EMAIL PROTECTED] wrote: So I deleted my .pyc files and reran, same thing, but then I closed all open windows and reran it, and it recompiled the pyc and the code worked. ... But now I know I have to keep deleting my pyc files or else I will run into trouble.

Re: Web Development Project

2008-02-22 Thread Jonathan Gardner
On Feb 21, 3:34 pm, john_sm3853 [EMAIL PROTECTED] wrote: Hey guys, I am interested in knowing, what new Web Development projects you are doing, curious to know, what data base you use, and if you are using Linux or Windows platform. Also, will like to know, if there are any alternatives to

Asynchronous urllib (urllib+asyncore)?

2008-02-26 Thread Jonathan Gardner
So, I ran into a problem that I would like to write as little code as possible to solve. The problem is that I would like to send out a bunch of HTTP requests simultaneously, using asynchronous techniques, and then do stuff with the results in parallel. Think of something like Google's

Re: Beautiful Code in Python?

2008-03-03 Thread Jonathan Gardner
On Mar 2, 8:35 am, Michele Simionato [EMAIL PROTECTED] wrote: On Mar 2, 5:23 pm, js [EMAIL PROTECTED] wrote: Hi, Have you ever seen Beautiful Python code? Zope? Django? Python standard lib? or else? Please tell me what code you think it's stunning. The doctest module in the standard

Re: Edit and continue for debugging?

2008-03-07 Thread Jonathan Gardner
This is an interesting issue because we who write web applications face the same problem. Except in the web world, the application state is stored in the browser so we don't have to work our way back to where we were. We just keep our url, cookies, and request parameters handy. Before I go on, I

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-13 Thread Jonathan Gardner
On Mar 12, 6:37 pm, Carl Banks [EMAIL PROTECTED] wrote: On Mar 12, 8:11 pm, Justus Schwabedal [EMAIL PROTECTED] wrote: What do you need it for anyway? I just read about it and I think it's useless in python. Perl, like Python, has a separate compilation and run times.  One day, someone

Re: %x unsigned?

2008-03-14 Thread Jonathan Gardner
On Mar 14, 8:00 am, Hrvoje Niksic [EMAIL PROTECTED] wrote: The %x conversion specifier is documented inhttp://docs.python.org/lib/typesseq-strings.htmlas Unsigned hexadecimal (lowercase).  What does unsigned refer to? '0x%x' % 10 '0xa' Somewhat unrelated, but have you seen the # modifier?

Re: Monitoring SSHd and web servers?

2008-03-14 Thread Jonathan Gardner
On Mar 13, 11:32 pm, Gilles Ganault [EMAIL PROTECTED] wrote: I'd like to monitor connections to a remote SSH and web server. Does someone have some code handy that would try to connect every 5mn, and print an error if the script can't connect? from time import sleep while True: # Try to

Re: eval and unicode

2008-03-20 Thread Jonathan Gardner
On Mar 20, 5:20 am, Laszlo Nagy [EMAIL PROTECTED] wrote: How can I specify encoding for the built-in eval function? Here is the documentation: http://docs.python.org/lib/built-in-funcs.html It tells that the expression parameter is a string. But tells nothing about the encoding. Same is

Re: Change user on UNIX

2008-03-20 Thread Jonathan Gardner
On Mar 20, 4:51 am, Giampaolo Rodola' [EMAIL PROTECTED] wrote: Hi all. Is there any way to su or login as a different user within a python script? I mainly need to temporarily impersonate another user to execute a command and then come back to the original user. I tried to google a little bit

Re: eval and unicode

2008-03-20 Thread Jonathan Gardner
On Mar 20, 2:20 pm, Laszlo Nagy [EMAIL PROTECTED] wrote:   eval( u'徹底したコスト削減 ÁÍŰŐÜÖÚÓÉ трирова' ) == eval( '徹底し たコスト削減 ÁÍŰŐÜÖÚÓÉ трирова' ) True When you feed your unicode data into eval(), it doesn't have any encoding or decoding work to do. Yes, but what about eval( 'u' +

Re: eval and unicode

2008-03-21 Thread Jonathan Gardner
On Mar 21, 1:54 am, Laszlo Nagy [EMAIL PROTECTED] wrote:   eval( # -*- coding: latin2 -*-\n + expr) u'\u0170' # You can specify the encoding for eval, that is cool. I didn't think of that. That's pretty cool. I hope it is clear now.  Inside eval, an unicode object was created from a binary

Re: Is this doable

2008-03-21 Thread Jonathan Gardner
On Mar 21, 4:48 am, fkallgren [EMAIL PROTECTED] wrote: Hi. I have a little problem. I have a script that is in the scheduler (win32). But every now and then I update this script and I dont want to go to every computer and update it. So now I want the program to 1) check for new version of

Re: urllib leaves connections/sockets waiting. BIG problem!!!

2008-03-24 Thread Jonathan Gardner
On Mar 24, 6:57 am, binaryj [EMAIL PROTECTED] wrote: hi i am using urllib2 to do some automated web thing. basically i hit on sites and check the price what they are offering for their product and then decide if i want to lower or increase my pricing.so in short i have to hit hundreds of

Re: Python 3.0 new integer division

2008-04-08 Thread Jonathan Gardner
On Apr 8, 9:13 am, Hutch [EMAIL PROTECTED] wrote: We now have a float result when two integers are divided in the same mannor as 2.4 or 2.5. I can handle that and use the Floor division but a simple question. Why in the world would you round down the last presented digit to a 6 instead of

Re: Python 3.0 new integer division

2008-04-08 Thread Jonathan Gardner
On Apr 8, 2:25 pm, Grzegorz Słodkowicz [EMAIL PROTECTED] wrote: Isn't Decimal a BCD implementation? Yep, you are right and I am wrong. http://www.python.org/dev/peps/pep-0327/#why-not-rational -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib working differently when run from crontab

2008-04-13 Thread Jonathan Gardner
On Apr 13, 8:50 pm, VictorMiller [EMAIL PROTECTED] wrote: I've written a python script which, using urllib, and urllib2 will fetch a number of files that that I'm interested in from various websites (they're updated everyday).  When I run the script from my command line everything works as

Re: I just killed GIL!!!

2008-04-17 Thread Jonathan Gardner
On Apr 16, 5:37 pm, sturlamolden [EMAIL PROTECTED] wrote: One single process of CPython is using all the cpu power of my dual-core laptop. Are they stuck in a while loop, waiting for their resource to become available? Using 100% of the CPU is a bug, not a feature. If you can't rewrite your

Re: I just killed GIL!!!

2008-04-17 Thread Jonathan Gardner
On Apr 17, 1:18 am, Carl Banks [EMAIL PROTECTED] wrote: On Apr 17, 3:37 am, Jonathan Gardner [EMAIL PROTECTED] wrote: If you can't rewrite your algorithm to be disk or network bound, next optimization step is C. I'm sorry, but I don't like being told to use C. Perhaps I would like

Re: I just killed GIL!!!

2008-04-17 Thread Jonathan Gardner
On Apr 17, 6:40 am, Steve Holden [EMAIL PROTECTED] wrote: I'd love to be wrong about that, but the GIL *has* been the subject of extensive efforts to kill it over the last five years, and it has survived despite the best efforts of the developers. To add to that... In my mind, I see three

Re: I just killed GIL!!!

2008-04-17 Thread Jonathan Gardner
On Apr 17, 8:19 am, sturlamolden [EMAIL PROTECTED] wrote: An there you have the answer. It's really very simple :-) That's an interesting hack. Now, how do the processes communicate with each other without stepping on each other's work and without using a lock? Once you get that solved, I am

Re: I just killed GIL!!!

2008-04-17 Thread Jonathan Gardner
On Apr 17, 9:48 am, sturlamolden [EMAIL PROTECTED] wrote: On Apr 17, 5:46 pm, Hrvoje Niksic [EMAIL PROTECTED] wrote: Have you tackled the communication problem? The way I see it, one interpreter cannot see objects created in the other because they have separate pools of ... everything.

Re: How to find the parent of an old-style class?

2008-04-24 Thread Jonathan Gardner
On Apr 24, 7:16 am, Jasper [EMAIL PROTECTED] wrote: I'm stuck using a library based on old style classes, and need to find a class's parent at runtime. With new style classes you can use .__base__ to inspect a parent, but I can't remember how this was done in days of yore, before object.

Re: function that accepts any amount of arguments?

2008-04-24 Thread Jonathan Gardner
On Apr 24, 5:28 am, malkarouri [EMAIL PROTECTED] wrote: What's wrong with raising ZeroDivisionError (not stopping the exception in the first place)? Because when I use your module, call avg (or mean) without args, I should see an error that says, Hey, you have to pass at least one value in!

Re: How do I count the distance between strings in a list?

2009-02-23 Thread Jonathan Gardner
On Feb 23, 9:35 pm, collin chaosm...@gmail.com wrote: For example, if I were to have the code randomlist = [1, 2, 3, 4] And I want to count the distance between strings 1 and 4 which is 3, what command can I use to do this? You'd have to get the indexes of the two items and subtract them.

Re: code challenge: generate minimal expressions using only digits 1,2,3

2009-02-26 Thread Jonathan Gardner
On Feb 20, 6:31 am, Trip Technician luke.d...@gmail.com wrote: anyone interested in looking at the following problem. we are trying to express numbers as minimal expressions using only the digits one two and three, with conventional arithmetic. so for instance 33 = 2^(3+2)+1 = 3^3+(3*2)

Re: Question

2008-10-13 Thread Jonathan Gardner
On Oct 13, 9:31 pm, Aditi Meher [EMAIL PROTECTED] wrote: I am connecting database using python,and i am inserting some data into it. e.g.name and roll nos(some 100 records are stored) My question is I want to display 10 records at a time and want to store remaining records into buffer and

Re: What replaces `` in py3k?

2008-05-21 Thread Jonathan Gardner
On May 21, 10:45 am, bukzor [EMAIL PROTECTED] wrote: What are backticks going to be translated into? repr -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does python not have a mechanism for data hiding?

2008-06-10 Thread Jonathan Gardner
On Jun 10, 11:21 am, Russ P. [EMAIL PROTECTED] wrote: I took a risk in choosing Python, and I would feel better about it if Python would move up to the next level with more advanced features such as (optional) static typing and private declarations. But every time I propose something like

Re: go to specific line in text file

2008-06-18 Thread Jonathan Gardner
On Jun 17, 3:10 am, Patrick David [EMAIL PROTECTED] wrote: I am searching for a way to jump to a specific line in a text file, let's say to line no. 9000. Is there any method like file.seek() which leads me to a given line instead of a given byte? As others have said, no. But if you're

Re: ask for a RE pattern to match TABLE in html

2008-06-26 Thread Jonathan Gardner
On Jun 26, 11:07 am, Grant Edwards [EMAIL PROTECTED] wrote: On 2008-06-26, Stefan Behnel [EMAIL PROTECTED] wrote: Why not use an HTML parser instead? Stating it differently: in order to correctly recognize HTML tags, you must use an HTML parser.  Trying to write an HTML parser in a

Re: ask for a RE pattern to match TABLE in html

2008-06-26 Thread Jonathan Gardner
On Jun 26, 3:22 pm, MRAB [EMAIL PROTECTED] wrote: Try something like: re.compile(r'table\b.*?.*?/table', re.DOTALL) So you would pick up strings like tabletrtdtabletrtdfoo/ td/tr/table? I doubt that is what oyster wants. -- http://mail.python.org/mailman/listinfo/python-list

Re: ask for a RE pattern to match TABLE in html

2008-06-30 Thread Jonathan Gardner
On Jun 27, 10:32 am, David C. Ullrich [EMAIL PROTECTED] wrote: (ii) The regexes in languages like Python and Perl include features that are not part of the formal CS notion of regular expression. Do they include something that does allow parsing nested delimiters properly? In perl, there are

Re: How to say $a=$b-{A} ||={} in Python?

2007-08-16 Thread Jonathan Gardner
On Aug 16, 3:35 pm, beginner [EMAIL PROTECTED] wrote: In perl it is just one line: $a=$b-{A} ||={}. a = b.setdefault('A', {}) This combines all two actions together: - Sets b['A'] to {} if it is not already defined - Assigns b['A'] to a More info on dict methods here:

Re: Newbie design problem

2007-12-13 Thread Jonathan Gardner
On Dec 13, 11:32 am, [EMAIL PROTECTED] wrote: Is there a pythonic design I'm overlooking? Well, if using something like PLY ( http://www.dabeaz.com/ply/ ) is considered more Pythonic than writing your own parser and lexer... Python doesn't have all of life's answers unfortunately. --

Re: Finding overlapping times...

2007-12-13 Thread Jonathan Gardner
On Dec 13, 3:45 pm, Breal [EMAIL PROTECTED] wrote: I have a list that looks like the following [(10, 100010), (15, 17), (19, 100015)] I would like to be able to determine which of these overlap each other. So, in this case, tuple 1 overlaps with tuples 2 and 3. Tuple 2

Re: Newbie design problem

2007-12-17 Thread Jonathan Gardner
On Dec 14, 8:02 am, [EMAIL PROTECTED] wrote: Lex is very crude. I've found that it takes about half a day to organize your token definitions and another half day to write a tokenizer by hand. What's the point of the second half-day's work? As someone who has earned a BS in Physics, I have

Re: New+old-style multiple inheritance

2007-12-18 Thread Jonathan Gardner
On Dec 18, 7:08 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: We are trying to monkey-patch a third-party library that mixes new and old-style classes with multiple inheritance. In so doing we have uncovered some unexpected behaviour: snip I know this level of messing with python internals

Re: Does fileinput.input() read STDIN all at once?

2007-12-18 Thread Jonathan Gardner
On Dec 18, 5:55 am, Adam Funk [EMAIL PROTECTED] wrote: I'm using this sort of standard thing: for line in fileinput.input(): do_stuff(line) and wondering whether it reads until it hits an EOF and then passes lines (one at a time) into the variable line. This appears to be the

Re: checking a string against multiple patterns

2007-12-18 Thread Jonathan Gardner
On Dec 18, 4:41 am, tomasz [EMAIL PROTECTED] wrote: Is there an alternative to it? Am I missing something? Python doesn't have special variables $1, $2 (right?) so you must assign the result of a match to a variable, to be able to access the groups. I'd appreciate any hints. Don't use

Re: Allowing Arbitrary Indentation in Python

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

Re: object vs class oriented -- xotcl

2008-01-24 Thread Jonathan Gardner
On Jan 24, 12:35 pm, William Pursell [EMAIL PROTECTED] wrote: I'm not sure that describes the method well. Basically, you can instantiate an object A of class Foo, and later change A to be an object of class Bar. Does Python support this type of flexibility? As I stated above, I've been

Re: Ignore exceptions

2008-01-24 Thread Jonathan Gardner
On Jan 24, 12:13 pm, SMALLp [EMAIL PROTECTED] wrote: Hy. Is there any way to make interrupter ignore exceptions. I'm working on bigger project and i used to put try catch blocks after writing and testing code what's boring and it's easy to make mistake. I remember of something like that in

Re: a newbie regex question

2008-01-24 Thread Jonathan Gardner
On Jan 24, 12:14 pm, Shoryuken [EMAIL PROTECTED] wrote: Given a regular expression pattern, for example, \([A-Z].+[a-z]\), print out all strings that match the pattern in a file Anyone tell me a way to do it? I know it's easy, but i'm completely new to python thanks alot You may want to

Re: x, = y (???)

2008-07-17 Thread Jonathan Gardner
On Jul 17, 12:55 pm, kj [EMAIL PROTECTED] wrote: I still don't get it.  If we write   y  = 'Y'   x, = y what's the difference now between x and y?  And if there's no difference, what's the point of performing such unpacking? Try: y = abc x, = y You were unpacking y into ('Y',) --

Re: x, = y (???)

2008-07-17 Thread Jonathan Gardner
On Jul 17, 12:55 pm, kj [EMAIL PROTECTED] wrote: what's the point of performing such unpacking? record = [name, address, telephone] ... name, address, telephone = record -- http://mail.python.org/mailman/listinfo/python-list

Re: How to best explain a subtle difference between Python and Perl ?

2008-08-12 Thread Jonathan Gardner
On Aug 12, 9:17 am, Palindrom [EMAIL PROTECTED] wrote: Hi everyone ! I'd like to apologize in advance for my bad english, it's not my mother tongue... My girlfriend (who is a newbie in Python, but knows Perl quite well) asked me this morning why the following code snippets didn't give the

Python Variable System

2008-08-13 Thread Jonathan Gardner
Nigel Rantor wrote: The Python system is the same as the Java system, apart from Java's primitive types, which is a completely different discussion that I really don't want to get into right now. So, everything is by reference. I am not too familiar with Java's system. I understand, and

Re: sem_post: Invalid argument

2007-10-25 Thread Jonathan Gardner
On Oct 25, 12:56 pm, robert [EMAIL PROTECTED] wrote: On a server the binary (red hat) installed python2.4 and also a fresh compiled python2.5 spits sem_post: Invalid argument. What is this and how can this solved? ... Python 2.4.3 (#1, Jun 6 2006, 21:10:41) [GCC 3.2.3 20030502 (Red Hat

Re: sem_post: Invalid argument

2007-10-26 Thread Jonathan Gardner
On Oct 25, 2:19 pm, robert [EMAIL PROTECTED] wrote: Jonathan Gardner wrote: On Oct 25, 12:56 pm, robert [EMAIL PROTECTED] wrote: On a server the binary (red hat) installed python2.4 and also a fresh compiled python2.5 spits sem_post: Invalid argument. What is this and how can this solved

Re: how to/help installing impure packages

2007-10-26 Thread Jonathan Gardner
On Oct 26, 10:35 am, owl [EMAIL PROTECTED] wrote: I love easy_install. I love watching it search and complete. It's when it doesn't complete that causes me grief. I don't program a lot these days and am relatively new to python but I often wind up installing packages on both unix and windows

Re: why did these companies choose Tcl over Python

2007-10-30 Thread Jonathan Gardner
On Oct 30, 2:25 pm, chewie54 [EMAIL PROTECTED] wrote: I would prefer to use Python but can't deny how popular Tcl is, as mentioned above, so my question is why wasn't Python selected by these companies as the choice of scripting languages for their product? Here are some reasons why

Re: Arp request to get MAc Adress with IP address

2007-10-30 Thread Jonathan Gardner
On Oct 30, 1:57 pm, [EMAIL PROTECTED] wrote: Hello, I have a network on same subnet. I have an ip address of a machine. but i need to get its MAC Adress. Sendingf ARP request is the way i am taking. IS there any other way to get this MAC Adress in python.?? Also does python go down to

Re: shelve.open() and error 22: invalid argument

2007-11-01 Thread Jonathan Gardner
On Nov 1, 1:08 pm, [EMAIL PROTECTED] wrote: Hi everyone I've come across the following problem: on two different linux machines, both running python 2.5 (r25:51908), I have the same file 'd.dat'. The md5 checksums are the same. Now, on one machine the following code works import shelve

Re: just a crazy question

2007-11-01 Thread Jonathan Gardner
On Nov 1, 7:16 am, Robert LaMarca [EMAIL PROTECTED] wrote: So.. how is Python for memory management? ... Terrible. If you have a memory-intensive application, use ASM (perhaps C), not Python (or any other high-level language for that matter.) My plan is to try measuring the memory usage of

Re: Portrait of a real life __metaclass__

2007-11-09 Thread Jonathan Gardner
On Nov 9, 7:12 pm, Mark Shroyer [EMAIL PROTECTED] wrote: I guess this sort of falls under the shameless plug category, but here it is: Recently I used a custom metaclass in a Python program I've been working on, and I ended up doing a sort of write-up on it, as an example of what a real life

Re: Portrait of a real life __metaclass__

2007-11-10 Thread Jonathan Gardner
On Nov 10, 3:34 am, Mark Shroyer [EMAIL PROTECTED] wrote: On 2007-11-10, Jonathan Gardner [EMAIL PROTECTED] wrote: What would I have done? I wouldn't have had an age matching class. I would have had a function that, given the datetime and a range specification, would return true or false

Re: Using len()

2006-03-11 Thread Jonathan Gardner
Methinks you are confused about the structure of your program. If we write the program out in plain English in the form of a recipe, it should look something like this: 1. Get input. 2. Check to see if they guessed right. 3. If not, go back to 1. This structure hints at an infinite loop. The

Re: why no block comments in Python?

2006-03-11 Thread Jonathan Gardner
Warby wrote: ...and I forgot to mention that the output of grep and diff is far more understandable in the absence of block comments! Which is why people do this /anyway/. (Kind of makes block comments pointless, doesn't it? /* This is a * really * really * long * block comment */ --

Re: Using Dictionaries in Sets - dict objects are unhashable?

2006-03-21 Thread Jonathan Gardner
Welcome to Python, where all types are either static (and thus hashable) or volatile (and thus not hashable.) The way hash tables work (which is what powers the set and dict types), you have to be able to get a number from an instance of the type, with the following conditions true: (1) Every

Re: Is this a good idea or a waste of time?

2006-08-29 Thread Jonathan Gardner
Simon Forman wrote: If you have a reason to restrict your code to using only ints (perhaps you're packing them into an array of some sort, or passing them to a C extension module) then yes, of course it's appropriate. I politely disagree. Rather than an interface that demands an actual int,

Re: confused about why i get a type error when i call an object's method

2007-08-21 Thread Jonathan Gardner
On Aug 21, 11:07 am, [EMAIL PROTECTED] wrote: I'm confused about why i get a type error when i call an object's method. Here's the example code: class Foo: def __init__(self): self.foo = [] def foo(self): print in foo! f = Foo() dir(f)

Re: REGULAR EXPRESSION

2007-09-04 Thread Jonathan Gardner
On Sep 4, 6:32 am, AniNair [EMAIL PROTECTED] wrote: hi.. I am trying to match '+ %/-' etc using regular expression in expressions like 879+34343. I tried \W+ but it matches only in the beginning of the string Plz help Thanking you in advance... You may want to read the page describing the

Re: parsing long `To' and 'Cc' from email

2007-09-06 Thread Jonathan Gardner
On Sep 6, 1:25 pm, Gerardo Herzig [EMAIL PROTECTED] wrote: the email.* package dont seems to parse that kind of headers `correctly'. What i want is to get a list with all the email address in the `To' header. Someone know if there is a more sofisticated parser for doing this? If you're not

Re: initializing cooperative method

2007-09-06 Thread Jonathan Gardner
On Sep 6, 11:18 am, jelle [EMAIL PROTECTED] wrote: Ai, calling super(Abstract) is just getting object, sure... However, I'm still curious to know if there's a good idiom for repeating the argument in __init__ for the super(Concrete, self).__init__ ? If you don't know what the arguments are,

Re: getting the current function

2007-09-06 Thread Jonathan Gardner
On Sep 6, 8:43 am, Gary Robinson [EMAIL PROTECTED] wrote: I welcome feedback of any type. This all seems a bit too complicated. Are you sure you want to do this? Maybe you need to step back and rethink your problem. Your example can be rewritten a number of different ways that are easier to

Re: why should I learn python

2007-09-06 Thread Jonathan Gardner
On Sep 6, 2:32 pm, windandwaves [EMAIL PROTECTED] wrote: Can someone tell me why I should learn python? I am a webdeveloper, but I often see Python mentioned and I am curious to find out what I am missing out on. The reason I use Python is because I get more done quicker with fewer bugs. I

Re: Changing data in an QAbstractListModel

2007-09-06 Thread Jonathan Gardner
On Sep 6, 9:12 am, exhuma.twn [EMAIL PROTECTED] wrote: I defined a simple update method in the model which I call on certain events to fetch the new data in the DB. I tried to emit the dataChanged() signal of the Model without success. I don't know where I should get the two required index

Re: SSL Issue

2007-09-06 Thread Jonathan Gardner
On Sep 5, 10:47 pm, Harry George [EMAIL PROTECTED] wrote: Jurian Botha [EMAIL PROTECTED] writes: Sorry if this is a real dumb question, but I'm totally stumped. I'm trying to connect to a https url in order to do some xml-rpc method calls, but I'm getting the following error: Error

Re: Changing data in an QAbstractListModel

2007-09-10 Thread Jonathan Gardner
On Sep 7, 1:24 am, exhuma.twn [EMAIL PROTECTED] wrote: Still, nothing is happening when I call this method. Do I still need to handle the dataChanged signal somehow? Or does the ListView take care of this? You might have better luck asking these kinds of questions in the Qt or PyQt forums. --

Re: getting the current function

2007-09-10 Thread Jonathan Gardner
On Sep 7, 9:19 am, Gary Robinson [EMAIL PROTECTED] wrote: This all seems a bit too complicated. Are you sure you want to do this? Maybe you need to step back and rethink your problem. In version 2.1 Python added the ability to add function attributes --

Re: Python Database Apps

2007-09-11 Thread Jonathan Gardner
On Sep 11, 1:07 pm, Tom Brown [EMAIL PROTECTED] wrote: I have had a lot of good luck with PostgreSQL. It is easy to install and use. It is also very stable. It maybe overkill for a client side database. The psycopg package makes interfacing to PostgreSQL very easy and there is a package for

Re: Python Database Apps

2007-09-11 Thread Jonathan Gardner
On Sep 11, 1:39 pm, Jonathan Gardner [EMAIL PROTECTED] wrote: For client-side apps, managing a PostgreSQL installation might be asking too much. But for a web site or web service, I absolutely recommend it. I should mention that I wrote a medical billing software app (client side--PyQt

Re: Python Database Apps

2007-09-13 Thread Jonathan Gardner
On Sep 11, 5:56 am, Harry George [EMAIL PROTECTED] wrote: I use postgresql as well. I wonder if Pythonistas do so out of concern for rigor, clarity, and scalability. It works fine for a quick one-off effort and still works fine after scaling to a DBMS server supporting lots of clients, and

Re: Python Database Apps

2007-09-13 Thread Jonathan Gardner
On Sep 12, 9:38 pm, Prateek [EMAIL PROTECTED] wrote: Have you checked out Brainwave?http://www.brainwavelive.com We provide a schema-free non-relational database bundled with an app server which is basically CherryPy with a few enhancements (rich JS widgets, Cheetah/Clearsilver templates).

Re: plotting pixels in python

2007-09-13 Thread Jonathan Gardner
On Sep 13, 11:37 am, [EMAIL PROTECTED] wrote: No currently I am using a canvas from the Tkinter module What I actually want is to show how a line is plotted pixel by pixel using a delay loop. I want functions something like putpixel not draw_line Try drawing 1px wide rectangles. --

Re: Understanding search queries, semantics, and Meaning ...aren't we all looking for meaning?

2008-12-30 Thread Jonathan Gardner
On Dec 30, 12:35 pm, 5lvqbw...@sneakemail.com wrote: I have Section 4.4.1 of SICP rattling around in my head (database queries), and I'm trying to come up with a simple dictionary-based database in Python to represent circuit diagrams.  My main confusion isn't one of implementation, but a

Re: need help with list/variables

2008-12-30 Thread Jonathan Gardner
On Dec 30, 11:41 am, 5lvqbw...@sneakemail.com wrote: conc = lambda x,y: x[:] + y # concatenate 2 lists without side effects mylist = ['something\n', 'another something\n', 'something again\n'] myvar = reduce(conc, mylist) print myvar conc? side effects? Missing Lisp much? ;-) Let's try

Re: Understanding search queries, semantics, and Meaning ...aren't we all looking for meaning?

2009-01-01 Thread Jonathan Gardner
On Dec 30 2008, 3:25 pm, 5lvqbw...@sneakemail.com wrote: In a typical SQL database, when you type in SELECT foo FROM bar WHERE baz='bo', you are not writing a program, at least not in the sense of Python or C or Java or Perl where you give instructions on HOW to run the program. You are

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread Jonathan Gardner
On Jan 5, 2:26 pm, Kangkook Jee aixe...@gmail.com wrote: I'd like to measure number of bytes sent(or recv'd) from my python application. Does anyone have any idea how can I achieve this? I tried to do this by tracing some socket calls (send, sendto, sendAll)   using 'metaclass' but I could

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread Jonathan Gardner
On Jan 5, 3:23 pm, Kangkook Jee aixe...@gmail.com wrote: Jonathan Gardner wrote: A good universal tool on the Linux platform is tcpdump. It takes some learning, but is very useful for this kind of task. You can use a tool like ethereal to visualize the data that tcpdump gathers

Re: looking for tips on how to implement ruby-style Domain Specific Language in Python

2009-01-06 Thread Jonathan Gardner
On Jan 6, 8:13 am, sturlamolden sturlamol...@yahoo.no wrote: On Jan 6, 4:32 pm, mark mark.fi...@googlemail.com wrote: Is it possible to switch between the custom DSL and the standard Python interpreter? - Write the DSL interpreter in Python. There are Python modules out there that

Re: looking for tips on how to implement ruby-style Domain Specific Language in Python

2009-01-06 Thread Jonathan Gardner
On Jan 6, 8:18 am, sturlamolden sturlamol...@yahoo.no wrote: On Jan 6, 4:32 pm, mark mark.fi...@googlemail.com wrote: I want to implement a internal DSL in Python. I would like the syntax as human readable as possible. Also beware that Python is not Lisp. You cannot define new syntax (yes

Re: looking for tips on how to implement ruby-style Domain Specific Language in Python

2009-01-06 Thread Jonathan Gardner
On Jan 6, 12:24 pm, J Kenneth King ja...@agentultra.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 6, 8:18 am, sturlamolden sturlamol...@yahoo.no wrote: On Jan 6, 4:32 pm, mark mark.fi...@googlemail.com wrote: I want to implement a internal DSL in Python. I would

Re: looking for tips on how to implement ruby-style Domain Specific Language in Python

2009-01-07 Thread Jonathan Gardner
On Jan 7, 7:50 am, J Kenneth King ja...@agentultra.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 6, 12:24 pm, J Kenneth King ja...@agentultra.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: On Jan 6, 8:18 am, sturlamolden sturlamol...@yahoo.no

  1   2   3   >