Re: how do you get the name of a dictionary?

2006-08-22 Thread Fredrik Lundh
Steven D'Aprano wrote: > But an upside is that it would enable more useful error messages, at least > sometimes. Here's some trivial pseudo-code: > > def foo(a): > assert len(a) > 10, "%s is too short" % a.__name__ > > y = "hello" > foo(y) > > would display "AssertionError: y is too short".

Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
<[EMAIL PROTECTED]> wrote: > That's to say, > python is still much faster? Yes it is. But of course you can't sat that "Python is faster than C++". We found that the code to do this, written in the most natural way, is a lot faster in Python. However, if you optimze the code, C++ gets almost as f

Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Ray <[EMAIL PROTECTED]> wrote: > Not really, see my test, in my other post in the same thread. I'm using > VC++ Express 2005. If we're comparing with Python 2.5 I think it's just > fair that for C++ we're using the latest as well. In your test, you are looping 1 times, we looped 100. In P

Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Ray <[EMAIL PROTECTED]> wrote: > I'm using VC++ Express, I didn't care to tweak the optimizations, I > merely chose the "Release" configuration for the executable. It's > blazing fast, taking only 30+ ms each run. Of course it is faster. We are looping 100 times, you just 1. -- blog: h

Re: how do you get the name of a dictionary?

2006-08-22 Thread Georg Brandl
Steven D'Aprano wrote: > On Tue, 22 Aug 2006 10:12:00 -0700, BartlebyScrivener wrote: > how difficult would it be to assign a string name(s) to an object upon creation (and upon referencing)? >> >> Exactly the point that's being made. It's so easy just do it yourself: >> >> banana={"na

Re: how do you get the name of a dictionary?

2006-08-22 Thread Fredrik Lundh
jojoba wrote: no, you're just wasting a lot of bandwidth making it clear that you just cannot be bothered to learn how things actually work. > > By the way, what exactly led you to this conclusion? the fact that despite all attempts to explain how things work, you're still haven't rea

Re: Can I do this with list comprehension?

2006-08-22 Thread Ben Finney
[EMAIL PROTECTED] writes: > Let's say I have two lists: > > a = [0, 1, 0, 1, 1, 0] > b = [2, 4, 6, 8, 10, 12] > > I want a list comprehension that has the elements in b where a[element] > == 1. > > That's to say, in the example above, the result must be: [4, 8, 10] > > Any hints? What have yo

Re: Has anyone used py-xmlrpc?

2006-08-22 Thread Fredrik Lundh
David Hirschfield wrote: > Searching for a python xmlrpc implementation that supports asynchronous > requests if you have an asynchronous transport, using the builtin xmlrpclib module to pack and unpack the requests isn't that hard. (see xmlrpclib.dumps and xmlrpclib.loads, respectively) --

Embedding Python in an application plug-in ( .so )

2006-08-22 Thread bEngO
Dear all,When embedding we must link with the python library AND USE -rdynamic OR -Wl,-export-dynamic OR -Xlinker -export-dynamicto export ALL symbols from the Python library even if we do not use all of them. This is needed when the embedded Python import modules to avoid undefined symbol errors.B

Re: key not found in dictionary

2006-08-22 Thread Fredrik Lundh
Ben Finney wrote: > In the specific use case of wanting a default value when a dictionary > doesn't have a particular key, you can also use this: > > >>> foo = {0: "spam", 1: "eggs", 7: "beans"} > >>> for key in [1, 2, 7]: > ... desc = foo.get(key, None) usually spelled de

Re: Can I do this with list comprehension?

2006-08-22 Thread Gabriel Genellina
At Wednesday 23/8/2006 01:07, [EMAIL PROTECTED] wrote: a = [0, 1, 0, 1, 1, 0] b = [2, 4, 6, 8, 10, 12] I want a list comprehension that has the elements in b where a[element] == 1. That's to say, in the example above, the result must be: [4, 8, 10] print [belem for aelem,belem in zip(a,b) if

Re: Can I do this with list comprehension?

2006-08-22 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > Let's say I have two lists: > > a = [0, 1, 0, 1, 1, 0] > b = [2, 4, 6, 8, 10, 12] > > I want a list comprehension that has the elements in b where a[element] > == 1. > > That's to say, in the example above, the result must be: [4, 8, 10] > > Any hints? >>> from ite

Re: Can I do this with list comprehension?

2006-08-22 Thread Cliff Wells
On Tue, 2006-08-22 at 21:07 -0700, [EMAIL PROTECTED] wrote: > b = [2, 4, 6, 8, 10, 12] >>> a = [0, 1, 0, 1, 1, 0] >>> b = [2, 4, 6, 8, 10, 12] >>> [ j for i, j in zip ( a, b ) if i ] [4, 8, 10] -- -- http://mail.python.org/mailman/listinfo/python-list

Can I do this with list comprehension?

2006-08-22 Thread barberomarcelo
Let's say I have two lists: a = [0, 1, 0, 1, 1, 0] b = [2, 4, 6, 8, 10, 12] I want a list comprehension that has the elements in b where a[element] == 1. That's to say, in the example above, the result must be: [4, 8, 10] Any hints? Marcelo -- http://mail.python.org/mailman/listinfo/python-l

Re: Python and STL efficiency

2006-08-22 Thread Ray
[EMAIL PROTECTED] wrote: > That's to say, > python is still much faster? Not really, see my test, in my other post in the same thread. I'm using VC++ Express 2005. If we're comparing with Python 2.5 I think it's just fair that for C++ we're using the latest as well. > I am a c++ newbie but I thin

Re: Python and STL efficiency

2006-08-22 Thread could . net
That's to say, python is still much faster? I am a c++ newbie but I think c++ should be faster here. Maybe someone can post this to the c++ maillist and they will tell how to accelerate it. Tim N. van der Leeuw wrote: > Mc Osten wrote: > > Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > > Python'

Re: swapping numeric items in a list

2006-08-22 Thread bearophileHUGS
Jiang Nutao: > To convert list > aa = [0x12, 0x34, 0x56, 0x78] > into > [0x34, 0x12, 0x78, 0x56] > How to do it fast? My real list is huge. Note that: >>> a = range(6) >>> a [0, 1, 2, 3, 4, 5] >>> a[::2] [0, 2, 4] >>> a[1::2] [1, 3, 5] So you can do: >>> a[::2], a[1::2] = a[1::2], a[::2

Re: What do you want in a new web framework?

2006-08-22 Thread John J. Lee
[EMAIL PROTECTED] writes: > hardemr wrote: > > > I've just read all of the answers. Most of yours said that there are > > many web frameworks ,so it is nonsense to make a new web framework in > > python. > > Hardemr, I like Ajacksu's answer, with a twist. Please concnentrate on > writing a Visua

Re: key not found in dictionary

2006-08-22 Thread Simon Forman
> Or you can use the has_key() and test it first. For example > > if foo.has_key('bar'): > print 'we have it' > else : > print 'we don't have bar.' > Nowadays you can also say: if 'bar' in foo: # do something -- http://mail.python.org/mailman/listinfo/python-list

Re: What are decorated functions?

2006-08-22 Thread Richard Jones
Gabriel Genellina wrote: > At Tuesday 22/8/2006 17:19, Wolfgang Draxinger wrote: >> I'm just reading the python language reference and came around >> the term "decorated functions", but I have no idea, for what >> they could be used. > > A decorator takes a function/method/callable, "decorates" (m

Re: Python Editor with Autocorrection

2006-08-22 Thread John J. Lee
"Ravi Teja" <[EMAIL PROTECTED]> writes: [...] > Most good editors (Scintilla based editors, Emacs, Vi etc) have > auto-completion for symbols that have occured in the current file; and What I find really useful in emacs is completion based on *all* open files (usually I have maybe twenty files ope

Re: key not found in dictionary

2006-08-22 Thread Ben Finney
"KraftDiner" <[EMAIL PROTECTED]> writes: > I have a dictionary and sometime the lookup fails... > it seems to raise an exception when this happens. > What should I do to fix/catch this problem? > > desc = self.numericDict[k][2] > KeyError: 589824 < This is the error that is being produc

Re: swapping numeric items in a list

2006-08-22 Thread Simon Forman
Jiang Nutao wrote: > Hi, > > I simplify my problem like below > > To convert list > aa = [0x12, 0x34, 0x56, 0x78] > into > [0x34, 0x12, 0x78, 0x56] > > How to do it fast? My real list is huge. > > Thanks a lot. > Jason Here's simple and probably fast enough way (but it won't work right on

Re: how do you get the name of a dictionary?

2006-08-22 Thread jojoba
thanks Steven! that does help! cheers, jojoba o(-_-)o -- http://mail.python.org/mailman/listinfo/python-list

Re: swapping numeric items in a list

2006-08-22 Thread faulkner
for i in xrange(0, len(your_list), 2): your_list[i], your_list[i + 1] = your_list[i + 1], your_list[i] Jiang Nutao wrote: > Hi, > > I simplify my problem like below > > To convert list > aa = [0x12, 0x34, 0x56, 0x78] > into > [0x34, 0x12, 0x78, 0x56] > > How to do it fast? My real li

Re: how do you get the name of a dictionary?

2006-08-22 Thread Steven D'Aprano
On Tue, 22 Aug 2006 09:34:36 -0700, jojoba wrote: > i don't want to do anything sophisticated with this, i am really only > looking for a TITLE for my dictionary when i throw it in a tree editor > that i have built. And i do realize that its not possible now. I am just > pressing a point here. So

Re: how do you get the name of a dictionary?

2006-08-22 Thread Steven D'Aprano
On Tue, 22 Aug 2006 10:12:00 -0700, BartlebyScrivener wrote: >>> how difficult would it be to assign a string name(s) >>> to an object upon creation (and upon referencing)? > > Exactly the point that's being made. It's so easy just do it yourself: > > banana={"name":"banana"} > > Hey what is th

Re: What are decorated functions?

2006-08-22 Thread Gabriel Genellina
At Tuesday 22/8/2006 17:19, Wolfgang Draxinger wrote: I'm just reading the python language reference and came around the term "decorated functions", but I have no idea, for what they could be used. A decorator takes a function/method/callable, "decorates" (modifies) it in a certain way, and r

swapping numeric items in a list

2006-08-22 Thread Jiang Nutao
Hi, I simplify my problem like below To convert list aa = [0x12, 0x34, 0x56, 0x78] into [0x34, 0x12, 0x78, 0x56] How to do it fast? My real list is huge. Thanks a lot. Jason -- http://mail.python.org/mailman/listinfo/python-list

Has anyone used py-xmlrpc?

2006-08-22 Thread David Hirschfield
Searching for a python xmlrpc implementation that supports asynchronous requests, I stumbled on this project: http://www.xmlrpc.com/discuss/msgReader$1573 The author is Shilad Sen, and it appears to do what I'm looking for. But I'd love some feedback from anyone who might have used it before I

Re: What are decorated functions?

2006-08-22 Thread Wolfgang Draxinger
Daniel O'Brien wrote: > How one actually makes use of decorators beyond the above is an > exercise of imagination. Now it rings a bell, thx. Wolfgang Draxinger -- E-Mail address works, Jabber: [EMAIL PROTECTED], ICQ: 134682867 GPG key FP: 2FC8 319E C7D7 1ADC 0408 65C6 05F5 A645 1FD3 BD3E -- ht

Re: Job Jar

2006-08-22 Thread ajaksu
Hi there Steve D wrote: > (...) Basically, I'd like to > create a web-based "job jar", that users in my office can access in > order to view, and "take ownership" of, misc. office tasks. I've seen this kind of feature working in Trac [1], but what you really want is task management software. Of t

Re: Unclear on argument passing to "sendmail'

2006-08-22 Thread John Draper
I will respond to part of this, although it wasn't directed to me. Tim Williams wrote: > However it really depends on the use-case, relaying through another > server will give you no control over bad addresses, you have to wait > for bounces from the recipient's server, or conversely the ISP

Re: Python and STL efficiency

2006-08-22 Thread Ray
Tim N. van der Leeuw wrote: > Incidentally, I also have a version compiled with VC++ 6 now... (not > yet w/VC++ 7) .. Compiled with release-flags and maximum optimization > for speed, here's the result of VC++ 6: OK, now I'm getting obsessed with this too ;-) I'm using VC++ Express, I didn't ca

Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote: > And the results of IronPython (1.0rc2) are just in as well: I can't test this one. > > And for Python 2.5: > [EMAIL PROTECTED] ~/My Documents/Python > $ /cygdrive/c/Python25/python.exe SpeedTest.py > Begin Test > Number of unique string objects:

Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote: > My conclusion from that is, that the vector<> or set<> implementations > of GCC are far superior to those of VC++ 6, but that memory allocation > for GCC 3.4.5 (MinGW version) is far worse than that of MSCRT / VC++ 6. > (And Python still smokes the

Re: Python and STL efficiency

2006-08-22 Thread Mc Osten
Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote: > NB: Your code now tests for address-equality. Does it also still test > for string-equality? It looks to me that it does, but it's not quite > clear to me. It does it. set b(a.begin(), a.end()); set c; // well ordered set (b is ordered by

Re: What are decorated functions?

2006-08-22 Thread Daniel O'Brien
PEP 318 provides some great examples: http://www.python.org/dev/peps/pep-0318/ For more information no the decorator pattern in general: http://en.wikipedia.org/wiki/Decorator_pattern How one actually makes use of decorators beyond the above is an exercise of imagination. Wolfgang Draxinger wrot

RE: Newbie questions for Python usage

2006-08-22 Thread Caolan
Title: Re: Newbie questions for Python usage Thanks Fred. > just assign to the attribute and be done with>  it.  if you want to use a placeholder value, use None:   I thought I had tried that already but got an error. I'll try it again, and as for the 2nd one, I was hoping to avoid the us

Re: Newbie questions for Python usage

2006-08-22 Thread Fredrik Lundh
Caolan wrote: >1. I understand HOW to use the lambda operator, but WHY would you > want to use it? Can anyone please give an example of WHY you would > need it as opposed to just declaring a function either in the > local scope, or outside? you don't *need* it, because

Re: Unclear on argument passing to "sendmail'

2006-08-22 Thread Tim Williams
On 22/08/06, Tim Roberts <[EMAIL PROTECTED]> wrote: > John Draper <[EMAIL PROTECTED]> wrote: Hi Tim :) > Tim William's answer is not exactly correct. The host you specify in the > smtplib.SMTP constructor should NOT be the MX record for any of the > recipients. You should never have to look up

Newbie questions for Python usage

2006-08-22 Thread Caolan
Hello,   I am fairly new to Python and after exploring the language some I have some questions:   I understand HOW to use the lambda operator, but WHY would you want to use it? Can anyone please give an example of WHY you would need it as opposed to just declaring a function either in

Re: how do you get the name of a dictionary?

2006-08-22 Thread jojoba
> > Wow Fredrick! Are you serious? > > yes. > Thank you for the clear answer. > >> no, you're just wasting a lot of bandwidth making it clear that you just > >> cannot be bothered to learn how things actually work. By the way, what exactly led you to this conclusion? jojoba -- http://mail

Re: Can, and if yes how could this be done elegant?

2006-08-22 Thread Carl Banks
Wolfgang Draxinger wrote: > I'm currently developing vegetation creation scripts for the > Blender 3D modelling software. The first attempts work nice, but > they're far to inflexible IMHO. > > First let me introduce how the system works: The user supplies a > series of building elements of the pla

Re: how do you get the name of a dictionary?

2006-08-22 Thread Fredrik Lundh
jojoba wrote: >> no, you're just wasting a lot of bandwidth making it clear that you just >> cannot be bothered to learn how things actually work. > > Wow Fredrick! Are you serious? yes. -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you get the name of a dictionary?

2006-08-22 Thread jojoba
> > I know i must be driving python purists to their limits... > no, you're just wasting a lot of bandwidth making it clear that you just > cannot be bothered to learn how things actually work. Wow Fredrick! Are you serious? Hey man, come on.I got lambasted on this topic from the beginning. Eve

Re: What do you want in a new web framework?

2006-08-22 Thread Cliff Wells
On Tue, 2006-08-22 at 08:15 +, Tim Roberts wrote: > Ordinarily, I think the "do it yourself" nature of Python is a great thing, > and I would never try to dissuade someone from reinventing something > themselves. However, in the case of web frameworks, I believe Marc is > fundamentally correc

Re: how do you get the name of a dictionary?

2006-08-22 Thread Fredrik Lundh
jojoba wrote: > I know i must be driving python purists to their limits... no, you're just wasting a lot of bandwidth making it clear that you just cannot be bothered to learn how things actually work. do you behave this way in real life too, or is it just something you're doing on the interne

Re: Python and STL efficiency

2006-08-22 Thread Tim N. van der Leeuw
Maric Michaud wrote: > Le mardi 22 août 2006 12:55, Mc Osten a écrit : > > In fact Python here is faster. Suppose it has a really optimized set > > class... > > Maybe I'm missing something but the posted c++codes are not equivalent IMO to > what python is doing. I discarded the "slow" version, and

Re: Python and STL efficiency

2006-08-22 Thread Fredrik Lundh
Maric Michaud wrote: > The problem here, is that the strings in the set are compared by value, which > is not optimal, and I guess python compare them by adress ("s*n is s*n" has > the same complexity than "s*n == s*n" in CPython, right ?). wrong. > timeit -s"s='x'; n=1000" "s*n is n*s" 1

Re: how do you get the name of a dictionary?

2006-08-22 Thread jojoba
> How do you take "any" dictionary? Don't you have to know a name to refer > to it? Just pass this very name as additional argument to your tree > viewer. I know i must be driving python purists to their limits...but I'm not sure how to dynamically pass the name of the dictionary without hard

Re: Python and STL efficiency

2006-08-22 Thread Tim N. van der Leeuw
[EMAIL PROTECTED] wrote: > Tim> But beware! For Python2.5 I had to change the code slightly, > Tim> because it already realized that the expression > > Tim> '%s' % 'something' > > Tim> will be a constant expression, and evaluates it once only... so I > Tim> had to replace '%s' with

Pure Python Oracle module

2006-08-22 Thread Ellinghaus, Lance
Title: Pure Python Oracle module Does anyone know of a pure Python module for Oracle similar to Java's pure Oracle module? Thank you! Lance Ellinghaus -- http://mail.python.org/mailman/listinfo/python-list

Can, and if yes how could this be done elegant?

2006-08-22 Thread Wolfgang Draxinger
I'm currently developing vegetation creation scripts for the Blender 3D modelling software. The first attempts work nice, but they're far to inflexible IMHO. First let me introduce how the system works: The user supplies a series of building elements of the plants to be generated (e.g. stem, stipe

What are decorated functions?

2006-08-22 Thread Wolfgang Draxinger
I'm just reading the python language reference and came around the term "decorated functions", but I have no idea, for what they could be used. Any reply gracefully accepted. Wolfgang Draxinger -- E-Mail address works, Jabber: [EMAIL PROTECTED], ICQ: 134682867 GPG key FP: 2FC8 319E C7D7 1ADC 040

Re: Python and STL efficiency

2006-08-22 Thread Maric Michaud
Le mardi 22 août 2006 12:55, Mc Osten a écrit : > In fact Python here is faster. Suppose it has a really optimized set > class... Maybe I'm missing something but the posted c++codes are not equivalent IMO to what python is doing. I discarded the "slow" version, and tried to get the equivalent in

Re: Python and STL efficiency

2006-08-22 Thread skip
Tim> But beware! For Python2.5 I had to change the code slightly, Tim> because it already realized that the expression Tim> '%s' % 'something' Tim> will be a constant expression, and evaluates it once only... so I Tim> had to replace '%s' with a variable, and I got the timing

Re: Python and STL efficiency

2006-08-22 Thread Tim N. van der Leeuw
Tim N. van der Leeuw wrote: > Mc Osten wrote: > > Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote: > > > > > Oh boy; yes indeed the slow python is faster than the fast C++ > > > version... Must be something really awful happening in the STL > > > implementation that comes with GCC 3.4! > > > > And

Re: https on ActiveState Python 2.4?

2006-08-22 Thread Jack
Thanks Dennis and Fredrik. This actualy works! I just copyed _socket.pyd and _ssl.pyd from regular Python 2.4.3 into the DLLs directory of the ActiveState Python installation. urllib2.urlopen() starts working for https links :) I copied ssleay32.dll and libeay32.dll earlier. "Fredrik Lundh" <[E

Re: how do you get the name of a dictionary?

2006-08-22 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, jojoba wrote: > Aha. > my problem, (which as i said before, is not really an important > problem) is to take any dictionary and load it into a tree viewer AND > get the name(s) of that dictionary (if they exist, and if not, so be > it). How do you take "any" dictionary

Re: radio buttons in curses

2006-08-22 Thread Fabian Braennstroem
Sorry, me again... Does nobody have an idea or is it to stupid? * Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > Hi, > > I want to add some radio and check buttons to my curses > script. As I understand it, there are no buttons in the > 'basic' curses module. Now, I found the curses-extra module

Re: key not found in dictionary

2006-08-22 Thread Pierre Quentel
Depending on what you want to do if the key doesn't exist, you might want to use the dictionary method get() : value = some_dict.get(key,default) sets value to some_dict[key] if the key exists, and to default otherwise Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: key not found in dictionary

2006-08-22 Thread Philippe Martin
KraftDiner wrote: > I have a dictionary and sometime the lookup fails... > it seems to raise an exception when this happens. > What should I do to fix/catch this problem? > > desc = self.numericDict[k][2] > KeyError: 589824 < This is the error that is being produced, > because there is

Re: Job Jar

2006-08-22 Thread Gabriel Genellina
At Tuesday 22/8/2006 15:47, D wrote: Thanks, Fredrik - but could I adapt them so that, instead of using them for bug tracking (don't need version control, etc.), they're just used for keeping track of simple tasks? Roundup is generic enough to be used for alm

Re: key not found in dictionary

2006-08-22 Thread Chaz Ginger
KraftDiner wrote: > I have a dictionary and sometime the lookup fails... > it seems to raise an exception when this happens. > What should I do to fix/catch this problem? > > desc = self.numericDict[k][2] > KeyError: 589824 < This is the error that is being produced, > because there is n

Re: key not found in dictionary

2006-08-22 Thread [EMAIL PROTECTED]
KraftDiner wrote: > I have a dictionary and sometime the lookup fails... > it seems to raise an exception when this happens. > What should I do to fix/catch this problem? > > desc = self.numericDict[k][2] > KeyError: 589824 < This is the error that is being produced, > because there is no

Re: text editor suggestion?

2006-08-22 Thread John Salerno
Ravi Teja wrote: > ??? > > In the same file, near the top. > > keywordclass.python=and assert break class continue def del elif \ > else except exec finally for from global if import in is lambda None \ > not or pass print raise return try while yield > > I could add my own keywords to it. >

Re: key not found in dictionary

2006-08-22 Thread hiaips
KraftDiner wrote: > I have a dictionary and sometime the lookup fails... > it seems to raise an exception when this happens. > What should I do to fix/catch this problem? > > desc = self.numericDict[k][2] > KeyError: 589824 < This is the error that is being produced, > because there is n

key not found in dictionary

2006-08-22 Thread KraftDiner
I have a dictionary and sometime the lookup fails... it seems to raise an exception when this happens. What should I do to fix/catch this problem? desc = self.numericDict[k][2] KeyError: 589824 < This is the error that is being produced, because there is no key 589824. -- http://mail.p

Re: Create a Multilanguage PDF in Python

2006-08-22 Thread Perseo
Nothing to do! I enable test2.py and the folder with 777 permission and I write at the top of the file the PYTHONPATH "#!/usr/bin/python" as you told me but it doesn't works as well. this is my organization: www.domain.com/python/reportlab/ [all files] www.domain.com/python/test2.py #!/usr/bin/p

Re: Job Jar

2006-08-22 Thread D
Thanks, Fredrik - but could I adapt them so that, instead of using them for bug tracking (don't need version control, etc.), they're just used for keeping track of simple tasks? Fredrik Lundh wrote: > D wrote: > > > Hello, I apologize in advance for the vague description, but as of now > > I only

Re: https on ActiveState Python 2.4?

2006-08-22 Thread Fredrik Lundh
Jack wrote: > Thanks for the reply. > > I found some openSSL patches for earlier versions of ActiveState Python. > It involves .pyd files and they look for earlier versions of Python DLLs and > don't run on ActiveState Python 2.4. I suspect the regular Python solution > would > have the same pro

Re: Job Jar

2006-08-22 Thread Fredrik Lundh
D wrote: > Hello, I apologize in advance for the vague description, but as of now > I only have an idea of what I'd like to do, and need some guidance as > to if it is feasible, and where to begin. Basically, I'd like to > create a web-based "job jar", that users in my office can access in > orde

Re: https on ActiveState Python 2.4?

2006-08-22 Thread Jack
Thanks for the reply. I found some openSSL patches for earlier versions of ActiveState Python. It involves .pyd files and they look for earlier versions of Python DLLs and don't run on ActiveState Python 2.4. I suspect the regular Python solution would have the same problem or even more problems

Re: how do you get the name of a dictionary?

2006-08-22 Thread Fredrik Lundh
jojoba wrote: > However, although python's object model does not currently support what > i am asking for, how difficult would it be to assign a string name(s) > to an object upon creation (and upon referencing)? if you want to add additional behaviour to an object, wrap it in custom class, or u

Re: how do you get the name of a dictionary?

2006-08-22 Thread jojoba
> At the risk of stating the obvious, why don't you simply add a parameter > for the title in the invocation of the tree editor? I.e. instead of > invoke_tree_editor(somedict) > do > invoke_tree_editor(somedict, "somedict") > HTH, > Carsten. Thanks Carsten. This would indeed allow me to assign

Job Jar

2006-08-22 Thread D
Hello, I apologize in advance for the vague description, but as of now I only have an idea of what I'd like to do, and need some guidance as to if it is feasible, and where to begin. Basically, I'd like to create a web-based "job jar", that users in my office can access in order to view, and "take

Re: Problem of function calls from map()

2006-08-22 Thread Fredrik Lundh
Sion Arrowsmith wrote: >> (you cannot really use "profile" to *benchmark* things written in Python >> either; the >> profiler tells you where a given program spends the time, not how fast it is >> in com- >> parision with other programs) > > Hmm. Playing around with timeit suggests that althoug

Re: how do you get the name of a dictionary?

2006-08-22 Thread Gabriel Genellina
At Tuesday 22/8/2006 13:34, jojoba wrote: i don't want to do anything sophisticated with this, i am really only looking for a TITLE for my dictionary when i throw it in a tree editor that i have built. And i do realize that its not possible now. I am just pressing a point here. Sorry to ruffle

Re: text editor suggestion?

2006-08-22 Thread Ravi Teja
John Salerno wrote: > Ravi Teja wrote: > > > Stick to SciTE. It takes almost no learning effort and meets everyone > > of those requirements. As far as customerization goes, SciTE can be > > customerized quite well. In fact, it can even be scripted with Lua. You > > seem to be using the single fil

Re: how do you get the name of a dictionary?

2006-08-22 Thread Carsten Haese
On Tue, 2006-08-22 at 12:34, jojoba wrote: > Hello again, > > Fredrick said: > > > Python's object model. an object has a value, a type, and an identity, > > but no name. > > I say: > > Thank you Fredrick for the reply! > However, although python's object model does not currently support what

Re: how do you get the name of a dictionary?

2006-08-22 Thread jojoba
> Exactly the point that's being made. It's so easy just do it yourself: > banana={"name":"banana"} > Hey what is the name of my dictionary? > banana["name"] > But why build it into Python and force everyone else to do it, when > most of the time nobody cares what the name is, or they already know?

Unicode Error

2006-08-22 Thread Gallagher, Tim (NE)
Hey all I am learning Python and having a fun time doing so.  I have a question for y'all, it has to do with active directory.   I want to get the last login for a computer from Active Directory.  I am using the active_directory module and here is my code.   [START

Re: Input from the same file as the script

2006-08-22 Thread Dieter Maurer
Georg Brandl <[EMAIL PROTECTED]> writes on Sun, 20 Aug 2006 20:08:38 +0200: > [EMAIL PROTECTED] wrote: > > Can the input to the python script be given from the same file as the > > script itself. e.g., when we execute a python script with the command > > 'python > When I ran the below the python i

Re: Create a Multilanguage PDF in Python

2006-08-22 Thread Perseo
Thanks I will try it. Diez B. Roggisch wrote: > Perseo wrote: > > > I can't upload in the PYTHONPATH but in a normal folder of our site. > > Exist another way to do it? > > PYTHONPATH is an environment variable. You can set it to arbitrary paths, > and python will look for module there, too. Or yo

Re: How to get database metadata information (i.e. existing tables and columns in tables)

2006-08-22 Thread Luis M. González
If you want to know the names of the fields on a recordset, you can use cursor.description. For example, lets say you have a connection to a MySQL database: con = MySQLdb.connect('localhost','root','','mydb') cur = con.cursor() cur.execute('select * from customers') result = cur.fetchall() fields

Re: Unclear on argument passing to "sendmail'

2006-08-22 Thread John Draper
Tim Williams wrote: > On 21/08/06, John Draper <[EMAIL PROTECTED]> wrote: > >> In "smtplib" module, the "sendmail" method of function is to be passed > > > host, but it is the Domain name > >> for the SMTP Server as gotten from the "dig" command? IE: dig -tMX >> would give me the SMTP >> serv

Re: how do you get the name of a dictionary?

2006-08-22 Thread BartlebyScrivener
>> how difficult would it be to assign a string name(s) >> to an object upon creation (and upon referencing)? Exactly the point that's being made. It's so easy just do it yourself: banana={"name":"banana"} Hey what is the name of my dictionary? banana["name"] But why build it into Python and f

Re: Need advice on how to improve this function

2006-08-22 Thread Gabriel Genellina
At Monday 21/8/2006 12:03, Larry Bates wrote: > I wrote a function that converts a tuple of tuples into html. For > example: > I'd like to know ways to make it better (more efficient, able to deal > with enormous-size arguments, etc). How would I write this as a > generator? Before you put too

Re: how do you get the name of a dictionary?

2006-08-22 Thread Georg Brandl
jojoba wrote: > Hello again, > > Fredrick said: > >> Python's object model. an object has a value, a type, and an identity, >> but no name. > > I say: > > Thank you Fredrick for the reply! > However, although python's object model does not currently support what > i am asking for, how difficul

Re: idutils and Python

2006-08-22 Thread [EMAIL PROTECTED]
Ramon Diaz-Uriarte wrote: > On 21 Aug 2006 22:56:13 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > What exactly are you trying to accomplish? If you want to index > > function/class names, variables, etc then you should take a look at > > "exuberant ctags" http://ctags.sourceforge.net53

Re: Python and STL efficiency

2006-08-22 Thread Tim N. van der Leeuw
Mc Osten wrote: > Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote: > > > Oh boy; yes indeed the slow python is faster than the fast C++ > > version... Must be something really awful happening in the STL > > implementation that comes with GCC 3.4! > > And the Python version does the very same number

Re: Translating Javascript programs to python.

2006-08-22 Thread Diez B. Roggisch
Vyz schrieb: > Hi, > I have a script with hundreds of lines of javascript spread accross 7 > files. Is there any tool out there to automatically or > semi-automatically translate the code into python. Nope. Besides: in which environment does that script run - a browser? Then it would be difficul

Re: how do you get the name of a dictionary?

2006-08-22 Thread jojoba
Hello again, Fredrick said: > Python's object model. an object has a value, a type, and an identity, > but no name. I say: Thank you Fredrick for the reply! However, although python's object model does not currently support what i am asking for, how difficult would it be to assign a string nam

Translating Javascript programs to python.

2006-08-22 Thread Vyz
Hi, I have a script with hundreds of lines of javascript spread accross 7 files. Is there any tool out there to automatically or semi-automatically translate the code into python. Thanks Vyz -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem of function calls from map()

2006-08-22 Thread Sion Arrowsmith
Fredrik Lundh <[EMAIL PROTECTED]> wrote: >Sion Arrowsmith wrote: >> I think there's something weird going on -- sp4 should be making >> 154563 calls to str.split. So no wonder it goes faster -- it's not doing >> any work. >the problem is that he's using a Python-level profiler to benchmark things

Re: CONSTRUCT - Module Attributes and Execution Environment

2006-08-22 Thread Georg Brandl
Larry Bates wrote: > lazaridis_com wrote: >> I would like to change the construct: >> >> if __name__ == '__main__': >> >> to something like: >> >> if exec.isMain(): >> >> My (OO thought) is to place a class in an separate code module and to >> instantiate an singleton instance which would keep

Re: CONSTRUCT - Module Attributes and Execution Environment

2006-08-22 Thread Larry Bates
lazaridis_com wrote: > I would like to change the construct: > > if __name__ == '__main__': > > to something like: > > if exec.isMain(): > > My (OO thought) is to place a class in an separate code module and to > instantiate an singleton instance which would keep th something like > this: > >

Re: unicode "table of character" implementation in python

2006-08-22 Thread Nicolas Pontoizeau
2006/8/22, Brian Beck <[EMAIL PROTECTED]>: > Nicolas, check out the unicodedata module: > http://docs.python.org/lib/module-unicodedata.html > > Find "import unicodedata" on this page for how to use it: > http://www.amk.ca/python/howto/unicode > > I'm not sure if it has built-in support for finding

Re: unicode "table of character" implementation in python

2006-08-22 Thread Brian Beck
Nicolas Pontoizeau wrote: > I am handling a mixed languages text file encoded in UTF-8. Theres is > mainly French, English and Asian languages. I need to detect every > asian characters in order to enclose it by a special tag for latex. > Does anybody know if there is a unicode "table of character"

  1   2   >