Problem using Optional pyparsing

2007-08-16 Thread Nathan Harmston
Hi, I know this isnt the pyparsing list, but it doesnt seem like there is one. I m trying to use pyparsing to parse a file however I cant get the Optional keyword to work. My file generally looks like this: ALIGNMENT 1020 YS2-10a02.q1k chr09 1295 42141045 142297 C1254 95.06

Re: threads, mutual exclusion, and lists

2007-08-16 Thread Martin v. Löwis
>> My question is -- are python list operations atomic? If they are not, >> then I assume I need to put some mutual exclusion around the append() >> and pop() calls ? > > They are not, but there is one included in the standard library: > http://docs.python.org/dev/lib/module-Queue.html Why do you

Re: ElementTree surprise

2007-08-16 Thread Stefan Behnel
Paul Rubin wrote: > Torsten Bronger <[EMAIL PROTECTED]> writes: >>> >> Technically, text is nodes as all other element nodes. In the >> parrot example, there is no empty textnode but no textnode at all. > > That is required by the xml standard? If yes, elementtree is doing > the right thing

twisted.web's xmlrpc with digest authencitation

2007-08-16 Thread exhuma.twn
I recently found a link[1] which demonstrates how to secure a xml-rpc service with basic HTTP-auth. But this get's send in clear-text over the net. There's also the HTTP-Digest auth mechanism which is apparently supported as well by twisted[2]. How do I secure an xml-rpc service using digest-auth

Re: ElementTree surprise

2007-08-16 Thread Paul Rubin
Stefan Behnel <[EMAIL PROTECTED]> writes: > So it's not even an ElementTree thing. ET just doesn't know what > exactly was in the original XML byte stream. A very simple way to > make sure you always get a string back is > >>> text = element.text or "" Thanks, I ended up doing something like t

python socket usage

2007-08-16 Thread Oğuz Yarımtepe
Is it possible to send a data object like a tuple or a list in socket programming? If so how? It seems with socket module it is only possible to send strings. -- Oğuz Yarımtepe http://www.yarimtepe.com/en -- http://mail.python.org/mailman/listinfo/python-list

ploting issues in program

2007-08-16 Thread yadin
hi every one! can you please help me to fix these polar plot in db's so that the center is at the minimun negative number in voltagedb about [-50] and the maximun is at zero and how can i see values on the axis like showing that the axes start at -50 -40 -30 .and end at zero than you here is

Re: python socket usage

2007-08-16 Thread markacy
On 16 Sie, 09:42, O uz Yar mtepe <[EMAIL PROTECTED]> wrote: > Is it possible to send a data object like a tuple or a list in socket > programming? If so how? It seems with socket module it is only possible to > send strings. > > -- > O uz Yar mtepehttp://www.yarimtepe.com/en Hi Oguz, why don't

Re: Problem using Optional pyparsing

2007-08-16 Thread Peter Otten
Nathan Harmston wrote: > I know this isnt the pyparsing list, but it doesnt seem like there is > one. I m trying to use pyparsing to parse a file however I cant get > the Optional keyword to work. My file generally looks like this: > > ALIGNMENT  1020  YS2-10a02.q1k chr09     1295       42    141

Re: ploting issues in program

2007-08-16 Thread Peter Otten
yadin wrote: > can you please help me to fix these polar plot in db's > so that the center is at the minimun negative number in voltagedb > about [-50] > and the maximun is at zero and how can i see values on the axis like > showing that the axes start at -50 -40 -30 .and end at zero You post

Re: python socket usage

2007-08-16 Thread Paul Rubin
O¿uz YarÑmtepe <[EMAIL PROTECTED]> writes: > Is it possible to send a data object like a tuple or a list in socket > programming? If so how? It seems with socket module it is only possible to > send strings. Look into something like pyro or JSON. Whatever you do, don't use eval. -- http://mai

Re: Who told str() to round my int()'s!!!

2007-08-16 Thread baby's happy
I saw your article is very good, I like it very much. I will continue to pay attention to your article, the following are the points I hope that I have similar concerns. http://www.game-win.com http://www.game-win.com/wow-powerleveling.html http://www.game-win.com/faq.html http://www.game-win.com/p

Re: python socket usage

2007-08-16 Thread Gary Herron
markacy wrote: > On 16 Sie, 09:42, O uz Yar mtepe <[EMAIL PROTECTED]> wrote: > >> Is it possible to send a data object like a tuple or a list in socket >> programming? If so how? It seems with socket module it is only possible to >> send strings. >> >> -- >> O uz Yar mtepehttp://www.yarimtepe.co

Changing button preferences after beeing pressed

2007-08-16 Thread thomas . lidebrandt
Hello I'm using wxPython to consruct a GUI and want to change a button label and event handler to change after the button have been pressed. The only thing I can think of is a global variable that contrls the state of the program and constructs the button in accordance to the defined state. Is the

about: informtion computer...

2007-08-16 Thread angga_cute
To All Members : I have some information for you I would like you to invite to visiting my web, may be you need some information about newest information about computer, laptop, and than printer. I have little bit information on my web http://www.komputer - djogja.blogspot .com/ and http://www.n

Re: python socket usage

2007-08-16 Thread Paul Rubin
Gary Herron <[EMAIL PROTECTED]> writes: > be able to recover the original object accurately. Worse yet, an eval > of an arbitrary string is a HUGE security hole. > > If you really want to send any Python object through a socket, look up > the Pickle and cPickle modules. These are also security h

Re: python socket usage

2007-08-16 Thread Oğuz Yarımtepe
On Thursday 16 August 2007 11:20:38 Gary Herron wrote: > If you really want to send any Python object through a socket, look up > the Pickle and cPickle modules.  These will marshal (as it's called) any > Python object of any type and complexity into a byte string which can be > sent across a socke

Re: Combinatorial of elements in Python?

2007-08-16 Thread Mikael Olofsson
Sebastian Bassi wrote: > On 8/15/07, Mikael Olofsson <[EMAIL PROTECTED]> wrote: > >> What is unclear here is in what order the keys should be visited. The >> following assumes that the keys should be considered in alphanumeric order. >> > > Yes, my fault. The orden should be given by a stri

Re: Changing button preferences after beeing pressed

2007-08-16 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I'm using wxPython to consruct a GUI and want to change a button > label => wx.Button.SetLabel (also have a look at the button examples) > and event handler to change after the button have been > pressed. I'm not sure if those bindings can easily be changed at runt

clarification

2007-08-16 Thread Beema shafreen
hi every body, i have compared two files: code: fh = open('HPRD_MAIN_20.txt','r') for line in fh.readlines(): data = line.strip().split('#') fh1 = open('NOMENCLATURE_MAIN_20.txt','r') for line1 in fh1.readlines(): data1 = line1.strip().split('#')

Re: Coroutines and argument tupling

2007-08-16 Thread Bjoern Schliessmann
Marshall T. Vandegrift wrote: > Without the decorator that becomes: > > gen = nextn(2) > print gen.next() # => [0, 1] > print gen.send(3) # => [2, 3, 4] > print gen.send(1) # => [5] > > The former is just that smidgen nicer, and allows you to continue > to make use of argument de

Re: python socket usage

2007-08-16 Thread Gary Herron
Oğuz Yarımtepe wrote: > On Thursday 16 August 2007 11:20:38 Gary Herron wrote: > >> If you really want to send any Python object through a socket, look up >> the Pickle and cPickle modules. These will marshal (as it's called) any >> Python object of any type and complexity into a byte string wh

Re: Hijack! Different book: (was: Opinions about this new Python book?

2007-08-16 Thread Paul Boddie
On 15 Aug, 19:52, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > Hopefully it isn't quite as annoying as some of what I've found in > the Turbogears book that recently arrived from Amazon. (Rapid Web > Applications with TurboGears) Is this the book that came out before TurboGears even re

Re: ploting issues in program

2007-08-16 Thread Steve Holden
Peter Otten wrote: > yadin wrote: > >> can you please help me to fix these polar plot in db's >> so that the center is at the minimun negative number in voltagedb >> about [-50] >> and the maximun is at zero and how can i see values on the axis like >> showing that the axes start at -50 -40 -30 ..

Re: Coroutines and argument tupling

2007-08-16 Thread Marshall T. Vandegrift
Bjoern Schliessmann <[EMAIL PROTECTED]> writes: > The solution I'd use is a decorator that calls next automatically one > time after instantiation. Then you can use send normally, and don't > have to care about any initial parameters, which makes the code > clearer (initial parameters should be us

Re: Changing button preferences after beeing pressed

2007-08-16 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hello > > I'm using wxPython to consruct a GUI and want to change a button label > and event handler to change after the button have been pressed. The > only thing I can think of is a global variable that contrls the state > of the program and constructs the button in ac

Re: Layer 2 socket connection

2007-08-16 Thread [EMAIL PROTECTED]
On Aug 15, 7:21 pm, alisonken1 <[EMAIL PROTECTED]> wrote: > Hello all - > > I'm looking at trying to write a python script to connect to a layer 2 > bridge (no IP available). > > Looking at the sockets function, it's not clear if I can connect using > only the mac address - it appears to want eithe

ctypes and C99 complex numbers

2007-08-16 Thread Eugen Wintersberger
Hi there I want to use ctypes in connection with C functions that use complex datatypes defined in the C99 standard. Does someone know a simple way how to implement this? Are there any plans to integrate the C99 complex data types in the ctypes module? best regards Eugen Wintersberger --

Re: Hijack! Different book: (was: Opinions about this new Python book?

2007-08-16 Thread Carsten Haese
On Thu, 2007-08-16 at 04:21 -0700, Paul Boddie wrote: > [...] I pity the people writing Python books given > continuous changes to the language and the associated recommended > development practices as new features go in, but tracking a target > prior to any kind of stable release seems a bit too a

Re: "Variable variable name" or "variable lvalue"

2007-08-16 Thread mfglinux
The solution with the dictionary worked perfectlly well, my script is running and even produces data with sense!!! Thank you very much indeed to all of you answering. Cheers! -- http://mail.python.org/mailman/listinfo/python-list

Re: Coroutines and argument tupling

2007-08-16 Thread Bjoern Schliessmann
Marshall T. Vandegrift wrote: > I'd seen the consumer decorator, and it certainly is cleaner than > just using a generator. I don't like how it hides the parameter > signature in the middle of the consumer function though, and it > also doesn't provide for argument default values. Mh, that may

Localizing numbers in python

2007-08-16 Thread Heba Farouk
Hello i would like to localize numbers in python according to the current selected language of the web page (English, french, arabic, ...), is there any options in python?? thanks in advance Yours Heba - Take the Internet to Go: Yahoo!Go puts the Int

Re: Python Book Recommendations

2007-08-16 Thread 55rebels
On Aug 15, 11:47 pm, Laurent Pointal <[EMAIL PROTECTED]> wrote: > Azazello a écrit : > > > > > On Aug 15, 7:47 am, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > >> If I could have only one book, I would buy "Core Python, Second > >> Edition," by Wesley Chun. > > >> For the record, I own: > >> Core

Re: (Re)announcing APL 2007

2007-08-16 Thread glarocque
On Aug 10, 12:40 pm, [EMAIL PROTECTED] wrote: > On Aug 6, 9:20 am, Paul Mansour <[EMAIL PROTECTED]> wrote: > > > APL2007 Roll Call: Is anyone going to this? > > > I'm thinking about going, but I don't want to the only one to show up, > > as in San Diego. > > Here here. > > Sorry to mention the elep

Re: Python Book Recommendations

2007-08-16 Thread Shawn Milochik
I should add that "Dive Into Python" is also available for free online: http://www.diveintopython.org/ It's a great book. It is not a linear book -- it doesn't start you off talking about variable types and structure. It starts you right off with a piece of working code. If you already have some

How do you guys convert a tuple into a Set in ABAQUS?

2007-08-16 Thread Baisong Du
A function is defined to get a tuple. def searchObjectByRange(partObject, objectType, xRange, yRange, zRange): """In the partObject, search objects (edge, face, etc.) within the given region""" TOLERANCE_GLOBAL = 1.0E-6 INFINITE_RANGE = (-1.0E309, 1.0E309) tolerance = TOL

Re: FM synthesis using Numpy

2007-08-16 Thread Joost Molenaar
Thanks/bedankt Bas for the educative reply. I think I got misleaded by Max/MSP's tutorial[1], because MSP seems to automatically adjust the phase when you combine two oscillators in the way that I did. Joost [1] page 112 of http://www.cycling74.com/download/MSP45TutorialsAndTopics.pdf -- http://

Re: Problem using Optional pyparsing

2007-08-16 Thread Paul McGuire
On Aug 16, 2:09 am, "Nathan Harmston" <[EMAIL PROTECTED]> wrote: > Hi, > > I know this isnt the pyparsing list, but it doesnt seem like there is > one. I m trying to use pyparsing to parse a file however I cant get > the Optional keyword to work. Thanks, Peter, your comments are dead-on. Pypars

Car Air Conditioners

2007-08-16 Thread tunedstyle
All the informations about car air conditioners, how to install, repair, service all can be found on this website... http://car-air-conditioning.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

A problem with Time

2007-08-16 Thread special_dragonfly
Hello, I need to return the date yesterday in the form DDMM. I looked through the modules: time, datetime and calendar but can't find anything that leaps out at me. The problem I'm having is that although I can use time.localtime and get a tuple of the year, month, day and so forth, I don'

Re: ctypes and C99 complex numbers

2007-08-16 Thread Thomas Heller
Eugen Wintersberger schrieb: > Hi there > I want to use ctypes in connection with C functions that use complex > datatypes defined in the C99 standard. Does someone know a simple way > how to implement this? Are there any plans to integrate the C99 complex > data types in the ctypes module? I hav

Re: A problem with Time

2007-08-16 Thread Shawn Milochik
import time oneDay = 60 * 60 * 24 #seconds in one day date = time.time() yesterday = date - oneDay -- http://mail.python.org/mailman/listinfo/python-list

Re: Who told str() to round my int()'s!!!

2007-08-16 Thread John Nagle
A.T.Hofkamp wrote: > On 2007-08-15, Larry Bates <[EMAIL PROTECTED]> wrote: > >>or the mildy >>amusing "how do I write bytes not characters to a file" questions at least >>once >>a week on this forum. Actually, that's a reasonable question, and one that Python didn't do quite right. Reme

Re: A problem with Time

2007-08-16 Thread syndrowm
On 8/16/07, special_dragonfly <[EMAIL PROTECTED]> wrote: > > Hello, > > I need to return the date yesterday in the form DDMM. I looked through > the modules: time, datetime and calendar but can't find anything that > leaps > out at me. > > The problem I'm having is that although I can use time.

Re: A problem with Time

2007-08-16 Thread Diez B. Roggisch
special_dragonfly schrieb: > Hello, > > I need to return the date yesterday in the form DDMM. I looked through > the modules: time, datetime and calendar but can't find anything that leaps > out at me. > > The problem I'm having is that although I can use time.localtime and get a > tuple o

Re: A problem with Time

2007-08-16 Thread Neil Cerutti
On 2007-08-16, Shawn Milochik <[EMAIL PROTECTED]> wrote: > import time > > > oneDay = 60 * 60 * 24 #seconds in one day > > date = time.time() > > yesterday = date - oneDay Or use a timedelta. >>> import datetime >>> yesterday = datetime.datetime.today() - datetime.timedelta(days=1) >>> yesterday.

Re: Who told str() to round my int()'s!!!

2007-08-16 Thread Neil Cerutti
On 2007-08-16, John Nagle <[EMAIL PROTECTED]> wrote: >>>or the mildy amusing "how do I write bytes not characters to a >>>file" questions at least once a week on this forum. > > Actually, that's a reasonable question, and one that Python didn't do > quite right. > > Remember, in the beginni

Re: A problem with Time

2007-08-16 Thread Gary Herron
special_dragonfly wrote: > Hello, > > I need to return the date yesterday in the form DDMM. I looked through > the modules: time, datetime and calendar but can't find anything that leaps > out at me. > > The problem I'm having is that although I can use time.localtime and get a > tuple of th

Re: ploting issues in program

2007-08-16 Thread Gerard Flanagan
On Aug 16, 9:48 am, yadin <[EMAIL PROTECTED]> wrote: > hi every one! > > can you please help me to fix these polar plot in db's > so that the center is at the minimun negative number in voltagedb > about [-50] > and the maximun is at zero and how can i see values on the axis like > showing that the

Re: Who told str() to round my int()'s!!!

2007-08-16 Thread Diez B. Roggisch
John Nagle schrieb: > A.T.Hofkamp wrote: >> On 2007-08-15, Larry Bates <[EMAIL PROTECTED]> wrote: >> >>> or the mildy >>> amusing "how do I write bytes not characters to a file" questions at >>> least once >>> a week on this forum. > >Actually, that's a reasonable question, and one that Pytho

Re: threads, mutual exclusion, and lists

2007-08-16 Thread Matt McCredie
> Why do you think they are not? Because they aren't. You even mentioned that a few operations that aren't atomic. If operations are atomic it isn't necessarily because of the design of the list, but the design of CPython. More specifically the GIL. I don't mean to imply that you can't get a multi

Re: Who told str() to round my int()'s!!!

2007-08-16 Thread Chris Mellon
On 8/16/07, John Nagle <[EMAIL PROTECTED]> wrote: > A.T.Hofkamp wrote: > > On 2007-08-15, Larry Bates <[EMAIL PROTECTED]> wrote: > > > >>or the mildy > >>amusing "how do I write bytes not characters to a file" questions at least > >>once > >>a week on this forum. > > Actually, that's a reasona

Re: threads, mutual exclusion, and lists

2007-08-16 Thread Martin v. Löwis
>> Why do you think they are not? > > Because they aren't. You even mentioned that a few operations that > aren't atomic. OTOH, the OP specifically asked for .append() and .pop(), which are atomic. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Layer 2 socket connection

2007-08-16 Thread alisonken1
On Aug 16, 5:03 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I use impacket for stuff like that, > seehttp://oss.coresecurity.com/projects/impacket.html > > Cheers > > Rich. Thanks, Rich - I'll have a look -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes and C99 complex numbers

2007-08-16 Thread Martin v. Löwis
Thomas Heller schrieb: > Eugen Wintersberger schrieb: >> Hi there >> I want to use ctypes in connection with C functions that use complex >> datatypes defined in the C99 standard. Does someone know a simple way >> how to implement this? Are there any plans to integrate the C99 complex >> data type

Re: A problem with Time

2007-08-16 Thread BartlebyScrivener
On Aug 16, 10:54 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > RTFM is the answer... I don't know. I remember scratching my head for a day or two over the module explanations and instructions until I found a little howto with a lot of explicite examples. http://pleac.sourceforge.net/pleac_

Re: Module imports during object instantiation

2007-08-16 Thread Ritesh Raj Sarraf
Steve Holden wrote: > Ritesh Raj Sarraf wrote: >> On Aug 16, 12:16 am, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: >>> On Aug 15, 11:42 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: >>> > [...] >> Oops!!! Looks like I completely missed this. It _did_ print the error >> message. >> Apologies to all

Re: ploting issues in program

2007-08-16 Thread Peter Otten
Steve Holden wrote: > I might ask just exactly what is being plotted to give those answers. It > sounds like field strength, but I am having difficulty envisaging a > field that is weakest at its center - is this some sort of alternative > universe you are plotting :-) ? I believe the OP is tryin

Accessing Windows Network Share?

2007-08-16 Thread frikk
I previously posted about accessing SharePoint over the web. Well I have since given up any easy means of doing this, since something else has perked my interest. Instead of going to http://sharepoint/site, why not just access \\sharepoint\site\ directly? So my question is this - How do I access

Tuning - Styling

2007-08-16 Thread [EMAIL PROTECTED]
Cool cars, tuning & styling, modified cars, many upgrades here... http://tuning-styling.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing Windows Network Share?

2007-08-16 Thread Chris Mellon
On 8/16/07, frikk <[EMAIL PROTECTED]> wrote: > I previously posted about accessing SharePoint over the web. Well I > have since given up any easy means of doing this, since something else > has perked my interest. Instead of going to http://sharepoint/site, > why not just access \\sharepoint\site\

Re: Accessing Windows Network Share?

2007-08-16 Thread frikk
On Aug 16, 2:43 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On 8/16/07, frikk <[EMAIL PROTECTED]> wrote: > > > > > > > I previously posted about accessing SharePoint over the web. Well I > > have since given up any easy means of doing this, since something else > > has perked my interest. Inst

Re: Accessing Windows Network Share?

2007-08-16 Thread Chris Mellon
On 8/16/07, frikk <[EMAIL PROTECTED]> wrote: > On Aug 16, 2:43 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > On 8/16/07, frikk <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > I previously posted about accessing SharePoint over the web. Well I > > > have since given up any easy means of doi

Help me!!

2007-08-16 Thread Rohan
I have the following piece of code a = len(ab_file) b= 0 while(bhttp://mail.python.org/mailman/listinfo/python-list

Idea for joined() builtin

2007-08-16 Thread Rhamphoryncus
I know similar things have been argued before, but little things (like the joined name implying a copy) can make a big difference. That and I'm providing a simple implementation that works right now, so you don't have to wait for it to ever become a builtin. ;) >>> joined([], [[1,2,3], [4,5,6]])

Re: Help me!!

2007-08-16 Thread beginner
> Some one help me so that > If ab = [a,b,c,d] > and cd = [a,c] > my global list file should be [A,b,C,d] If there is a lot of entries in the list, I would consider using an indexed data structure such as dict. >>> ab=['a','b','c','d'] >>> cd=['a','c'] >>> common=[x.upper() for x in ab if x in c

Re: Help me!!

2007-08-16 Thread beginner
On Aug 16, 2:26 pm, beginner <[EMAIL PROTECTED]> wrote: > > Some one help me so that > > If ab = [a,b,c,d] > > and cd = [a,c] > > my global list file should be [A,b,C,d] If there is a lot of entries in the list, I would consider using an indexed data structure such as dict. ab=['a','b','c','d']

wxpython log redirect

2007-08-16 Thread vedrandekovic
Hello, Why this wx example don't return \nHELLO WORLD and other text in same window: import wx import logging import sys def nekaj(): print "\nHELLO WORLD" class WxLog(logging.Handler): def __init__(self, ctrl): logging.Handler.__init__(self) self.ctrl = ctrl def em

Re: (sort of) deterministic timing in Python

2007-08-16 Thread Paul Rubin
[EMAIL PROTECTED] (John Fisher) writes: > mark start time > start event > event finishes > count time until next interval > start second event… > > rather than this: > > start event > event finishes > sleep for interval > start second event > ... > So how do I accomplish this in

Re: Help me!!

2007-08-16 Thread Gerardo Herzig
Anhoter HURRA for list comprehensions: >>> a = ['a', 'b', 'c', 'd'] >>> b = ['a','c'] >>> [x in b and x.upper() or x for x in a] ['A', 'b', 'C', 'd'] Is what you want? Cheers Gerardo >I'm trying to compare the list with another list and if it is there in >both I'm changing it to upper case an

Re: A problem with Time

2007-08-16 Thread MRAB
On Aug 16, 4:30 pm, "special_dragonfly" <[EMAIL PROTECTED]> wrote: > Hello, > > I need to return the date yesterday in the form DDMM. I looked through > the modules: time, datetime and calendar but can't find anything that leaps > out at me. > > The problem I'm having is that although I can use

Re: Accessing Windows Network Share?

2007-08-16 Thread frikk
On Aug 16, 3:03 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On 8/16/07, frikk <[EMAIL PROTECTED]> wrote: > > > > > > > On Aug 16, 2:43 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > > On 8/16/07, frikk <[EMAIL PROTECTED]> wrote: > > > > > I previously posted about accessing SharePoint over t

advice about `correct' use of decorator

2007-08-16 Thread Gerardo Herzig
Hi all. I guess i have a conceptual question: Im planing using a quite simple decorator to be used as a conditional for the execution of the function. I mean something like that: @is_logued_in def change_pass(): bla bla And so on for all the other functions who needs that the user is sti

Re: sub-classing the types in the builtin module datetime

2007-08-16 Thread [EMAIL PROTECTED]
On Aug 15, 5:54 pm, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: > I posted this about 5 hours ago, but it seems to have gone astray. (snipped) > > > >> I wish to sub-class (if that's the right word) datetime and to use a > >> different signature for the constructor. > >> > >> The second

Haskell lambdas in python

2007-08-16 Thread Michael Speer
Hello python-list, I decided to have some fun and altered a copy of python to use a Haskell-like syntax for declaring lambdas. >>> filter( \ x -> x == 3 or x > 8 , [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ) [3, 9, 10] >>> ( \-> "Hello World!" )() 'Hello World!' While doing this I found somethi

Re: advice about `correct' use of decorator

2007-08-16 Thread Laszlo Nagy
Gerardo Herzig wrote: > Hi all. I guess i have a conceptual question: > Im planing using a quite simple decorator to be used as a conditional > for the execution of the function. I mean something like that: > > @is_logued_in > def change_pass(): > bla > bla > > And so on for all the other

Re: A problem with Time

2007-08-16 Thread Roger Miller
On Aug 16, 9:46 am, MRAB <[EMAIL PROTECTED]> wrote: > > As well as the other replies, this also works (as far as I can tell!): > > import time > today = time.localtime() > yesterday = today[ : 2] + (today[2] - 1, ) + today[3 : ] > yesterday = time.localtime(time.mktime(yesterday)) This is somethin

Re: Hijack! Different book:

2007-08-16 Thread Steve Holden
Dennis Lee Bieber wrote: > On Thu, 16 Aug 2007 04:21:07 -0700, Paul Boddie <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >> Is this the book that came out before TurboGears even reached 1.0, >> probably having diminished relevance now that there are 1.1 and 2.0 > >

Re: ploting issues in program

2007-08-16 Thread Steve Holden
Peter Otten wrote: > Steve Holden wrote: > >> I might ask just exactly what is being plotted to give those answers. It >> sounds like field strength, but I am having difficulty envisaging a >> field that is weakest at its center - is this some sort of alternative >> universe you are plotting :-) ?

Pass by reference or by value?

2007-08-16 Thread Robert Dailey
Hi, I previously created a topic named "Pass by reference or by value" where I inquired on how python's function parameters work. I received a lot of nice responses, however I'm still confused on the topic. Note that I come from a C++ background to Python, so any comparisons to C++ would be very h

Re: advice about `correct' use of decorator

2007-08-16 Thread Gerardo Herzig
Gerardo Herzig wrote: >> Hi all. I guess i have a conceptual question: >> Im planing using a quite simple decorator to be used as a conditional >> for the execution of the function. I mean something like that: >> >> @is_logued_in >> def change_pass(): >> bla >> bla >> >> And so on for all

Re: sub-classing the types in the builtin module datetime

2007-08-16 Thread Colin J. Williams
[EMAIL PROTECTED] wrote: > On Aug 15, 5:54 pm, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: >> I posted this about 5 hours ago, but it seems to have gone astray. > > > (snipped) > >> > >> >> I wish to sub-class (if that's the right word) datetime and to use a >> >> different signature for t

Re: Pass by reference or by value?

2007-08-16 Thread Steve Holden
Robert Dailey wrote: > Hi, > > I previously created a topic named "Pass by reference or by value" where > I inquired on how python's function parameters work. I received a lot of > nice responses, however I'm still confused on the topic. Note that I > come from a C++ background to Python, so an

Re: advice about `correct' use of decorator

2007-08-16 Thread Steven Bethard
Gerardo Herzig wrote: > Hi all. I guess i have a conceptual question: > Im planing using a quite simple decorator to be used as a conditional > for the execution of the function. I mean something like that: > > @is_logued_in > def change_pass(): >bla >bla > > And so on for all the other

Re: Pass by reference or by value?

2007-08-16 Thread Robert Dailey
So immutable objects cannot be modified directly? I guess this means integers are immutable and the act of assigning to one is a completely new definition? So if I were to create a class called Integer and give it a .set() method, this would allow me to create mutable integers, and thus passing in

Re: advice about `correct' use of decorator

2007-08-16 Thread Gerardo Herzig
Steven Bethard wrote: >Gerardo Herzig wrote: > > >>Hi all. I guess i have a conceptual question: >>Im planing using a quite simple decorator to be used as a conditional >>for the execution of the function. I mean something like that: >> >>@is_logued_in >>def change_pass(): >> bla >> bla >>

Re: Pass by reference or by value?

2007-08-16 Thread Steve Holden
Robert Dailey wrote: > So immutable objects cannot be modified directly? I guess this means > integers are immutable and the act of assigning to one is a completely > new definition? Correct. A new value is bound to the name or item on the left-hand side - remember, all variables are pointers

Canceling events from COM objects

2007-08-16 Thread Oliver Nelson
I have MapPoint working in Python, and I'm trying to cancel events on the map, but I can't seem to make that happen. I'm responding to the events successfully in my panel object. My code is like this: global MapPointMod MapPointMod = win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-

Canceling events from COM Objects

2007-08-16 Thread Oliver Nelson
I have MapPoint working in Python, and I'm trying to cancel events on the map, but I can't seem to make that happen. I'm responding to the events successfully in my panel object. My code is like this: global MapPointMod MapPointMod = win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-

Re: Pass by reference or by value?

2007-08-16 Thread Robert Dailey
Thanks Steve for your explanation. It was very helpful. I think I understand it now. By the way, by the .set method I meant: class Integer: def __init__( self, number=0 ): self._int = number def set( self, number ): self._int = number # later on mutableInt = Integer(

Canceling events from COM Objects

2007-08-16 Thread Oliver Nelson
I have MapPoint working in Python, and I'm trying to cancel events on the map, but I can't seem to make that happen. I'm responding to the events successfully in my panel object. My code is like this: global MapPointMod MapPointMod = win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-

How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread beginner
Hi All. I'd like to do the following in more succint code: if k in b: a=b[k] else: a={} b[k]=a a['A']=1 In perl it is just one line: $a=$b->{"A"} ||={}. Thanks, Geoffrey -- http://mail.python.org/mailman/listinfo/python-list

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

2007-08-16 Thread Lawrence Oluyede
beginner <[EMAIL PROTECTED]> wrote: > I'd like to do the following in more succint code: > > if k in b: > a=b[k] > else: > a={} > b[k]=a b.setdefault(k, a) -- Lawrence, oluyede.org - neropercaso.it "It is difficult to get a man to understand something when his salary depends on not

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

2007-08-16 Thread beginner
On Aug 16, 5:43 pm, [EMAIL PROTECTED] (Lawrence Oluyede) wrote: > beginner <[EMAIL PROTECTED]> wrote: > > I'd like to do the following in more succint code: > > > if k in b: > > a=b[k] > > else: > > a={} > > b[k]=a > > b.setdefault(k, a) > > -- > Lawrence, oluyede.org - neropercaso.it >

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

2007-08-16 Thread Carl Banks
On Aug 16, 6:35 pm, beginner <[EMAIL PROTECTED]> wrote: > Hi All. > > I'd like to do the following in more succint code: > > if k in b: > a=b[k] > else: > a={} > b[k]=a > > a['A']=1 > > In perl it is just one line: $a=$b->{"A"} ||={}. > > Thanks, > Geoffrey Define b as a default dict:

Re: Pass by reference or by value?

2007-08-16 Thread Thomas Jollans
On Thursday 16 August 2007, Robert Dailey wrote: > Hi, > > I previously created a topic named "Pass by reference or by value" where I > inquired on how python's function parameters work. I received a lot of nice > responses, however I'm still confused on the topic. Note that I come from a > C++ bac

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

2007-08-16 Thread James Stroud
beginner wrote: > Hi All. > > I'd like to do the following in more succint code: > > if k in b: > a=b[k] > else: > a={} > b[k]=a > > a['A']=1 > > > In perl it is just one line: $a=$b->{"A"} ||={}. I'm afraid you've asked a non sequiter: euler 40% cat test.pl $a=$b->{"A"} ||={}

Events in Com Object for Python

2007-08-16 Thread Oliver Nelson
I have MapPoint working in Python, and I'm trying to cancel events on the map, but I can't seem to make that happen. I'm responding to the events successfully in my panel object. My code is like this: global MapPointMod MapPointMod = win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-

Cancelling events on a COM Object

2007-08-16 Thread Oliver Nelson
I have MapPoint working in Python, and I'm trying to cancel events on the map, but I can't seem to make that happen. I'm responding to the events successfully in my panel object. My code is like this: global MapPointMod MapPointMod = win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-

Re: Cancelling events on a COM Object

2007-08-16 Thread James Stroud
Oliver, wait a while before you panic about your post not getting through! James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >