Re: Why does 1**2**3**4**5 raise a MemoryError?

2013-04-02 Thread Dan Sommers
On Mon, 01 Apr 2013 21:45:30 -0700, Tim Roberts wrote: > morphex wrote: >> >>While we're on the subject, wouldn't it be nice to have some cap there >>so that it isn't possible to more or less block the system with large >>exponentiation? > > There IS a cap. It's called the "MemoryError" excepti

Re: optomizations

2013-04-22 Thread Dan Stromberg
On Mon, Apr 22, 2013 at 6:53 PM, Roy Smith wrote: > > So, my real advice to you is to fire up the profiler and see what it > says. I agree. Fire up a line-oriented profiler and only then start trying to improve the hot spots. -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading a CSV file

2013-04-23 Thread Dan Stromberg
On Tue, Apr 23, 2013 at 2:39 PM, Ana Dionísio wrote: > Hello! > > I need to read a CSV file that has "n" rows and "m" columns and if a > certain condition is met, for exameple n==200, it prints all the columns in > that row. How can I do this? I tried to save all the data in a > multi-dimensional

Re: Reading a CSV file

2013-04-23 Thread Dan Stromberg
On Tue, Apr 23, 2013 at 2:58 PM, Ana Dionísio wrote: > Thank you, but can you explain it a little better? I am just starting in > python and I don't think I understood how to apply your awnser > -- > http://mail.python.org/mailman/listinfo/python-list > #!/usr/local/pypy-1.9/bin/pypy import csv

Red Black Tree implementation?

2013-05-01 Thread Dan Stromberg
What's the best Red Black Tree implementation for Python with an opensource license? I started out looking at http://newcenturycomputers.net/projects/rbtree.htmlbecause it was pretty high in Google and had the operators I wanted, but it gets very slow at about half a million elements. I've been d

Re: Red Black Tree implementation?

2013-05-02 Thread Dan Stromberg
On Thu, May 2, 2013 at 3:46 AM, Christian Heimes wrote: > Am 02.05.2013 01:11, schrieb Dan Stromberg: > No wonder it's getting slow and doesn't stand a change against Python's > dict implementation. The rbtree implementation from > newcenturycomputers.net is writt

Re: Red Black Tree implementation?

2013-05-02 Thread Dan Stromberg
On Wed, May 1, 2013 at 7:06 PM, duncan smith wrote: > I have an implementation that you can try out. It's not based on any other > implementation, so my bugs will be independent of any bugs in the code > you're currently using. It looks more like a set - add, remove, discard. > Not tried on Python

Re: double underscore attributes?

2005-12-10 Thread Dan Bishop
[EMAIL PROTECTED] wrote: ... > Every time I use dir(some module) I get a lot of attributes with double > underscore, for example __add__. Ok, I thought __add__ must be a method > which I can apply like this ... > I tried > >>> help(5.__add__) > > but got > SyntaxError: invalid syntax That's becaus

Newbie: executing a system command from my Python app

2005-12-12 Thread Dan M
I'm writing a Python replacement for a particularly ugly shell script. we are running mimedefang on our mail server, moving spam and virus messages to a quarantine directory. This little python script successfully chdir's to the quarantine directory, identifies all of the quarantine subdirectories

Re: Newbie: executing a system command from my Python app

2005-12-12 Thread Dan M
On Mon, 12 Dec 2005 13:25:14 -0800, Dan M wrote: > I'm writing a Python replacement for a particularly ugly shell script. we > are running mimedefang on our mail server, moving spam and virus messages > to a quarantine directory. This little python script successfully chdir's

Re: Newbie: executing a system command from my Python app

2005-12-13 Thread Dan M
> Few points points: > > 1. Generally: I would try to minimize system calls. They make your code less > portable. Excellent point. In this case the app will never live anywhere other than one specific FreeBSD machine, but I do appreciate the value of the advice anyway. Therefore... > 2. Look

Re: PyQt not working well on Mac OS X

2005-12-14 Thread Dan Sommers
s grayed out. > Does anyone have any ideas? You may have to "bundle" your app -- i.e., create the whole application.app structure -- rather that just run the python program from within a shell. Cocoa looks for a bunch of resources in standard places before it will let your app inter

Re: Simple (?) question about print statement

2005-12-14 Thread Dan M
On Wed, 14 Dec 2005 15:27:58 -0800, TY wrote: > So I guess then my next question is why does adding comma to print > statement cause buffering, but not when you don't have comma? Because of the line buffering. If you don't have a comma at the end, the print statement prints the numeric value and

Re: how to get select label?

2005-12-14 Thread Dan M
On Wed, 14 Dec 2005 13:56:24 -0800, lli wrote: > I build web application. So I use CGI. I need to show select text in > the html page. Now I can only display select value such as '001'. But I > need to display its text 'AAA'. > > LLI I'm a Python newbie, so by all means verify this answer with m

Newbie question - deleting records from anydbm database

2005-12-14 Thread Dan M
I've been Googling like a mad fiend and flipping through my hard-copy Python books, but still haven't located the one little bit of info I need. I've put together a simple SMTP-after-IMAP script that gets the authorized IP info from the mail log (I know, it's not elegant but it works). All works f

Re: Python packages on OS X vs Windows

2005-12-14 Thread Dan Sommers
the PC world? It can be like falling off a log in the Linux world. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question - deleting records from anydbm database

2005-12-15 Thread Dan M
>> Now how can I go about deleting that record when it's too old? >> > (untested) > > try > > del db[ipAddress] Yep, that did it. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Why and how "there is only one way to do something"?

2005-12-15 Thread Dan Sommers
er to get only > the piece of zen knowledge you need. That's just wrong. [throws hands and arms up in [mock] disgust] Enlightenment does not come in discrete pieces, to be learned one at a time, to be applied selectively. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/d

Re: doubt on csv file

2005-12-15 Thread Dan M
> here is what am trying to do, first am trying to open it in a read > mode, and checking each row by row , if it is not found till my last > row, i want to append it to the last row , so how should i do that. > > file = open ('C:\some.csv','r') > reader = csv.reader(file) > for row in reader: >

Re: doubt on csv file

2005-12-15 Thread Dan M
On Thu, 15 Dec 2005 16:09:51 -0800, muttu2244 wrote: > hey thanks a lot for that it worked . Excellent! Glad to be of assistance :) -- http://mail.python.org/mailman/listinfo/python-list

sorting with expensive compares?

2005-12-22 Thread Dan Stromberg
Hi folks. Python appears to have a good sort method, but when sorting array elements that are very large, and hence have very expensive compares, is there some sort of already-available sort function that will merge like elements into a chain, so that they won't have to be recompared as many time

Re: Socket programming design problem

2005-12-22 Thread Dan Sommers
ad for > each, or is there some other way I can listen on two sockets at once > (maybe non-blocking ones?) Try the select module: http://www.python.org/doc/current/lib/module-select.html Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting with expensive compares?

2005-12-23 Thread Dan Stromberg
On Thu, 22 Dec 2005 22:06:42 +, Dan Stromberg wrote: > > Hi folks. > > Python appears to have a good sort method, but when sorting array elements > that are very large, and hence have very expensive compares, is there some > sort of already-available sort function th

Re: urlretrieve() questions

2005-12-23 Thread Dan M
04 error when you when you request a page that doesn't exist. In these cases you might still have to rely on some clever scripting. -- I hope that helps. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: recursive function return value problems

2005-12-28 Thread Dan Sommers
instead: result = reTest(True) [ rest of example snipped ] HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Python article in Free Software Magazine

2006-01-01 Thread Dan Sommers
d language" ... So does <http://www.python.org/doc/Summary.html>. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHONDOCS

2006-01-02 Thread Dan Sommers
o set a variable and not export it, which means that echo works but nothing else does. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Filename case-insensitivity on OS X

2006-01-03 Thread Dan Sommers
age and then erase it > (again, using Disk Utility) and put UFS on it. You'll find that > "touch foo FOO" will create two files. You may also find some native Mac OS X applications failing in strange ways. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Python or Java or maybe PHP?

2006-01-03 Thread Dan Sommers
that > effect. That would eliminate eval and exec, too. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-05 Thread Dan Sommers
idx = lst; _idx < lst + NLST; ++_idx ) { int *i; i = *_idx; /* compare "the item to which i is bound" to "a constant" */ if( *i == *(&_i2) ) /* rebind i to _i4 */ i = &_i4; } > for (_idx = 0; _idx < NLST; ++_idx) > printf("%d\n"

Re: CGI question

2006-01-05 Thread Dan Sommers
this > entire URL (or even just the bit after the question mark) ... import os query_string = os.environ['QUERY_STRING'] HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-05 Thread Dan Sommers
On Thu, 05 Jan 2006 14:28:51 +0100, David Murmann <[EMAIL PROTECTED]> wrote: > Dan Sommers schrieb: >> int **_idx; >> for( _idx = lst; _idx < lst + NLST; ++_idx ) { >> int *i; >> i = *_idx; >> /* compare "the item to which i is bound" to &quo

Re: Filename case-insensitivity on OS X

2006-01-05 Thread Dan Lowe
e-sensitive HFS+" -volname MyVolume MyVolume.dmg For more information, try "hdiutil create" or "man hdiutil". -dan -- There is nothing new in the world except the history you do not know. -Harry Truman -- http://mail.python.org/mailman/listinfo/python-list

Re: Filename case-insensitivity on OS X

2006-01-06 Thread Dan Lowe
On Jan 3, 2006, at 9:50 PM, Tom Anderson wrote: > On Tue, 3 Jan 2006, Dan Sommers wrote: > >> On Tue, 03 Jan 2006 15:21:19 GMT, >> Doug Schwarz <[EMAIL PROTECTED]> wrote: >> >>> Strictly speaking, it's not OS X, but the HFS file system that is >&g

Re: Converting milliseconds to human time

2006-01-06 Thread Dan Bishop
Harlin Seritt wrote: > I would like to take milliseconds and convert it to a more > human-readable format like: > > 4 days 20 hours 10 minutes 35 seconds > > Is there something in the time module that can do this? I havent been > able to find anything that would do it. The datetime module has some

Re: Filename case-insensitivity on OS X

2006-01-06 Thread Dan Lowe
On Jan 6, 2006, at 1:13 PM, Mark Jackson wrote: > Dan Lowe <[EMAIL PROTECTED]> writes: > >> Think about it - how many things used by average people are case >> sensitive? Passwords? That's about it. (And judging by most user >> passwords I have seen, they

Re: copying a file from windows file system to ext2 and ext3

2006-01-10 Thread Dan M
e there just as if they were created on a real OS :) Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: creating dictionarie names, using variables?

2006-01-11 Thread Dan Sommers
],'dict_'+devDictName] Put the dictionaries you create into another dictionary instead: devDict = { } key = item[5].replace(' ','+') devDict[key] = {'Group':item[2], 'Status':item[3], # etc. } HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: creating dictionarie names, using variables?

2006-01-12 Thread Dan Sommers
asy to call them from within the dictionary. The names of the child dictionaries exist as keys in the parend dictionary. > - also, they dictionary will be dynamic, thus the # of devices is > always changing so they need to be created on-the-fly. Yes, child dictionaries can be creat

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Dan Sommers
oats, tuples, etc can be keys on > initialization ... That has nothing to do with your code: >>> dict(1=4) SyntaxError: keyword can't be an expression >>> int(4=5) SyntaxError: keyword can't be an expression The names of keyword arguments have look like Python identif

Re: how do "real" python programmers work?

2006-01-13 Thread Dan Sommers
On Fri, 13 Jan 2006 17:09:13 +, Tom Anderson <[EMAIL PROTECTED]> wrote: > Ah, of course - to an true believer, emacs *is* the unix toolset. > :) To the true believer, unix runs under emacs. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.

Re: On Numbers

2006-01-14 Thread Dan Sommers
to Chapter 12, <http://www.lisp.org/HyperSpec/Body/chap-12.html>. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: instance attributes not inherited?

2006-01-15 Thread Dan Sommers
n though it *does* indeed work). The __init__ method is an *initializer*, *not* a constructor. By the time __init__ runs, the object has already been constructed; __init__ just does extra initialization. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Preventing class methods from being defined

2006-01-15 Thread Dan Sommers
bar"] class A: if "foo" in allow: def foo( ): ... if "bar" in allow: def bar( ): ... > Don't ask why I would need such a strange animal ... Consider yourself not asked. HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: On Numbers

2006-01-15 Thread Dan Bishop
Alex Martelli wrote: > Paul Rubin wrote: > > > Mike Meyer <[EMAIL PROTECTED]> writes: > > > I'd like to work on that. The idea would be that all the numeric types > > > are representations of reals with different properties that make them > > > appropriate for different u

Re: Preventing class methods from being defined

2006-01-16 Thread Dan Sommers
it magically appear and disappear). By the principle of least surprise, if dir(some_sobject) contains foo, then some_object.foo should *not* raise a NameError. All of the posted solutions to the OP's problem could easily be extended to do something noisy with the (dis-)allowed methods. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: verify a user

2006-01-18 Thread Dan Sommers
print pwd.getpwnam( unix_user_name ) except KeyError: print unix_user_name, 'does not exist' There's a grp module for making similar queries against /etc/group (or the modern equivalent thereof). Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Python code written in 1998, how to improve/change it?

2006-01-19 Thread Dan Sommers
achine by examining attributes of its argument). And then there are (or should be!) purists who will claim that if your state machine requires information to be shared between states, then you don't have enough states! ;-) > We want a goto. No, we don't. Regards, Dan -- Dan Sommers <

Byte array question

2006-07-13 Thread dan . winsor
Hi all, I'm trying to write through SOAPpy in python to a Java implemented API. The API for the method I want to use is as follows: boolean added = SoapService.addAttachmentsToIssue(token, issue.getKey(), new String[]{fileName}, new byte[][]{getBytesF

Re: Byte array question

2006-07-13 Thread Dan Winsor
Sybren Stuvel wrote: > [EMAIL PROTECTED] enlightened us with: > > I want to send thorugh the API. However, no matter how I try it, > > Java on the other end doesn't like what I'm passing it there. > > What have you tried and how did it fail? See below. > > How can I mimic a byte array in python?

Re: Byte array question

2006-07-13 Thread Dan Winsor
Sybren Stuvel wrote: > Dan Winsor enlightened us with: > > This one "works" in that it runs, but the server on the other end gets > > garbage unrelated to the test file. > > Are you sure it is garbage? Have you tried changing byte order? Ah, that I hadn't. A

Re: Byte array question

2006-07-14 Thread Dan Winsor
John Machin wrote: > On 14/07/2006 10:41 AM, Dan Winsor wrote: > > Sybren Stuvel wrote: > >> Dan Winsor enlightened us with: > >>> This one "works" in that it runs, but the server on the other end gets > >>> garbage unrelated to the test f

Re: Byte array question

2006-07-14 Thread Dan Winsor
Marc 'BlackJack' Rintsch wrote: > In the Java snippet from your initial post the `chararray` argument was an > *array* of `Byte` arrays. A string is just an one dimensional "byte > array". Maybe it helps if you put `chararray` into a list!? Yup, thanks, that was one that I did try with no impro

Re: Byte array question

2006-07-14 Thread Dan Winsor
John Machin wrote: > On 14/07/2006 10:41 AM, Dan Winsor wrote: > > Sybren Stuvel wrote: > >> Dan Winsor enlightened us with: > >>> This one "works" in that it runs, but the server on the other end gets > >>> garbage unrelated to the test f

Re: Byte array question

2006-07-14 Thread Dan Winsor
Nevermind. Did it in Java. Thanks anyway to all who gave suggestions. -- http://mail.python.org/mailman/listinfo/python-list

Re: range() is not the best way to check range?

2006-07-17 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > it seems that range() can be really slow: ... > if i in range (0, 1): This creates a 10,000-element list and sequentially searches it. Of course that's gonna be slow. -- http://mail.python.org/mailman/listinfo/python-list

Re: question about what lamda does

2006-07-17 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > Hey there, > i have been learning python for the past few months, but i can seem to > get what exactly a lamda is for. It defines a function. f = lambda x, y: expression is equivalent to def f(x, y): return expression Note that lambda is an expression while def is

Re: range() is not the best way to check range?

2006-07-17 Thread Dan Bishop
Leif K-Brooks wrote: > [EMAIL PROTECTED] wrote: > > or is there an alternative use of range() or something similar that can > > be as fast? > > You could use xrange: > > [EMAIL PROTECTED]:~$ python -m timeit -n1 "1 in range(1)" > 1 loops, best of 3: 260 usec per loop > [EMAIL PROTECTED]

Re: range() is not the best way to check range?

2006-07-18 Thread Dan Bishop
Paul Boddie wrote: > Yes, he wants range to return an iterator, just like xrange more or > less does now. Given that xrange objects support __getitem__, unlike a > lot of other iterators (and, of course, generators), adding > __contains__ wouldn't be much of a hardship. Certainly, compared to > ot

Re: range() is not the best way to check range?

2006-07-19 Thread Dan Bishop
Paul Boddie wrote: > John Machin wrote: > > On 19/07/2006 1:05 AM, Dan Bishop wrote: > > > > > > xrange already has __contains__. > > > > As pointed out previously, xrange is a function and one would not expect > > it to have a __contains__ meth

sysadmin -> python programmer

2006-07-19 Thread Dan Stromberg
I've been a sysadmin for about 13 years, but I'm realizing that my favorite part of being a sysadmin are those moments where there's a reason to write some code - preferably in python. What might one do to make the transition from sysadmin to python programmer, aside from the basics like coming u

Re: An optparse question

2006-07-21 Thread dan . gass
> No, that affects the string printed only *after* the "usage = " string. > What I would like to do is insert some string *before* the "usage = " > string, which is right after the command I type at the command prompt. > So I would like to make it look like this: The example was fine (except for

Re: An optparse question

2006-07-21 Thread dan . gass
> Nope. That only *nearly* does what T wants. The usage message will > still be printed immediately *after* the 'usage: ' string. > > >>> parser = OptionParser(usage=usage) > >>> parser.print_help() > usage: THIS IS NEWLY INSERTED STRING > usage: lopts.py [options] input

Re: self question

2006-07-25 Thread dan . gass
> cnt = 1 > def foo(): > global cnt > cnt += 1 > return cnt > > def bar(x=foo()): > print x > > bar() # 2 > bar() # 2 > bar() # 2 Looks to me like you want to use the following programming pattern to get dynamic default arguments: cnt = 1 def foo(): global cnt

Re: War chest for writing web apps in Python?

2006-07-28 Thread Dan Sommers
sy for platform dependencies to sneak in without being caught. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> "I wish people would die in alphabetical order." -- My wife, the genealogist -- http://mail.python.org/mailman/listinfo/python-list

Re: War chest for writing web apps in Python?

2006-07-28 Thread Dan Sommers
On Fri, 28 Jul 2006 13:03:25 +0200, Sybren Stuvel <[EMAIL PROTECTED]> wrote: > Dan Sommers enlightened us with: >> We just did that at work (developed on the corporate-issued non-Unix >> computers and then deployed on a Linux box), and had no problems at >> all. In

Re: md5 question

2006-08-03 Thread Dan Sommers
On 3 Aug 2006 18:36:14 -0700, "Dan" <[EMAIL PROTECTED]> wrote: > now pretend I wanted to save the string > '8b1a9953c4611296a827abf8c47804d7', and later create a new md5 object > such that when I did md5_w.update(" world") it would then have the hex &

_PyLong_FromByteArray

2006-08-12 Thread Dan Christensen
t the leading underscore makes me wary. Is it safe to use this function? Will it continue to exist in future versions of python? Or is there some other method we should use? We'd like something fairly efficient... Thanks, Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: recommended general-purpose string template packages?

2006-08-14 Thread Dan Sommers
s, form letters, source > code, whatever. And don't forget Python's Template class: http://docs.python.org/lib/node109.html Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> "I wish people would die in alphabetical order." -- My wife, the genealogist -- http://mail.python.org/mailman/listinfo/python-list

Re: what is the keyword "is" for?

2006-08-15 Thread Dan Bishop
Sybren Stuvel wrote [on the difference between is and ==]: > Obviously "a is b" implies "a == b", Not necessarily. >>> a = b = 1e1000 / 1e1000 >>> a is b True >>> a == b False -- http://mail.python.org/mailman/listinfo/python-list

Re: what is the keyword "is" for?

2006-08-15 Thread Dan Bishop
Steve Holden wrote: > daniel wrote: > > Martin v. Löwis wrote: > [...] > >>For some objects, "change the object" is impossible. If you have > >> > >>a = b = 3 > >> > >>then there is no way to change the object 3 to become 4 (say); > >>integer objects are "immutable". So for these, to make a change

Re: Printing n elements per line in a list

2006-08-15 Thread Dan Sommers
it up using while loops and some ugly slicing, but hopefully I'm > missing something Perhaps not the prettiest, but I can't think of anything simpler to read six months from now: counter = 0 for an_element in the_list: print an_element, counter = counter + 1

Re: Printing n elements per line in a list

2006-08-15 Thread Dan Sommers
On 15 Aug 2006 18:33:51 -0700, "John Machin" <[EMAIL PROTECTED]> wrote: > Dan Sommers wrote: >> >> counter = 0 >> for an_element in the_list: >> print an_element, >> counter = counter + 1 >> if counter == n: >> print >> coun

Re: what is the keyword "is" for?

2006-08-16 Thread Dan Sommers
doing anything special; nans have [the equivalent of] an __eq__ method that always returns False. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> "I wish people would die in alphabetical order." -- My wife, the genealogist -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble using "\" as a string

2006-08-19 Thread Dan Bishop
OriginalBrownster wrote: > Hi there... > > I'm still pretty new to turbogears. but i have gotten pretty familiar > with it > > i'm just trying to clear something up, i'm having a difficult time > using \ when declaring a string expression > > such as tempname="\"..it says that the line is single qo

Re: Hands on Documentation for Python methods and Library

2006-10-04 Thread Dan Bishop
On Oct 4, 11:54 pm, Wijaya Edward <[EMAIL PROTECTED]> wrote: > Hi, > > One can do the following with Perl > > $ perldoc -f chomp > $ perldoc -f function_name > > or > > $ perldoc List::MoreUtils > $ perldoc Some::Module > > Can we do the same thing in Python? You can use the help() function at the

Re: printing variables

2006-10-05 Thread Dan Bishop
On Oct 5, 9:47 pm, [EMAIL PROTECTED] wrote: > hi > say i have variables like these > > var1 = "blah" > var2 = "blahblah" > var3 = "blahblahblah" > var4 = "" > var5 = "...".. > > bcos all the variable names start with "var", is there a way to > conveniently print those variables out... > eg prin

Re: Automatic import PEP

2006-10-06 Thread Dan Bishop
On Sep 22, 10:09 pm, Connelly Barnes <[EMAIL PROTECTED]> wrote: > Hi, > > I wrote the 'autoimp' module [1], which allows you to import lazy modules: > > from autoimp import * (Import lazy wrapper objects around all modules; > "lazy >modules" will turn into normal mo

Re: Dive Into Java?

2006-10-09 Thread Dan Bishop
On Oct 9, 11:40 am, Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > Diez B. Roggisch wrote: ... > >> because [Java] wanted to be new and good but took over much of C++'s > >> syntax and made it even weirder, > > Even weirder? Care to explain?Example: > > int spam = 5; > > but > > String eggs = new

Re: Reverse string-formatting (maybe?)

2006-10-15 Thread Dan Sommers
rmation, and the web addresses in the source code aren't available, so I hesitate to post my ancient copy.) HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> "I wish people would die in alphabetical order." -- My wife, the genealogist -- http://mail.python.org/mailman/listinfo/python-list

Re: IDE that uses an external editor?

2006-10-15 Thread Dan Sommers
better with grep and a decent REPL.) Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> "I wish people would die in alphabetical order." -- My wife, the genealogist -- http://mail.python.org/mailman/listinfo/python-list

How to choose the right GUI toolkit ?

2006-11-08 Thread Dan Lenski
n quickly move programs to new measurement computers. I like GTK a lot and Tk is growing on me too.. are there any higher-level "wrapper" toolkits for GTK and Tk? Thanks for any advice! Dan Lenski University of Maryland -- http://mail.python.org/mailman/listinfo/python-list

Re: How to choose the right GUI toolkit ?

2006-11-09 Thread Dan Lenski
Nick Craig-Wood wrote: > John Salerno <[EMAIL PROTECTED]> wrote: > > Dan Lenski wrote: > > > > > So, is there another toolkit I should be looking at? > > > > I highly recommend wxPython. > > I'd second that! > > There is a book also >

Re: How to choose the right GUI toolkit ?

2006-11-09 Thread Dan Lenski
Christophe wrote: > Dan Lenski a écrit : > > Nick and John S., thank you for the tip on wxPython! I'll look into it > > for my next project. I too would avoid Qt, not because of the GPL but > > simply because I don't use KDE under Linux and because Qt is not well &

Re: How to choose the right GUI toolkit ?

2006-11-09 Thread Dan Lenski
iew. Believe me, if the PythonCard programming style had anything to do with LabView, I'd avoid it like the plague =) In any case, I think I'm gonna give PythonCard a shot before trying full-fledged wxPython. It looks ideal for my needs. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: How to choose the right GUI toolkit ?

2006-11-09 Thread Dan Lenski
dgets. > > w. Tk 8.4 appears to use native Win32 widgets under Cygwin and native WinXP. But it definitely doesn't use GTK widgets under Ubuntu with Gnome desktop. Is there a way to get it to do so? Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: How to choose the right GUI toolkit ?

2006-11-09 Thread Dan Lenski
ng up new processes in a timely manner. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple question to split

2006-11-09 Thread Dan Lenski
Yep, use regular expressions! For example, use the regular expression r',|\s+' to split on either (a) any amount of whitespace or (b) a single comma. Try this: import re a='1,2,3,4,5 6 7,3,4' print re.split(r',|\s+*', a) Matthias Winterland wrote: > Hi, > > I have a simple question. When I read

Re: Py3K idea: why not drop the colon?

2006-11-09 Thread Dan Lenski
ofessional and hobby use I have not found a single editor that gets indentation right more than about 90% of the time. The syntax is too darn complicated. With Python, figuring out where to auto-indent is trivial. Works for me. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: How to choose the right GUI toolkit ?

2006-11-10 Thread Dan Lenski
Eric Brunel wrote: > On Thu, 09 Nov 2006 22:01:51 +0100, Dan Lenski <[EMAIL PROTECTED]> wrote: > > Tk 8.4 appears to use native Win32 widgets under Cygwin and native > > WinXP. > > It seems to depend on the widget type, and on what you call native... For > exampl

Re: Py3K idea: why not drop the colon?

2006-11-11 Thread Dan Lenski
as an easy way to do what you want with the "color in (red, green, blue)" construct. This supposedly lacking feature would only be desired by people who have been brain-damaged by programming languages like BASIC and COBOL... or newbies who haven't programmed enough to really "get" Boolean logic. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Singleton Class Exception

2006-11-13 Thread Dan Lenski
single = None def __init__( self ): if Singleton.__single: raise SingletonException() Singleton.__single = self foo = Singleton()# works bar = Singleton() # raises SingletonException Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python for me?

2006-11-13 Thread Dan Lenski
e a program in anything else since learning Python, and I write a LOT of little throwaway programs. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python for me?

2006-11-13 Thread Dan Lenski
Carsten Haese wrote: > On Mon, 2006-11-13 at 10:14 -0800, Dan Lenski wrote: > > lennart wrote: > > > So i ask myself is python the language I'm looking for? > > > > Yep! Python is very much a jack-of-all-trades language. > > I'll run the risk of b

Re: Py3K idea: why not drop the colon?

2006-11-13 Thread Dan Lenski
ut, and typographical conventions affect the ability to easily read and comprehend text. I know that in college I hated one physics textbook which used monospaced fonts... it was well-written but just hurt my eyes to browse through. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Py3K idea: why not drop the colon?

2006-11-14 Thread Dan Lenski
quot; Another problem is that the English word "or" sometimes means "inclusive or" and sometimes means "exclusive or": "Do you have any brothers or sisters?" (inclusive or) "You can carry on a briefcase or a backpack." (exclusive or) I think p

Re: Will GPL Java eat into Python marketshare?

2006-11-15 Thread Dan Lenski
not to move outside of it. The ranks of C++ programmers have already been diminished by many of them jumping to Java, since it offers less complex syntax and better cross-platform support. I expect that GPL'ed Java will accelerate the decline of C++. But I don't see Java competing directly with Python... Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: TSV to HTML

2006-05-31 Thread Dan M
> 1) in the code define a css > 2) use a regex to extract the info between tabs In place of this, you might want to look at http://effbot.org/librarybook/csv.htm Around the middle of that page you'll see how to use a delimiter other than a comma > 3) wrap the values in the appropriate tags and in

Re: dynamic inheritance

2006-06-08 Thread Dan Sommers
lass D(C): pass Why do you want to change a class' base class during runtime? HTH, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> "I wish people would die in alphabetical order." -- My wife, the genealogist -- http://mail.python.org/mailman/listinfo/python-list

os.link makes a copy, not a link

2006-06-09 Thread Dan M
I'm a little bit confused. According to the sources I've looked at on the net, os.link('file1', 'file2') should make a hard link from file1 to file2. But what I'm finding is that it's actually making a copy. Am I forgetting a step or something? Python 2.3.4 running on CentOS 4.3 -- http://m

<    11   12   13   14   15   16   17   18   19   20   >