[issue47214] builtin_function_or_method is also either a function or a method
Ravi Jain added the comment: yes, I think `inspect.isroutine` does the required functionality. sorry, I did not know about it, and could not think of the word `routine` when checking for functions. -- ___ Python tracker <https://bugs.python.org/issue47214> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47214] builtin_function_or_method is also either a function or a method
Ravi Jain added the comment: but `callable` returns `True` for classes with `__call__` also, it does not check whether the argument passed to it is a function or not. I want some way to return `True` for both builtin functions and Python functions, but not for classes. And similarly, some way to return `True` for both builtin methods and Python methods. Should the documentation for `inspect.isfunction` include, `this does not include builtin functions.`, and similarly for `inspect.ismethod`? Should I create a PR to add these two sentences to the documentation? -- ___ Python tracker <https://bugs.python.org/issue47214> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47214] builtin_function_or_method is also either a function or a method
New submission from Ravi Jain : the. ``` import inspect inspect.isfunction ``` does not consider a ``` builtin_function_or_method ``` as a function. for example, ``` inspect.isfunction(abs) ``` gives, ``` False ``` in the background even the builtin `abs` is a function, so shouldn't it return True? the way this check is implemented is by matching the type of a builtin_function_or_method with, ``` type(len) ``` and since, `type(len)` is `builtin_function_or_method`, so, the `inspect.isfunction` check gives False. But in my opinion, it should return True, even for builtin functions or methods. -- components: Build messages: 416664 nosy: apostofes priority: normal severity: normal status: open title: builtin_function_or_method is also either a function or a method versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue47214> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42302] [Turtle] Add clockwise and anticlockwise method as alias to right and left
Change by Ravi Chityala : -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue42302> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42302] [Turtle] Add clockwise and anticlockwise method as alias to right and left
Ravi Chityala added the comment: Hello All In math and physics we typically use terms clockwise and anti-clockwise and not right and left for rotation. This change will make it easy for kids to learn the terms that they will eventually use in math and physics anyway. The change I am proposing is to alias right rotation with two more names: clockwise or cw and left rotation with two more names: anticlockwise or acw. Programmers who are currently using left or right can continue to do so. Based on the documentation supplied by Steven, I agree that everyone programming is using right and left but it might be in the right direction to program using clockwise and anticlockwise. Thanks, Ravi On Tue, Nov 10, 2020 at 2:21 AM Steven D'Aprano wrote: > > > Steven D'Aprano added the comment: > > On Tue, Nov 10, 2020 at 09:55:40AM +, Serhiy Storchaka wrote: > > > If clockwise is a new > > standard for this command in modern Turtle implementation, we can add > > yet one alias. Otherwise I agree with Raymond. > > I had a very quick look at some Logo implementations: > > https://resources.terrapinlogo.com/weblogo/commands/ > > https://www.mit.edu/~hlb/MA562/commands.html > > https://reduce-algebra.sourceforge.io/manual/manualse170.html > > https://docs.racket-lang.org/logo/index.html > > and even 3D Logo: > > https://vrmath2.net/node/12 > > and I can see no sign of any other Logos allowing clockwise and > anticlockwise as aliases. So I think it is up to Ravi Chityala to > demonstrate that this alias is already in use in some other Logo or > turtle graphics implementations. > > -- > > ___ > Python tracker > <https://bugs.python.org/issue42302> > ___ -- ___ Python tracker <https://bugs.python.org/issue42302> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42302] [Turtle] Add clockwise and anticlockwise method as alias to right and left
New submission from Ravi Chityala : The current implementation of turtle.py has right and left method for rotation. Another approach to view rotation is either clockwise or anticlockwise. These two methods can be an alias to right and left respectively. -- components: Library (Lib) messages: 380631 nosy: zenr priority: normal severity: normal status: open title: [Turtle] Add clockwise and anticlockwise method as alias to right and left type: enhancement versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue42302> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41724] SQLite returns instead of with aggregate queries.
New submission from Ravi Misra : I tested the timestamp column in SQLite with MAX/MIN queries. They return string values instead of datetime.datetime. -- components: C API messages: 376425 nosy: ravi-misra priority: normal severity: normal status: open title: SQLite returns instead of with aggregate queries. type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue41724> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41004] Hash collisions in IPv4Interface and IPv6Interface
Ravi Teja P added the comment: Hi My CLA has been approved. Can someone review the PR. -- ___ Python tracker <https://bugs.python.org/issue41004> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41004] Hash collisions in IPv4Interface and IPv6Interface
Ravi Teja P added the comment: Hi I have raised a PR for this. But my PLA is yet to be updated (I have singed it). But add the fix to the existing versions (3.8, 3.9 and 3.10), do I need to raise PR for each of those branches? -- ___ Python tracker <https://bugs.python.org/issue41004> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41004] Hash collisions in IPv4Interface and IPv6Interface
Change by Ravi Teja P : -- nosy: +rvteja92 nosy_count: 4.0 -> 5.0 pull_requests: +20204 pull_request: https://github.com/python/cpython/pull/21033 ___ Python tracker <https://bugs.python.org/issue41004> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Python Data Analysis Recommendations
On 1/1/16 1:24 PM, Mark Lawrence wrote: > On 31/12/2015 17:15, Rob Gaddi wrote: >> I'm looking for some advice on handling data collection/analysis in >> Python. ... >> The whole process feels a bit grindy; like I keep having to do a lot of >> ad-hoc stitching things together. And I keep hearing about pandas, >> PyTables, and HDF5. Would that be making my life notably easier? If >> so, does anyone have any references on it that they've found >> particularly useful? The tutorials I've seen so far seem to not give >> much detail on what the point of what they're doing is; it's all "how >> you write the code" rather than "why you write the code". Paying money >> for books is acceptable; this is all on the company's time/dime. >> >> Thanks, >> Rob Cyrille Rossant's books may meet your needs. The Interactive Computing and Visualization Cookbook offers more than just recipes. As the topics get advanced, he explains the whys in addition to the hows. It may not have specific answers to parameter sweep experiments but I understood more about Python's internals and packages as they related to my work. It helped me to refine when to use Python and when to use other languages. Currently US $5 via the publisher: https://www.packtpub.com/books/info/authors/cyrille-rossant (I have no affiliation with the author or publisher) Mark Lawrence writes: > I don't understand your comment about tutorials. Once they've given you > an introduction to the tool, isn't it your responsibility to manipulate > your data in the way that suits you? If you can't do that, either > you're doing something wrong, or the tool is inadequate for the task. > For the latter I believe you've two options, find another tool or write > your own. Without second-guessing the OP, I've found Python tutorials and documents to be helpful but not always complete in a way that beginners and casual users would need. There is usually a package that will do some job but one first has to find it. A lot of power can also be located deep within a hierarchy of dots: package.something.subsomething.subsubsomething ... Some documentation sets are very complete, others aren't. I often have the nagging feeling that if I just knew what question to ask and knew the right terminology, that I could benefit from code someone has already written and/or develop a smarter plan of attack. Ravi Narasimhan http://www.rettacs.org -- https://mail.python.org/mailman/listinfo/python-list
python program without stackless.run()
Hi, I could not understand how the below program executes function fun without calling stackless.run() in the program? Here fun runs as a tasklet and as per my knowledge for that stackless.run() is must. - import stackless class A: def __init__(self,name): self.name = name self.ch = stackless.channel() stackless.tasklet(self.fun)() def __call__(self,val): self.ch.send(val) def fun(self): while 1: v = self.ch.receive() print hi , v if __name__ == __main__: obj = A(sh) obj(6) - output: -- hi 6 thanks, ravi -- https://mail.python.org/mailman/listinfo/python-list
how to dump tasklets status in python
hi, I have a complex python program running 100 tasklets simultaneously. I want to take dump of all the running tasklets including their current status and back trace at the time of exception. Can any one let me know how can this be done ? Thanks, ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: help in understanding the stackless code
yes It has instance of both Reporter and Switch. moreover I could not get why instance reporter is passed to class Switch as a parameter ? reporter = Reporter() switch = Switch(0,reporter) switch(1) thanks On Thursday, June 18, 2015 at 5:45:08 PM UTC+5:30, MRAB wrote: On 2015-06-18 08:41, ravi wrote: hi, I am new to python and need to know why the calling of switch(1) invokes the function listen twice in the below program? import stackless class EventHandler: def __init__(self,*outputs): if outputs==None: self.outputs=[] else: self.outputs=list(outputs) self.channel = stackless.channel() stackless.tasklet(self.listen)() def listen(self): print in listen()... while 1: val = self.channel.receive() self.processMessage(val) for output in self.outputs: self.notify(output) def processMessage(self,val): pass def notify(self,output): pass def registerOutput(self,output): print in registerOutput()... self.outputs.append(output) def __call__(self,val): print in __call__ ... self.channel.send(val) class Switch(EventHandler): def __init__(self,initialState=0,*outputs): EventHandler.__init__(self,*outputs) self.state = initialState def processMessage(self,val): print in processMessage() of Switch... self.state = val def notify(self,output): print in notify() of switch... output((self,self.state)) class Reporter(EventHandler): def __init__(self,msg=%(sender)s send message %(value)s): EventHandler.__init__(self) self.msg = msg def processMessage(self,msg): print in processMessage() of Reporter... sender,value=msg print self.msg % {'sender':sender,'value':value} if __name__ == __main__: reporter = Reporter() switch = Switch(0,reporter) switch(1) output: = in __call__ ... in listen()... in listen()... in processMessage() of Switch... in notify() of switch... in __call__ ... in processMessage() of Reporter... __main__.Switch instance at 0x8d822cc send message 1 Is it because EventHandler has 2 subclasses, namely Switch and Reporter, and you have an instance of each? -- https://mail.python.org/mailman/listinfo/python-list
Re: python program without stackless.run()
On Friday, June 19, 2015 at 1:41:36 AM UTC+5:30, Ian wrote: On Thu, Jun 18, 2015 at 1:47 PM, ravi temp@gmail.com wrote: I could not understand how the below program executes function fun without calling stackless.run() in the program? Here fun runs as a tasklet and as per my knowledge for that stackless.run() is must. You seem to have a lot of questions about stackless. You might find that you get a better, more focused response if you ask your questions on the stackless mailing list: http://www.stackless.com/mailman/listinfo/stackless thanks for your pointer. I will post my queries to stackless mailing list. -- https://mail.python.org/mailman/listinfo/python-list
help in understanding the stackless code
hi, I am new to python and need to know why the calling of switch(1) invokes the function listen twice in the below program? import stackless class EventHandler: def __init__(self,*outputs): if outputs==None: self.outputs=[] else: self.outputs=list(outputs) self.channel = stackless.channel() stackless.tasklet(self.listen)() def listen(self): print in listen()... while 1: val = self.channel.receive() self.processMessage(val) for output in self.outputs: self.notify(output) def processMessage(self,val): pass def notify(self,output): pass def registerOutput(self,output): print in registerOutput()... self.outputs.append(output) def __call__(self,val): print in __call__ ... self.channel.send(val) class Switch(EventHandler): def __init__(self,initialState=0,*outputs): EventHandler.__init__(self,*outputs) self.state = initialState def processMessage(self,val): print in processMessage() of Switch... self.state = val def notify(self,output): print in notify() of switch... output((self,self.state)) class Reporter(EventHandler): def __init__(self,msg=%(sender)s send message %(value)s): EventHandler.__init__(self) self.msg = msg def processMessage(self,msg): print in processMessage() of Reporter... sender,value=msg print self.msg % {'sender':sender,'value':value} if __name__ == __main__: reporter = Reporter() switch = Switch(0,reporter) switch(1) output: = in __call__ ... in listen()... in listen()... in processMessage() of Switch... in notify() of switch... in __call__ ... in processMessage() of Reporter... __main__.Switch instance at 0x8d822cc send message 1 thanks. -- https://mail.python.org/mailman/listinfo/python-list
Concatenate string list to number list to form title - Logic needed.
Hi, I'm completely new to python. I just need simple logic to get output without any loops. I have list of string and list of list of numbers. Each string should be concatenated with every third and fourth values to generate proper titles in list of strings. t = ['Start','End'] a = [[1,2,3,4], [5,6,7,8]] Expected Result : ( list of strings ) ['Start - 3 , End - 4', 'Start - 7 , End - 8'] Note : First 2 values from each list should be ignored. Could anyone please guide me with best solution without loops ? Thanks Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: Formal-ity and the Church-Turing thesis
On Tue, Oct 8, 2013 at 1:20 PM, Steven D'Aprano st...@pearwood.info wrote: On Tue, 08 Oct 2013 10:46:50 +0530, Ravi Sahni wrote: On Tue, Oct 8, 2013 at 8:47 AM, rusi rustompm...@gmail.com wrote: I can only say how ironic it sounds to someone who is familiar with the history of our field: Turing was not a computer scientist (the term did not exist then) but a mathematician. And his major contribution was to create a form of argument so much more rigorous than what erstwhile mathematicians were used to that he was justified in calling that math as a machine. The irony is that today's generation assumes that 'some-machine' implies its something like 'Intel-machine'. To get out of this confusion ask yourself: Is it finite or infinite? If the TM were finite it would be a DFA If the Intel-machine (and like) were infinite they would need to exist in a different universe. With due respect Sir, you saying that Turing machine not a machine? Very confusion Sir!!! The mathematical ideal Turing Machine has an infinitely long tape, equivalent to infinite memory, and may take an unbounded amount of time to complete the computation. Since no *actual* physical machine can be infinitely big, and in practice there are strict limits on how long we are willing to wait for a computation to complete, in the *literal* sense, Turing Machines are not *actual* machines. They are a mathematical abstraction. But in practice, we can wave our hands and ignore this fact, and consider only not-quite-Turing Machines with finite amounts of tape, and note that they are equivalent to physical machines with finite amounts of memory. One could even build such a finite Turing Machine, although of course it would be very slow. Or one can simulate it in software. So in that sense, computers are Turing Machines. Anything a physical computing device can compute, a Turing Machine could too. The converse is not true though: a Turing Machine with infinite tape can compute things where a real physical device would run out of memory, although it might take longer than anyone is willing to wait. Thanks Sir the detailed explanation. You are offering me many thoughts inside few words so I will need some time to meditate upon the same. Presently Sir, I wish to ask single question: What you mean wave our hands?? Thanks -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: Formal-ity and the Church-Turing thesis
On Tue, Oct 8, 2013 at 11:14 AM, rusi rustompm...@gmail.com wrote: To explain at length will be too long and OT (off-topic) for this list. I'll just give you a link and you tell me what you make of it: http://sloan.stanford.edu/mousesite/Secondary/Whorfframe2.html I am trying to read link. Very new idea: Buildings can catch fire by wrong boards!! Later part difficult for me to read. (My English not powerful --please excuse.) I will make my fullest efforts to read on your recommend but I not clear the connection with computers, programming, computer science and so on. Also this Mr. Mark Lawrence question. -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: Goodbye: was JUST GOT HACKED
On Mon, Oct 7, 2013 at 5:56 PM, Walter Hurry walterhu...@lavabit.com wrote: On Thu, 03 Oct 2013 11:35:00 +, Steven D'Aprano wrote: On Thu, 03 Oct 2013 09:21:08 +0530, Ravi Sahni wrote: On Thu, Oct 3, 2013 at 2:43 AM, Walter Hurry walterhu...@lavabit.com wrote: Ding ding! Nikos is simply trolling. It's easy enough to killfile him but inconvenient to skip all the answers to his lengthy threads. If only people would just ignore him! Hello Walter Hurry please wait! Did I do/say something wrong?! Don't worry about it Ravi, you haven't done anything wrong. Walter is not a regular here. At best he is a lurker who neither asks Python questions nor answers them. In the last four months, I can see four posts from him: three are complaining about Nikos, and one is a two- line Me to! response to a post about defensive programming. If one of us should go it should be me -- Im just a newbie here. No, you are welcome here. You've posted more in just a few days than Walter has in months. We need more people like you. Steven, You make a fair point. I have posted very little recently, for the following reasons: a) I'm not really competent enough to answer python questions, at least not yet. b) I try not to post my own Python questions unless as a last resort. I prefer to try to solve my own problems by reading the fine documentation, and DuckDuckGoing. However, I do lurk assiduously and have learned much by reading excellent 'answering' posts from many such as you. The 'Goodbye' post was made in rather a fit of pique, for which I apologise. If I am allowed a second chance, there is actually something puzzling me at the moment. It's a UnicodeDecodeError, but I shall start a separate thread about it. Sorry again. Thanks! For changing decision! -- https://mail.python.org/mailman/listinfo/python-list
Re: Formal-ity and the Church-Turing thesis
On Tue, Oct 8, 2013 at 8:47 AM, rusi rustompm...@gmail.com wrote: I can only say how ironic it sounds to someone who is familiar with the history of our field: Turing was not a computer scientist (the term did not exist then) but a mathematician. And his major contribution was to create a form of argument so much more rigorous than what erstwhile mathematicians were used to that he was justified in calling that math as a machine. The irony is that today's generation assumes that 'some-machine' implies its something like 'Intel-machine'. To get out of this confusion ask yourself: Is it finite or infinite? If the TM were finite it would be a DFA If the Intel-machine (and like) were infinite they would need to exist in a different universe. With due respect Sir, you saying that Turing machine not a machine? Very confusion Sir!!! And so when you understand that TMs are just a kind of mathematical rewrite system (as is λ calculus as are context free grammars as is school arithmetic etc etc) you will not find the equivalence so surprising -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: how to read list from file
On Sun, Oct 6, 2013 at 10:11 PM, Harvey Greenberg hjgreenb...@gmail.com wrote: On Saturday, October 5, 2013 7:24:39 PM UTC-6, Tim Chase wrote: Python 2.7.3 (default, Jan 2 2013, 13:56:14) [GCC 4.7.2] on linux2 Type help, copyright, credits or license for more information. s = [{'a':1, 'b':2}, [1,2,3], 10] import ast print repr(ast.literal_eval(s)) [{'a': 1, 'b': 2}, [1, 2, 3], 10] -tkc that didn't work. printing it looks like the list because it's the input, but try printing len(repr(ast.literal_eval(s))). It should give 3, but it gives 72 (number of chars). Please to remove the repr and try again? Thank you! -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: how to read list from file
On Sun, Oct 6, 2013 at 10:27 PM, Harvey Greenberg hjgreenb...@gmail.com wrote: On Saturday, October 5, 2013 7:08:08 PM UTC-6, Harvey Greenberg wrote: I am looping as for L in file.readlines(), where file is csv. L is a list of 3 items, eg, [{'a':1, 'b':2}, [1,2,3], 10] Note that the first item is a dir and 2nd is a list, so parsing with split doesn't work. Is there a way to convert L, which is a string, to the list of 3 items I want? Yay It worked. Thanks! Which method working? Literal_eval method? JSON method? Some third method? [I am newbie so interested. Please to excuse!!] -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: howto check programs and C libraries
On Fri, Oct 4, 2013 at 3:00 PM, David Palao dpalao.pyt...@gmail.com wrote: Hello, I'm in charge of preparing a computer room for the practices of introduction to programming. One of the tasks is checking that from all the computers in the room one can execute some programs and link (and compile) against some libraries. My first idea was using Autotools (or cmake), but as I'm a big fan of python, I was thinking how to do that with python, and I don't have a clear solution yet. I know that distutils includes the distutils.command.config module, and I think it could do the job (when properly subclassed). Do you have a better idea? I have ruby on rails friends who speak of capistrano and puppet. google puppet python gives me : http://stackful-dev.com/cuisine-the-lightweight-chefpuppet-alternative If you find it good I shall be interested to know. -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: Goodbye: was JUST GOT HACKED
On Thu, Oct 3, 2013 at 5:05 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 03 Oct 2013 09:21:08 +0530, Ravi Sahni wrote: On Thu, Oct 3, 2013 at 2:43 AM, Walter Hurry walterhu...@lavabit.com wrote: Ding ding! Nikos is simply trolling. It's easy enough to killfile him but inconvenient to skip all the answers to his lengthy threads. If only people would just ignore him! Hello Walter Hurry please wait! Did I do/say something wrong?! Don't worry about it Ravi, you haven't done anything wrong. Walter is not a regular here. At best he is a lurker who neither asks Python questions nor answers them. In the last four months, I can see four posts from him: three are complaining about Nikos, and one is a two- line Me to! response to a post about defensive programming. If one of us should go it should be me -- Im just a newbie here. No, you are welcome here. You've posted more in just a few days than Walter has in months. We need more people like you. Thanks for the welcome! But No thanks for the non-welcome -- I dont figure why Walter Hurry (or anyone else) should be unwelcome just because I am welcome. The world (and the python list hopefully!!) is big enough for all of us -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: Tail recursion to while iteration in 2 easy steps
On Wed, Oct 2, 2013 at 10:46 AM, rusi wrote: 4. There is a whole spectrum of such optimizaitons -- 4a eg a single-call structural recursion example, does not need to push return address on the stack. It only needs to store the recursion depth: If zero jump to outside return add; if 0 jump to internal return address 4b An example like quicksort in which one call is a tail call can be optimized with your optimization and the other, inner one with 4a above I am interested in studying more this 'whole spectrum of optimizations' Any further pointers? Thanks -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: JUST GOT HACKED
On Wed, Oct 2, 2013 at 12:19 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Antoon Pardon antoon.par...@rece.vub.ac.be writes: Op 02-10-13 00:06, Ben Finney schreef: This is an unmoderated forum, so we have occasional spates of persistent nuisances, and those who respond with the maturity level and impulse control of an average six-year-old. […] And what about the impuls control and the maturity of people who can't stop answering [a nuisance], knowing they contribute to the nuisance to the group? Yes, we are in firm agreement here. So Ben,Antoon you are saying that Nikos is a minor problem -- spam-like -- Whereas people answering him are a bigger problem??! I find this real confused!! Why they are answering then?!?! As far as I can make out everyone who is answering (helping!) doing it frustratation and disgust. But still they keep answering and answering!! Makes no sense [Sorry -- old programmer (C,C++ etc) -- new to python. If there is some secret to this list's culture that I missed will be pleased to be educated! ] -- - Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: JUST GOT HACKED
On Wed, Oct 2, 2013 at 12:54 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Ravi Sahni ganeshsahn...@gmail.com writes: So Ben,Antoon you are saying that [demands for off-topic help with demonstrated history of unwillingness to learn] is a minor problem […] Whereas [baiting and enabling that behaviour is] a bigger problem??! (I edited the above to focus on behaviour, not people. Let's not vilify a person when what is objectionable is the behaviour.) Good... Sorry No, I'm not saying that. I'm saying that both those behaviours are significant nuisances, both are against our community guidelines of mutual respect, and both should stop. Comparing the magnitude of those problems to see which is worse isn't of interest to me, they're both objectionable to the point of noise and disruption. I'd like them both to stop, in the interest of keeping this forum functional for its intended purposes. Thanks Ben for clarification and understanding -- - Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: JUST GOT HACKED
On Wed, Oct 2, 2013 at 1:21 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Op 02-10-13 09:02, Ravi Sahni schreef: On Wed, Oct 2, 2013 at 12:19 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Antoon Pardon antoon.par...@rece.vub.ac.be writes: Op 02-10-13 00:06, Ben Finney schreef: This is an unmoderated forum, so we have occasional spates of persistent nuisances, and those who respond with the maturity level and impulse control of an average six-year-old. […] And what about the impuls control and the maturity of people who can't stop answering [a nuisance], knowing they contribute to the nuisance to the group? Yes, we are in firm agreement here. So Ben,Antoon you are saying that Nikos is a minor problem -- spam-like -- Whereas people answering him are a bigger problem??! I find this real confused!! Why they are answering then?!?! As far as I can make out everyone who is answering (helping!) doing it frustratation and disgust. But still they keep answering and answering!! You should understand that what is a bigger problem and what is a minor problem is a personal, subjective judgement and people come to different conclusions. So group1 finds Nikos a minor nuisance and is willing to answer him. Probably because it gives them warm fuzzy feelings knowing they tried to help someone or because they found the problem interresting to solve. Now group2 may find Nikos himself not that big a nuisance but they certainly find Nikos in combination with group1 a major nuisance. Because it keeps the cycle going and even if they kill file Nikos, they keep being confronted with his contributions through the responses of group1. So frustration builds for those in group2, until it reaches a level that some of them feel the need to vent that frustration. That can sometimes be rather ugly to observe and I am sure that some venters weren't that happy with their own reaction afterwards, but I think it is an understandable, human reaction. Now for a number of people in group1, the venting of group2 is a major nuisance and they start venting their own frustration with that. Unfortunately, their own need for venting doesn't create any empathy for the need of group2 for venting. They only see groups2 as the cause for their own frustration with very little willingness to see their own contribution to the original built up. Thanks Antoon for explaining so clearly and taking trouble to explain. As said above, Im newbie to python and to this group, (done C, C++ before) and was too confused by the BS to ask/speak. Daniel's post gave me courage to ask. Hope to get back to python now! -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: Lowest Value in List
On Wed, Oct 2, 2013 at 3:34 PM, subhabangal...@gmail.com wrote: Dear Group, I am trying to work out a solution to the following problem in Python. The Problem: Suppose I have three lists. Each list is having 10 elements in ascending order. I have to construct one list having 10 elements which are of the lowest value among these 30 elements present in the three given lists. The Solution: I tried to address the issue in the following ways: a) I took three lists, like, list1=[1,2,3,4,5,6,7,8,9,10] list2=[0,1,2,3,4,5,6,7,8,9] list3=[-5,-4,-3,-2,-1,0,1,2,3,4] I tried to make sum and convert them as set to drop the repeating elements: set_sum=set(list1+list2+list3) set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -5, -4, -3, -2]) In the next step I tried to convert it back to list as, list_set=list(set_sum) gave the value as, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -5, -4, -3, -2] Now, I imported heapq as, import heapq and took the result as, result=heapq.nsmallest(10,list_set) it gave as, [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4] b) I am thinking to work out another approach. I am taking the lists again as, list1=[1,2,3,4,5,6,7,8,9,10] list2=[0,1,2,3,4,5,6,7,8,9] list3=[-5,-4,-3,-2,-1,0,1,2,3,4] as they are in ascending order, I am trying to take first four/five elements of each list,like, list1_4=list1[:4] list2_4=list2[:4] list3_4=list3[:4] Now, I am trying to add them as, list11=list1_4+list2_4+list3_4 thus, giving us the result [1, 2, 3, 4, 0, 1, 2, 3, -5, -4, -3, -2] Now, we are trying to sort the list of the set of the sum as, sort_sum=sorted(list(set(list11))) giving us the required result as, [-5, -4, -3, -2, 0, 1, 2, 3, 4] If by taking the value of each list portion as 4 gives as less number of elements in final value, as we are making set to avoid repeating numbers, we increase element count by one or two and if final result becomes more than 10 we take first ten. Are these approaches fine. Or should we think some other way. If any learned member of the group can kindly let me know how to solve I would be helpful enough. Thanking in Advance, Subhabrata. -- https://mail.python.org/mailman/listinfo/python-list [Disclaimer: Beginner myself] The heapq module has merge Since the lists are already sorted what's wrong with just this? list(merge(list1, list2, list3))[:10] -- - Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: Can arbitrary code run in a server if someone's know just the MySQL password?
On Wed, Oct 2, 2013 at 8:04 PM, Alister alister.w...@ntlworld.com wrote: On Wed, 02 Oct 2013 16:41:40 +0300, Νίκος wrote: Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε: On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote: Is it possible for someone that knows the MYSQL password of a server to run arbitrary code on a linux server? Yes, it is possible. Is that what might have happened and someone managed to upload the .html file in '~/home/nikos/www/' ? Can you think of any other way? There are many other ways (i am not a hacker so i would not know whre to start) Against my better judgement I am going to give some advise (more to protect your customers than you) 1) tie down access to your server, nothing should be accessable from the internet unless absolutly necessary. certainly your database should not be accessible and this should be blocked in multiple ways (protection in depth) you should close down any un-necessary services. shut your firewall to all trafffix except http https (ports 80 ,443) unless absolutely necessary. set your database accounts to only allow log in from localhost and any explicit IP addresses that must have access please google for further advise on server security post questions in a suitable forum (not here) as many have said, security is not our area of expertise this is the wrong place to ask. when correctly secured knowing your username password should not be enough to allow access to your server. Thank you Alister for ansering the needs of needy persons. I am also needy. Please be kind to me as well: There is poverty and injustice in the world. Why?? I NEED to know People suffer and die. How come? I MUST know And there are morons... Why?? PLEASE TELL -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: JUST GOT HACKED
On Wed, Oct 2, 2013 at 10:14 PM, ru...@yahoo.com wrote: On 10/02/2013 01:02 AM, Ravi Sahni wrote: On Wed, Oct 2, 2013 at 12:19 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Antoon Pardon antoon.par...@rece.vub.ac.be writes: Op 02-10-13 00:06, Ben Finney schreef: This is an unmoderated forum, so we have occasional spates of persistent nuisances, and those who respond with the maturity level and impulse control of an average six-year-old. […] And what about the impuls control and the maturity of people who can't stop answering [a nuisance], knowing they contribute to the nuisance to the group? Yes, we are in firm agreement here. So Ben,Antoon you are saying that Nikos is a minor problem -- spam-like -- Whereas people answering him are a bigger problem??! I find this real confused!! Why they are answering then?!?! As far as I can make out everyone who is answering (helping!) doing it frustratation and disgust. But still they keep answering and answering!! Makes no sense [Sorry -- old programmer (C,C++ etc) -- new to python. If there is some secret to this list's culture that I missed will be pleased to be educated!] Actually it does make sense when one thinks of the psychology. It is fun to bash other people on the internet. There are few consequences and it makes up for the lack of authority and control we experience in our real daily lives. When someone like Nikos appears and irritates enough people to exceed a critical mass, it becomes socially ok to bash him and one gets a _Lord of the Flies_ [*1] effect. Further it is nothing new -- this kind of spiral down into chaos and noise of an unmoderated online community has been happening since the earliest days of the internet. For decades a useful way to combat this has been summarized in the phase don't feed the trolls. But that only works when people are able sacrifice their own fun (giving up the joy of joining in publicly bashing a scapegoat by simply not responding to inflammatory posts) for a common good (a mailing list with a good signal-to-noise ratio and non-hostile atmosphere.) It would seem that enough Python regulars here get enjoyment from the current state of affairs that the situation is likely to last indefinitely. The rest of us try to make do by using restraint, filtering and alternate forums (Stackoverflow, etc). [*1] http://www.cliffsnotes.com/literature/l/lord-of-the-flies/lord-of-the-flies-at-a-glance That (link) is an ugly stupid view of humanness. Why should I want to piss on you and flame you and shoot you for fun? I have never met anyone like that and dont believe that anyone is like that. [We are told about Hitler and Stalin and so on. I have never met them :-) ] And if you believe everyone is like that -- sorry - please go to psychatrist -- serious! Basically I am a software engineer. A engineer believes in right design. Mess happens with wrong design. Something is making ppl behave crazy. What is it? If we are engineers we should do analysis. No I dont think it is Nikos. I think it is ppl answering nonsense questions and shouting and keep on answering nonsense with more nonsense and keep on shouting. Why this crazy behavior?? So far Anton has given me the best explanaton -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: Goodbye: was JUST GOT HACKED
On Thu, Oct 3, 2013 at 2:43 AM, Walter Hurry walterhu...@lavabit.com wrote: Ding ding! Nikos is simply trolling. It's easy enough to killfile him but inconvenient to skip all the answers to his lengthy threads. If only people would just ignore him! Hello Walter Hurry please wait! Did I do/say something wrong?! If one of us should go it should be me -- Im just a newbie here. I have little time/efforts invested in python anyway. I was for a long time wasting time choosing upgrading myself from C/C++ to python or javascript. javascript -- universal and unavoidable in today's web world, but a mess python -- looks cleaner and well-designed (and not for heavyweight phds like FP languages like haskell ) So I finally went with python Now given the mess out here I need to rethink anyway! -- Ravi -- https://mail.python.org/mailman/listinfo/python-list
Re: JUST GOT HACKED
On Tuesday, October 1, 2013 7:54:35 PM UTC+5:30, Daniel Stojanov wrote: 2) I just signed up the this mailing list. To the regulars, is this what normally happens on this list? 3) I'm a bit late to the party. Is Nikos a real sysadmin or is this some horrible inside joke I don't get? Thanks Daniel!!! Lurker here: I too was wondering whether I have got into the wrong place -- https://mail.python.org/mailman/listinfo/python-list
[issue16154] Some minor doc fixes in Doc/library
Changes by Ravi Sinha rss1...@gmail.com: Added file: http://bugs.python.org/file27649/27.doc_lib_Oct21_2012.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16154 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16154] Some minor doc fixes in Doc/library
Changes by Ravi Sinha rss1...@gmail.com: Added file: http://bugs.python.org/file27650/32.doc_lib_Oct21_2012.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16154 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16154] Some minor doc fixes in Doc/library
Changes by Ravi Sinha rss1...@gmail.com: Added file: http://bugs.python.org/file27651/33.doc_lib_Oct21_2012.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16154 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16154] Some minor doc fixes in Doc/library
Ravi Sinha added the comment: Based on what I saw on some other issues, I think there is just a separate patch for each version (coming from separate working repositories), but all attached to the same issue. So I am doing the same. All the changes have been made to files under Doc/library/ - colorsys.rst, filecmp.rst, fractions.rst, math.rst, string.rst and Misc/ACKS. The beginning number for each patch and the description show which version it's meant for. There are some minor differences for 2.7 and 3.2; they either did not need a fix or needed some more tests to be skipped. For 2.7 and 3.2 I don't know how to use the online source browser to link the files directly. Please let me know if the patches are okay or how to go from here. Thanks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16154 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16155] Some minor doc fixes in Doc/faq
Ravi Sinha added the comment: Did the same changes for versions 2.7, 3.2, 3.3, and 3.4 For line wrap in cases like http://hg.python.org/cpython/file/40a1652349e9/Doc/faq/general.rst, line 448, broke the list across separate lines, and had to use +NORMALIZE_WHITESPACE to make the tests pass. For the same file, in line 454, versions 2.7 and 3.2 don't have '- None' while versions 3.3 and 3.4 do. So made the changes accordingly. Adding 'BLANKLINE' around the contents of the help is making the tests pass too. I am assuming that BLANKLINE means the new pager that I get on OS X. This was the case uniformly across all 4 versions. Attaching all 4 patches, for different versions. Please let me know where to go from here. -- Added file: http://bugs.python.org/file27652/27.doc_faq_Oct21_2012.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16155 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16155] Some minor doc fixes in Doc/faq
Changes by Ravi Sinha rss1...@gmail.com: Added file: http://bugs.python.org/file27653/32.doc_faq_Oct21_2012.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16155 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16155] Some minor doc fixes in Doc/faq
Changes by Ravi Sinha rss1...@gmail.com: Added file: http://bugs.python.org/file27654/33.doc_faq_Oct21_2012.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16155 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16155] Some minor doc fixes in Doc/faq
Changes by Ravi Sinha rss1...@gmail.com: Added file: http://bugs.python.org/file27655/34.doc_faq_Oct21_2012.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16155 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16154] Some minor doc fixes in Doc/library
Ravi Sinha added the comment: I've used the testsetup directive and the problem in http://hg.python.org/cpython/file/40a1652349e9/Doc/library/math.rst, line 79, is fixed; the test passes Added # doctest: +SKIP to lines 179 and 180 in http://hg.python.org/cpython/file/40a1652349e9/Doc/library/filecmp.rst, and it passes too For http://hg.python.org/cpython/file/40a1652349e9/Doc/library/string.rst, lines 612-624, used +NORMALIZE_WHITESPACE and the test passed, but since Terry preferred a code change, did that too; the test passes Put my name at the proper position in Misc/ACKS For the multiple versions, I needed to ask whether they'd all belong to this same patch or there would be different patches for each version? Sorry if it's a silly question; I haven't had the time to wrap my head around how to best work with all the versions together With the directives Chris and Terry suggested, it should be easy to make several other tests pass; I'll make a few more patches -- Added file: http://bugs.python.org/file27574/doc_lib_Oct14_2012.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16154 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16154] Some minor doc fixes in Doc/library
New submission from Ravi Sinha: - Doc/library/math.rst - fsum will pass if 'from math import fsum' is done before it, but I've left such issues for now since there seems to be a debate about how to go about that - some seem unfixable too - e.g. Doc/library/filecmp.rst - 'dir1' and 'dir2' do not exist, and so the print_diff_files() fails, but there seems to be no reason to fix this; the same for Doc/library/imghdr.rst - there is no /tmp/bass.gif, so it fails - some fail for inexplicable reasons - Doc/library/string.rst - the table of numbers does not match, though it is exactly the same. No idea why. -- assignee: docs@python components: Documentation files: doc_lib.patch keywords: patch messages: 172253 nosy: Ravi.Sinha, chris.jerdonek, docs@python, r.david.murray, terry.reedy priority: normal severity: normal status: open title: Some minor doc fixes in Doc/library type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file27462/doc_lib.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16154 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16155] Some minor doc fixes in Doc/faq
New submission from Ravi Sinha: - help(fn) which in the REPL leads to a new pager/ display - seems to be difficult to test with doctest - it does not seem to pick the whitespace in the docs and does not match - Doc/faq/general.rst - os.path.isdir returns True or False, not 0 or 1 as in the docs, but I didn't know if I should change that - Doc/faq/windows.rst -- assignee: docs@python components: Documentation files: doc_faq.patch keywords: patch messages: 172254 nosy: Ravi.Sinha, chris.jerdonek, docs@python, r.david.murray, terry.reedy priority: normal severity: normal status: open title: Some minor doc fixes in Doc/faq type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file27463/doc_faq.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16155 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
***************************Hai***************************
http://www.workfrominter.com/ http://www.workfrominter.com/ http://girlsdailysex.blogspot.com/ http://girlsdailysex.blogspot.com/ Just See What Is this Website Are Msg For You -- http://mail.python.org/mailman/listinfo/python-list
Re: Extending dict (dict's) to allow for multidimensional dictionary
That's a very nice suggestion. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Cluto like library for Python
I like Cluto as a data clustering software a lot. But its library binding is available only in C. Is there any python library which is similar to Cluto? -- http://mail.python.org/mailman/listinfo/python-list
Extending dict (dict's) to allow for multidimensional dictionary
I can extend dictionary to allow for the my own special look-up tables. However now I want to be able to define multidimensional dictionary which supports look-up like this: d[1]['abc'][40] = 'dummy' and if d[1] and d[1][abc] raise KeyError just create them. for d[1] I can override __getitem__() but how to do the same for the d[1][abc]? -- http://mail.python.org/mailman/listinfo/python-list
Re: Extending dict (dict's) to allow for multidimensional dictionary
I found a solution here: http://parand.com/say/index.php/2007/07/13/simple-multi-dimensional-dictionaries-in-python/ Please tell how good is it? -- http://mail.python.org/mailman/listinfo/python-list
Earn $2 Per Click For Free Join Make Money
www.workfrominter.com -- http://mail.python.org/mailman/listinfo/python-list
sqlite3 doesn't raise exception if database is not present/inaccessible
try this: import sqlite3 con = sqlite3.connect(any string here) and there is no error reported. You will get an error you do some operations on the database which is confusing. I think sqlite3 should change this behavior. -- http://mail.python.org/mailman/listinfo/python-list
Re: sqlite3 doesn't raise exception if database is not present/inaccessible
I understand it now. Thanks for the responses. -- http://mail.python.org/mailman/listinfo/python-list
Re: Popen Question
On Nov 4, 7:06 pm, moogyd moo...@yahoo.co.uk wrote: Hi, I usually use csh for my simulation control scripts, but these scripts are becoming more complex, so I plan to use python for the next project. To this end, I am looking at subprocess.Popen() to actually call the simulations, and have a very basic question which is demonstrated below. [sde:st...@lbux03 ~]$ python Python 2.6 (r26:66714, Feb 21 2009, 02:16:04) [GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2 Type help, copyright, credits or license for more information. import os, subprocess os.environ['MYVAR'] = myval p = subprocess.Popen(['echo', '$MYVAR'],shell=True) p = subprocess.Popen(['echo', '$MYVAR']) $MYVAR p = subprocess.Popen('echo $MYVAR',shell=True) myval p = subprocess.Popen('echo $MYVAR') Traceback (most recent call last): File stdin, line 1, in module File /usr/lib64/python2.6/subprocess.py, line 595, in __init__ errread, errwrite) File /usr/lib64/python2.6/subprocess.py, line 1106, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory I am not really sure I understand these results. 1) No idea what is going on 2) As (1). What isn't myval printed out (rather than $MYVAR) 3) Works as I wanted it to 4) Why do I need shell=True ? The documentation isn't very clear to me (it seems you need to understand the underlying system calls). Can anyone explain (or provide link) for this behaviour in simple English? Thanks, Steven try giving /bin/echo -- http://mail.python.org/mailman/listinfo/python-list
SQLite is quite SQL compliant
The documentation of the sqlite module at http://docs.python.org/library/sqlite3.html says: ...allows accessing the database using a nonstandard variant of the SQL... But if you see SQLite website they clearly say at http://sqlite.org/omitted.html that only very few of the SQL is not implemented. I think docs should clarify on that. Many users might be scared of using SQLite just because of this. -- http://mail.python.org/mailman/listinfo/python-list
Re: EURO GIRLS MISS EUROPE MISS FRENCH FRENCH PRETTY GIRLS SEXY FRENCH GIRLS on www.sexyandpretty-girls.blogspot.com SEXY RUSSIAN GIRLS SEXY GREEK GIRLS SEXY DUTCH GIRLS SEXY UK G
On Sat, Mar 20, 2010 at 7:27 PM, Brian J Mingus brian.min...@colorado.eduwrote: Moderating this stuff requires moderating all messages. It would take a team of volunteers. You are right... Form the team of volunteers. More people in it, better it would be - since no one would have to be dedicated. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
GUI app on Windows for WMI digging
Hi, I am working on an application, which retrieves Windows system info (Hardware / Software / Drivers / OS) and write to an xml. For the GUI, I selected PyQT4, and for system info using WMI, I am using WMI Package (http://timgolden.me.uk/python/wmi/index.html) and popular pywin32. To package the binary, I am considering py2exe. I need to package these in binary package (though single binary output was preferred, but could not find any examples online to achieve this). Also, I took PyQT4, but I can switch to PyGTK if it is possible to get it in single DLL/libs. Overall, I need suggestions on: - which XML library is better/lightweight on Windows?I think pure python based xml processing libs would work (so lxml is out of option). - Can I get these in single binary (not installer), or if not, then how can I get in minimum files. Py2exe results many files. - Is QT4 better or GTK? No war/flaming over this, since least widgets are needed, which are available on both. Since the GUI is just 3-4 screens/dialogs with minimum widgets, so speed does not matter. The only thing that matter is least files/libs (no seperate installation, file can provided with binary package). -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Re: how to generate random numbers that satisfy certain distribution
On Jan 23, 10:37 pm, thinke365 thinke...@gmail.com wrote: such as uniform distribution, Normal distribution or poisson distribution. is there any package that can be used to generate such random numbers. -- View this message in context:http://old.nabble.com/how-to-generate-random-numbers-that-satisfy-cer... Sent from the Python - python-list mailing list archive at Nabble.com. Did you try random package? -- http://mail.python.org/mailman/listinfo/python-list
Re: Imports in python are static, any solution?
On Apr 14, 1:23 am, norseman norse...@hughes.net wrote: AJ Mayorga wrote: For something like this I generally create a superclass to hold configuration variables that will change overtime, doing that will save you from insanity. Class configVar: #set initial values Def __init__(self): Self.A = 5 Self.B = 10 Self.C = 20 Class myMath(configVars): def __init__(self): pass def SubAandB(self): return self.A - self.B def AddCandB(self): return self.C + self.B def MultiplyXbyA(self, x): return self.A * x m = myMath() X = m.SubAandB() Y = m.AddCandB() Z = m.MultiplyXbyA(32) Keeps your vars in a safer easier to handle, debug, and change kinda way Good luck AJ -Original Message- From: python-list-bounces+aj=xernova@python.org [mailto:python-list-bounces+aj=xernova@python.org] On Behalf Of David Stanek Sent: Monday, April 13, 2009 12:12 PM To: Ravi Cc: python-l...@python.org Subject: Re: Imports in python are static, any solution? On Mon, Apr 13, 2009 at 11:59 AM, Ravi ra.ravi@gmail.com wrote: foo.py : i = 10 def fi(): global i i = 99 bar.py : import foo from foo import i print i, foo.i foo.fi() print i, foo.i This is problematic. Well I want i to change with foo.fi() . Why not only import foo and using foo.i? In fi() when you set i = 99 you are creating a new object called i in foo's namespace. === Aj is right. In foo.py there are two definitions for 'i'. The initial and the replacement initiated by fi(). While initially there is no 'i' definition in bar itself. To test, use my changes to bar.py import foo #from foo import i i= foo.i print i, foo.i x= foo.fi() print i, x, foo.i x= foo.i print i, x, foo.i the output will be: 10 10 10 None 99 10 99 99 output is same if you uncomment #from... and comment i=... The '...import i' creates the same var as the i=... in the current run If you comment out both the from and the i= then the print i will fail because i has not been defined in current space. foo.fi() returns None (nothing) per it's definition. whereas the first foo.i returns the initial i value and the foo.i after foo.fi() returns the 2nd value, foo's i reset to 99 by fi() inside foo. Clear as Mud??? Steve Yes I find the difference. Thank you all. -- http://mail.python.org/mailman/listinfo/python-list
Choose: class with static methods or module with functions
I have to create a few helper/utility application-wide functions. There are two options: 1. Create a Utility class and all functions as static method of that class. 2. Create a module, utility.py and member functions. Which is a better approach. My personal view is that I should create a module with functions. Classes are appropriate only when I am creating new types. -- http://mail.python.org/mailman/listinfo/python-list
Imports in python are static, any solution?
foo.py : i = 10 def fi(): global i i = 99 bar.py : import foo from foo import i print i, foo.i foo.fi() print i, foo.i This is problematic. Well I want i to change with foo.fi() . -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythoner,Wish me luck!
Hi, I'm also begginer in python; i did few basic programs about graph etc.. my question is : what benefit is using interactive intrepreter ? the IDLE interractive python IDE is best comparing to any other most advanced IDE available in world. Really, if you are learning the python at any level, go for IDLE. What you do, you write every step of statements and that is executed as soon as you finish the block. So you have chance to understand the things step by step. Just like learning by debugging.. Try it self, no one's review can satisfy you. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Plugin based feature adding to web-application
I need an architecture in a project using Django and Python + MySQL, so that when I put a python script in specified directory, that should be loaded and its methods/functions can be used. As far as i have thought on this, I am going to scan that particular directory, list out the files, import them if they exists, NOw I need the functions list defined in that module. Is there any way to get it. I also need to find which class in defined in that python file. Please suggest me over architectures and best practices. Any suggestion would be really helpful. Thanks Rav! -- http://mail.python.org/mailman/listinfo/python-list
Make a python property with the same name as the class member name
Is it possible in python to create a property with the same name as the member variable name of the class. e.g. Class X: ... self.i = 10 # marker ... property(fget = get_i, fset = set_i) Please tell me how I can do so. Because if I do so, for the statement at marker I get stack overflow for the assingm -- http://mail.python.org/mailman/listinfo/python-list
Re: Forwarding keyword arguments from one function to another
Thnak you all. In the future, explain didn't work. Wrong output? give actual (copy and paste) and expected. Error message? give traceback (copy and paste). I will be careful. -- http://mail.python.org/mailman/listinfo/python-list
Forwarding keyword arguments from one function to another
The following code didn't work: class X(object): def f(self, **kwds): print kwds try: print kwds['i'] * 2 except KeyError: print unknown keyword argument self.g(string, **kwds) def g(self, s, kwds): print s print kwds if __name__ == __main__: x = X() x.f(k = 2, j = 10) However the following did: class X(object): def f(self, **kwds): print kwds try: print kwds['i'] * 2 except KeyError: print unknown keyword argument self.g(string, **kwds) def g(self, s, **kwds): print s print kwds if __name__ == __main__: x = X() x.f(k = 2, j = 10) Please explain -- http://mail.python.org/mailman/listinfo/python-list
Re: Forwarding keyword arguments from one function to another
I am sorry about the typo mistake, well the code snippets are as: # Non Working: class X(object): def f(self, **kwds): print kwds try: print kwds['i'] * 2 except KeyError: print unknown keyword argument self.g(string, kwds) def g(self, s, **kwds): print s print kwds if __name__ == __main__: x = X() x.f(k = 2, j = 10) # Working One class X(object): def f(self, **kwds): print kwds try: print kwds['i'] * 2 except KeyError: print unknown keyword argument self.g(string, **kwds) def g(self, s, **kwds): print s print kwds if __name__ == __main__: x = X() x.f(k = 2, j = 10) -- http://mail.python.org/mailman/listinfo/python-list
Re: Byte oriented data types in python
Take a look at the struct and ctypes modules. struct is really not the choice. it returns an expanded string of the data and this means larger latency over bluetooth. ctypes is basically for the interface with libraries written in C (this I read from the python docs) -- http://mail.python.org/mailman/listinfo/python-list
Re: Byte oriented data types in python
On Jan 25, 12:52 am, Martin v. Löwis mar...@v.loewis.de wrote: packet_type (1 byte unsigned) || packet_length (1 byte unsigned) || packet_data(variable) How to construct these using python data types, as int and float have no limits and their sizes are not well defined. In Python 2.x, use the regular string type: chr(n) will create a single byte, and the + operator will do the concatenation. In Python 3.x, use the bytes type (bytes() instead of chr()). This looks really helpful thanks! -- http://mail.python.org/mailman/listinfo/python-list
Byte oriented data types in python
I have following packet format which I have to send over Bluetooth. packet_type (1 byte unsigned) || packet_length (1 byte unsigned) || packet_data(variable) How to construct these using python data types, as int and float have no limits and their sizes are not well defined. -- http://mail.python.org/mailman/listinfo/python-list
Re: Difference between Python 2.2.2 and Python 2.5
On Jan 18, 8:44 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Sun, 18 Jan 2009 07:30:52 -0800, Ravi wrote: I am developing for PyS60 1.4.4 which supports Python 2.2.2 while what I know is Python 2.5 . Can you please tell me differences between the two so that I can save myself from incompatible code. Everything new mentioned here: http://www.python.org/doc/2.5/whatsnew/whatsnew25.htmlhttp://www.python.org/doc/2.4/whatsnew/whatsnew24.htmlhttp://www.python.org/doc/2.3/whatsnew/whatsnew23.html won't exist in Python 2.2. -- Steven This is a list too big! Is there any checker which can be applied to the Python code. (of course any solution other than running python 2.2 over the code) -- http://mail.python.org/mailman/listinfo/python-list
Difference between Python 2.2.2 and Python 2.5
I am developing for PyS60 1.4.4 which supports Python 2.2.2 while what I know is Python 2.5 . Can you please tell me differences between the two so that I can save myself from incompatible code. -- http://mail.python.org/mailman/listinfo/python-list
MRO inconsistency: why?
Why the following code gives inconsistent method resolution order error: class X(object): x = 4 def f(self): print 'f in X' print dir(X) X.g(self) def g(self): print 'g in X' class Y(object, X): def g(self): print 'g in Y' o = Y() o.f() While this code doesn't: class X(object): x = 4 def f(self): print 'f in X' print dir(X) X.g(self) def g(self): print 'g in X' class Y(X, object): def g(self): print 'g in Y' o = Y() o.f() -- http://mail.python.org/mailman/listinfo/python-list
Getting the name of a variable which was used as a function parameter.
Hi guys, I thought this was pretty cool and since I spent 30 mins or so goggling before giving up and figuring out myself I thought I'd share it with you. def a(a): ... for k,v in sys._getframe(1).f_locals.items(): ... if id(v) == id(a): ... print k ... hello = 123 a(hello) hello ## pretty cool. It's totally useless but I wanted to do it for logging purposes. It will still return weird results if you have two labels pointing to the same object but I'm not sure how to get around that, any ideas? Regards, Ravi Kotecha -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting the name of a variable which was used as a function parameter.
Of course I wouldn't, it is a total hack, mostly useless but fun. I tried to do it after someone in #python efnet said it was impossible! On Jul 21, 9:56 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Mon, 21 Jul 2008 09:01:10 -0700, Ravi Kotecha wrote: I thought this was pretty cool and since I spent 30 mins or so goggling before giving up and figuring out myself I thought I'd share it with you. def a(a): ... for k,v in sys._getframe(1).f_locals.items(): ... if id(v) == id(a): ... print k ... hello = 123 a(hello) hello ## pretty cool. Or ugly hack. Beauty lies in the eye of the beer holder… It's totally useless but I wanted to do it for logging purposes. Don't use such things in production code, please. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for Advanced Python Tutorials
On Apr 4, 12:58 pm, [EMAIL PROTECTED] wrote: I was wondering if anyone knew of some online (free if possible) advanced tutorials, especially ones that provides tasks and ideas for small projects. The issue for myself is I want to improve my python programming level, and my ability to program in general, but come up blank thinking of a possible task or project to undertake. So with that in mind I thought I'd ask the community if they knew of sites or books to read up on and use as a starting block. Of course project ideas would be great as well! Thanks for any help you can provide. Coko Project Euler is a site where you work through mathematical problems using any programming language you like. Once you solve a problem you can see everyone elses solutions and Python is quite popular on that site so you'll see some very clever uses of Python there. I like it a lot for when I haven't got anything better to code: http://projecteuler.net/ - Ravi -- http://mail.python.org/mailman/listinfo/python-list
libgmail through proxy
HI, I was trying to use libgmail. I used that successfully, fetched mail to some extend (thought after some mails, it threw exceptions on NonIterable Int). But when I used the same package from my office where I have to use the proxy, it failed. I used idle, then I also set os.ENVIRON['http_proxy'] to the same settings which I use, but I could not succeed. The login() method reports error about no addreess associated with it. Please help me solve it. I used the proxy settings, but it didnt work. so any workaround, and what sort of thing I am missing. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Weight Problem
An Interesting problem, A man has only 4 bricks of different weights, lies between 1-40KG, Also, the total weights of Brick A, B, C, D (ie A+B+C+D) is 40KG. The man uses that brick to calculate every possible weight from 1 KG to 40 KG in his shop. (only whole numbers 1KG, 2KG etc, not like 2.3KG) I thought it would really be good to solve it by python, and right now on the mid-way solving using very dirty approach. But I feel, using SETs with python in such would solve it better. Can anyone come with good solution, and maybe solution showing usage of Sets. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
CVS access with Python
I have to design a Web-based CVS client. I could not find any module, cvs-binding in python. I have investigated all sort of Web Interface, including Sandweb, and ViewCVS etc. But these provide Read-only access and features. I need to provide almost all sort of basic features a developer frequently need in it. So please guide me. I found javacvs project in Netbeans project repository which seems a nice library, but since I am not a java programmer, this fails to me. Other problem is its implementation. Say, there is a repository of some projects with many modules. Now, when one developer wants to checkout, I can get the revision Sources to Web-server temporary sandbox, and create an archive (tar.gz/zip) and put that for downloading by the user. Since there is many-to-many relation between projects and developers, it will consume a lot of disk space on Web-server, creating 'n' copies of a single project for 'n' users, and assume all developers are checking out all sources. God knows. So is there any good implementation for such situation. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
how to protect directory traversal in mod_python based custom apps
hi :) I was trying to develop a custom mod_python based web-site, just today. the problem I got though i liked the mod_python's feature of mapping and calling functions in python script by parsing the url. I mean, http://localhost/site/member/list?no=100 would call site/member.py page's function list with arguments no=100. Thats a feature i liked. But PROBLEM 01: i have included in index.py a css link to say something media/base.css now when same page comes with URL index.py/index the URL becomes false. I am finding some better way to overcome this. Placing all CSS as static served is not a good idea,(like if CSS is dynamically generated). So according to you, what should be a better approach to this problem. PROBLEM 02: How can I prevent directory traversal. Take the case, i have five subdirs in dir 'site' named : components modules config templates and a file loader.py when a request comes as loader.py/pagename?renderType=xhtml it would call the function pagename which loads the pages from subdir 'templates' resolves the added components in pages from subdir 'components' where components uses custom modules from 'modules' and so on. Configuration subdir contains various configuration files in .py and .xml I don't want visitors to traverse and get list of all those subdirs. Those sub-dirs actually should no way be traversable online. Though I can prevent it using apache .htaccess and access directives in apache config. But many hosting server, apache config can't be edited (or maybe some situation). Then how can i block traversing the directory (what sort of implementation) Referring to CodeIgnitor PHP Framework, they places index.php in every dir. thats doesn't seem a good idea, and if a person calls the pages providing the right path, they are able to execute files in the framework, though since those configs and other files doesn't return anything, tere is no result. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
.NET and Python Integration Problem and PDF Library (Need Help and Suggestions)
Hi. First I am explaining the Problem so it would not get messed up. :) == PROBLEM I have to integrate a small part in .NET Projects. .NET project is actually all Web-based application, user interface is Web-page for multiple actions. But a backend component of project needs PDF File manipulation. Manipuation is limited to splitting pages, removing certain pages, joining pages, finding certain text information (Title/Author/No. of Pages/Orientation of each page etc), and page orientation maipulation (rotating pages clockwise and anticlockwise, on degree parameter, left/right/flip etc). .NET guys are failing here, so I proposed to do that component in Python. But problem is, how to integrate Python in .NET Web Application. I am looking on IRONPYTHON, and thats the only point seemed to me. Also, as I am not an expert in Python, I have transition from Perl and PHP to python. So right now, my applciation architecture would little bit be inexperienced and not enterprise ready. But every component in project is being worked on Enterprise grade. Now, I want to integrate Python implementation for PDF works, and that would be called from .NET (C#) processes supplying required parameters. Since the whole application would be implemented on MS Windows Server, so I am bit lacking the freedom of library usage as in Linux. Also looking for best PDF library which doesn't have any or many dependencies and that dependencies can be successfully installed. I will also need an XML Library to write down the logs and instructions+information for next component which handles Printing. = Therefore, I am seeking all the precious (even small or one-liner) advices from you. Please suggest me every possible things that come in your mind. Things on high priorities right now are: -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Re: .NET and Python Integration Problem and PDF Library (Need Help and Suggestions)
In continuation of last mail [since pressing tab+space sent the mail :( ] Things on high priorities right now are: - How to integrate Python calling from .NET - Any suggestions for optimizations that would prevent overburden to application due to IronPython interpretation calling, if any, or does such things happen. - Pointers to good resources - Any step in such kind of situation, so to make it Enterprise Grade application components - your opinion with available PDF Libraries, that are best among. Also which library to use for Windows server platform (there is limitation on installing long chain libraries that include other deep dependencies too). A pure python PDF library would be good, but which one. -Which XML Library is pure python based. More questions will follow up :) And I hope, people will reply me. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Re: .NET and Python Integration Problem and PDF Library (Need Help and Suggestions)
Joshua: PDF library: ReportLab. But that is most generation of PDFs. For reading, splitting, etc, you may have to look at their commercial offering I will have to research on it, i think time to list the best available libs, and finding all's dependency. On Dec 19, 2007 6:10 AM, Boris Borcic [EMAIL PROTECTED] wrote: Everybody will tell you reportlab, but AFAIK the open-source kit does not provide manipulation of existing pdf file contents - only creation. Besides it's targeted at CPython and it isn't 100% clear it runs perfectly on other implementations; so have a look at itextsharp - it might better fit your needs if you decide to use IronPython. iTextSharp look very promising. But i am unable to find any good documentation. I think i will have to buy the book, so that I can have API docs just beside me for reference. One thing I am stuck at right now. the IronPython 1.0.2467 on .NET 2.0.50727.42 is installed on my Ubuntu, so does CPython 2.5 libraries can be called in it without any problem. In ipy shell, sys.path ['/home/rskumar', '/usr/lib/ironpython/Lib', '/usr/lib/python2.4', '/usr/lib/python2.4/site-packages'] so it uses Python 2.4 libs. I am fearing to mix the 2.4 and 2.5 libs. I need to load CPython 2.5 libs by adding it in site.py file of ironpython. Maybe I should go experimenting and let you people know about it. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Re: .NET and Python Integration Problem and PDF Library (Need Help and Suggestions)
If I had to do something like this I would host a Python web server listening on some port and let .NET application talk to me using HTTP requests preferably or SOAP if I really had to. It could be a Paster or Cherrypy or Twisted based server. Google for instruction on how to package it using py2exe into a windows service. The service could be hosted on the same server as .NET or a separate box Thats is the best solution to me also, but restrictions are I cann't consume extra service for it. I need tight integration and no remote service calls, thats why it seems bit tricky to me., and i am working to integrate Python implementation in .NET. So where the .NET application has to work with PDF part, it will invoke the IronPython Engine, pass required configurations and parameters, and get the result+exceptions etc. http://pybrary.net/pyPdf/ Noted for my reference. Thanks :) -Which XML Library is pure python based. ElementTree So ElementTree solved one part. thanks friend. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Re: Best way to protect my new commercial software.
1. Put all the compiled Python bytecode in a heavily encrypted binary file. Consider using a hardware hash in the key. 2. Program a small binary executable (.exe file) in C or C++ that: 2a. Reads the binary file. 2b. Decrypts it to conventional Python byte code. 2c. Embeds a Python interpreter. 2d. Executes the bytecode with the embedded Python interpreter. 3. Protect the executable with a licence manager such as Flexlm or SoftwarePassport. I will not make reverse engineering impossible, but it will be extremely difficult. As noted, the only completely safe solution is to provide a web application instead of distributing your program. -- http://mail.python.org/mailman/listinfo/python-list Guidelines are good. but as you stated, web application instead of desktop apps. Well, the main aim and interest here was to protect it against piracy and web application are easier to be get shared and pirated than desk apps. And there is no foolproof method known to me. Even Flexlm used in Acrobat(Adobe) is cracked in easy manner. The best thing to me looks like none. You can go with anything, and always fear that if the app is needed by many others, it will be cracked. Othewise, the method stated above is good to go. Get app core into python, encrypt-assemble the compiled python code with some key. When launched, get it reversed to python bytecode and there you go,. Now, since your apps loader is built in C, you can apply available methods for C/C++/ Remember, since python is readable easily, you fear so. But no language exists which humans can't read. At worst level, they will have to go for Assembly Level decompiling, but thats possible too -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Re: [OT] Guide me on Apache Virtual server+mod_python
thanks a lot. I am still trying to get it working. I think i will have to register those subdomains in CISCO as the hostame of same ip somehow. For the same configuration, I can have those subdomains.domain.ext open in my localhost, but from other system, I can't access it. No comments or error discriptions right now from my side. I would like to work a little more to get to some point and then let you all know what exactly the problem is. Again, thanks a lot for the help. On Dec 5, 2007 7:31 PM, Ravi Kumar [EMAIL PROTECTED] wrote: HI, I am sorry for OT here. But I search google, could not quench my thrist, so came here, and for single question, I don't want to subscribe in Apache Newsgroup. The problem is : i wwant to implement a mod_python based Website + Reporting Application on my system. In the domain, my system is : mysys.domain.com Now, I want to implement two subdomains on my apache server: http://www.site.com http://report.site.com Means two or multiple subdomains on same Apache Server. Only one IP Address and NIC is allocated in System (can't go for two IPs). Network has CISCO Routers . So can you please guide me a little, on how to do it. I just need some pointers and I will start finding them on Google. -- -=Ravi=- I am definitely not an expert, but no one else answered so here is how I did it. Look in the apache2 directory: 'conf'. then the subdirectory: 'extra' for the file: httpd-vhosts.conf. It contains sample code that you can use. This may not be exactly like your installation. I am using Apache2Triad. What you want is something like this: VirtualHost *:80 ServerName report.site.com ServerAlias report.site.com DocumentRoot /apache2triad/htdocs/www.domain.com ServerAdmin [EMAIL PROTECTED] ErrorDocument 403 http://www.site.com/403.htm ErrorDocument 404 http://www.site.com/404.htm /VirtualHost There are some other related code changes. Just search httpd.conf and the vhosts file for virtual and hosts and you should find all the code you need commented. Also, google has many tutorials. I did this about 6 years ago so I don't remember where I got the information, but there were many references. Note that you can have as many virtual hosts as you want with one IP, but (to my knowledge) you cannot have SSL on more than one web site with one IP unfortunately. Some guru needs to do this. - Show quoted text - - Original Message - From: Ravi Kumar [EMAIL PROTECTED] To: python-list@python.org Sent: Wednesday, December 05, 2007 6:01 AM Subject: [OT] Guide me on Apache Virtual server+mod_python HI, I am sorry for OT here. But I search google, could not quench my thrist, so came here, and for single question, I don't want to subscribe in Apache Newsgroup. The problem is : i wwant to implement a mod_python based Website + Reporting Application on my system. In the domain, my system is : mysys.domain.com Now, I want to implement two subdomains on my apache server: http://www.site.com http://report.site.com Means two or multiple subdomains on same Apache Server. Only one IP Address and NIC is allocated in System (can't go for two IPs). Network has CISCO Routers . So can you please guide me a little, on how to do it. I just need some pointers and I will start finding them on Google. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
[OT] Guide me on Apache Virtual server+mod_python
HI, I am sorry for OT here. But I search google, could not quench my thrist, so came here, and for single question, I don't want to subscribe in Apache Newsgroup. The problem is : i wwant to implement a mod_python based Website + Reporting Application on my system. In the domain, my system is : mysys.domain.com Now, I want to implement two subdomains on my apache server: http://www.site.com http://report.site.com Means two or multiple subdomains on same Apache Server. Only one IP Address and NIC is allocated in System (can't go for two IPs). Network has CISCO Routers . So can you please guide me a little, on how to do it. I just need some pointers and I will start finding them on Google. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Re: Need to call functions/class_methods etc using string ref :How
WOW, Thanks a lot. I got many options to do, and play with. Each one having its own pros and cons. But for my requirement in project, i will go with hasattr/getattr/callable and then calling the ref method. It seems fit for the problem. Thanks a lot :) again. On Dec 1, 2007 12:45 AM, Bruno Desthuilliers [EMAIL PROTECTED] wrote: George Sakkis a écrit : On Nov 26, 2:04 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Donn Ingle a écrit : I see someone already showed you eval. Eval is evil. Don't use it. Especially if the functions are coming to you from a public URL! Yes, I suggested to him (by email) this: thisinstance = SomeObject.__class__.__dict__ Then you have a list of strings that may be function names, so: This will only get attributes defined in SomeObject.__class__ - not the one defined in the parent classes. Nor methods dynamically bound to a specific instance. for f in yourlist: if f in thisinstance: eval(f)(params) Which would vet the functions too. You *still* don't need eval here. target = module or any other objet here for funcname in funclist: func = getattr(target, funcname, None) if callable(func): func(*args, **kwargs) I've almost never had a real use case for eval (or exec) in 7 years. That's not to say there aren't any. Indeed. But most of the time, I found that Python provides a more appropriate solution. In one project I'm using exec to parse user provided function bodies from a web interface into real python functions (the function signatures are auto generated). A problem I've never had to solve so far, so you're the expert here - but what about compiling the source with compile, then instanciating a function object from it ? (snip) -- http://mail.python.org/mailman/listinfo/python-list -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Re: any Templating system help
I havent looked much into string.template . I think i will have to now. I went trying MAKO, Cheetah, Genshi and some others too. But in less time, I got confused. I didn;t need a total language. Rather I just want to write my xHTML/CSS/JS in a page with embedded placeholders like ${variableName} or ${ModuleName.functiontoBeCaller(args, ...)} etc. And that should return the lists of all placements, so i can call them conditionally. If they have such feature to call the req function by themself, it would be good. So please suggest me some better thing. On Nov 29, 2007 7:56 PM, Yoram Hekma [EMAIL PROTECTED] wrote: On Thu, Nov 29, 2007 at 06:48:10PM +0530, Ravi Kumar wrote: Hi, I am stuck a little. I am working on a demo site to propose for the my company. Using mod_python and several python technologies. But the website is simply using publisher handler, i dont want to use any framework such as DJango etc. so the main idea is, i made many python files which has several defs inside, such as index, getList, submitForm etc now everything is working nice, means calling them in url. I need a templating system now. But not slow and complex. The only things in templating system i need is: fetching all the names of variables/placeholder in template. (i can then call the suitable defs from files and apply the wrapper on it and return to main caller) setting the values Please suggest some ideas. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list Well, I personally like Genshi (http://genshi.edgewall.org/), but offcourse there are others (myghty, cheetah) and I know you can use the Django templating system apart from the framework (never did this though. But personally, when I only need a templating system and nothing more (for some html-reports for instance) I tend to use genshi. Yoram -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHTswm6Y3ORTnySxURAvh3AKCtfxKGpHibuvxbw0p+DUZqZJ1LqQCfUDIz /c3cHk8FHqaja2vHCuRoPRY= =9cSn -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
any Templating system help
Hi, I am stuck a little. I am working on a demo site to propose for the my company. Using mod_python and several python technologies. But the website is simply using publisher handler, i dont want to use any framework such as DJango etc. so the main idea is, i made many python files which has several defs inside, such as index, getList, submitForm etc now everything is working nice, means calling them in url. I need a templating system now. But not slow and complex. The only things in templating system i need is: fetching all the names of variables/placeholder in template. (i can then call the suitable defs from files and apply the wrapper on it and return to main caller) setting the values Please suggest some ideas. -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Need to call functions/class_methods etc using string ref :How
Hi, First of all, since this is my first mail to Python-List, I want to say Hello world! After that; I am stuck in a project. Actually I am writing a module (for testing now), which takes URL, parses it, finds which modules and then which method to call or which class to initiate and which string to load. So far, I have done some basic URL manipulation and validation and extracted the name of modules in a dict { 'ModuleName-1': None, 'ModuleName-2': None --ETC-- } Now I want your help about how to call the function i.e _render() in the module. I have to iterate it calling all modules/also Class.methods and assinging the values in dict for each key as modulename. Means, just take that moduleName is a string which contains the name of module to load. FuncName is the string which contains the name of def function to call clName is the string which contains the name of the Class, which is to init and get returned object. means everything in string. ALso, if there are multiple methods to do it, if you provide a little pros/cons and comments, it would really be very nice of you. Before I came here, I have searched Google, and found a way hasattr()/getattr(), but that confused me a little and didnt worked for me. I am missing something I know, so please ENLIGHTEN Me :) Thanks in advance EVen you read this mail :P -- -=Ravi=- -- http://mail.python.org/mailman/listinfo/python-list
Re: Interop between C# and Python
On Apr 27, 8:25 pm, urielka [EMAIL PROTECTED] wrote: thx i will try this. i am also trying XML-RPC,i wrote a basic generator(in python) that genrate a Interface from the XML-RPC service module,but maybe with soaplib i don`t need this if i use wsdl as Visual Studio can generate the code from the wsdl Typed remoting mechanisms (SOAP, CORBA, ICE etc) tend to be less work with statically typed languages like C#. Untyped remoting mechanisms are more convenient to work with dynamic languages (XML-RPC, JSON-RPC etc). When combining them, typed one are more convenient because working with typed systems is more convenient in dynamic languages than it is to work with untyped systems in typed languages. Of course, if the project is really small, none of this really matters. Pick your poison. Ravi Teja. -- http://mail.python.org/mailman/listinfo/python-list
Re: Interop between C# and Python
On Apr 27, 6:09 pm, urielka [EMAIL PROTECTED] wrote: i need a easy way to write a Python Service(be it SOAP or JSONRPC or whatever) but i need to easily access it from C#,i created a web service in ZSI(which is really easy) like this: from ZSI import dispatch def hello(): return hello dispatch.AsServer(port=8080) simple and easy but how i access it from C#,where is the wsdl for the service? is there any easier way to get this kind of interop?(not using a custom protocol over sockets) thx, Uriel Katz Use soaplib instead of ZSI. It has better WSDL support which makes it easier to create client stubs from other languages. http://trac.optio.webfactional.com/ Ravi Teja. -- http://mail.python.org/mailman/listinfo/python-list
Re: Helpbook and CHM
On Apr 19, 3:58 am, Teja [EMAIL PROTECTED] wrote: On Apr 19, 3:48 pm, Tim Golden [EMAIL PROTECTED] wrote: Teja wrote: how to generate CHM files in Boa(Python)??? http://www.rutherfurd.net/software/rst2chm/index.html TJG Can't I do it in Boa constructor ??? I have seen an option in Boa to create a new helpbook and compile it to CHm and help files, But no clue how to do it... Not that I know of. Which version are you using? Where in the application did you find it? Indicate the menu's you navigated to get to that option. MS HTML Help Workshop is the standard compiler for CHM files. There are some other freeware/shareware. The workshop is simple enough though. -- http://mail.python.org/mailman/listinfo/python-list
Re: Helpbook and CHM
Teja wrote: how to generate CHM files in Boa(Python)??? http://www.rutherfurd.net/software/rst2chm/index.html TJG Can't I do it in Boa constructor ??? I have seen an option in Boa to create a new helpbook and compile it to CHm and help files, But no clue how to do it... Not that I know of. Which version are you using? Where in the application did you find it? Indicate the menu's you navigated to get to that option. MS HTML Help Workshop is the standard compiler for CHM files. There are some other freeware/shareware. The workshop is simple enough though. If u have Boa constructor 0.4.4, Go to File---New---helpbook Save it. After saving, click File menu option and you will find, make HTB and make CHM But I dont know how to add files and generate a complete CHM file. Right-click the file list view and select Add files. I didn't see this Helpbook feature before. However, I could not get it to compile after that. Unless, Boa Constructor is doing something while building CHMs that integrates with the app development, I recommend that you try a specialized tool for the job instead. Boa was an extremely promising tool when I saw it about 6 yrs ago or so at 0.0.1 (it already had a streamlined WYSIWYG GUI builder with a code aware editor back then, something we still don't have elsewhere for Python). But the development never seemed to gather steam since then. 0.4.4 is not even listed as a release on the home page and it is almost 2 yrs old. -- http://mail.python.org/mailman/listinfo/python-list
Re: ZSI, SOAP and .NET web services - problem
On Mar 26, 3:47 pm, Jaroslaw Zabiello [EMAIL PROTECTED] wrote: Dnia Mon, 26 Mar 2007 20:06:28 + (UTC), David E. Konerding DSD staff napisa³(a): Try fixing your WSDL, then try again. The problem is I see no errors in my WSDL. Pythonic implementation of SOAP is just crapy. -- Jaroslaw Zabiellohttp://blog.zabiello.com As Lawrence suggested, did you try soaplib? It is a newer project. Try the more recent svn version svn co https://svn.optio.webfactional.com/soaplib/trunk soaplib In my experience, it is more compliant than ZSI, although I mainly used it as a server than a client. Ravi Teja. -- http://mail.python.org/mailman/listinfo/python-list
Re: implementing SFTP using Python
Kiran, You should look into Twisted Python and their Twisted Python Conch package. You might not need to reinvent the wheel. http://twistedmatrix.com/trac/wiki/TwistedConch Ravi kadarla kiran kumar wrote: Hi Everybody, I have to implement SFTP conection from client to the server using Python script. Iam very new new to python , and i dont't have much time to complete this. So I need some pointers from you. If anybody has already done this kind of stuff, please let me know. Please don't think Iam over ambitious, but i need some kind of Pseudo code ,if possible source code. Thanks in Advance, K.Kiran Kumar Never Miss an Email Stay connected with Yahoo! Mail on your mobile. Get started! http://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/services?promote=mail -- http://mail.python.org/mailman/listinfo/python-list
Re: Help me with this!!!
It search a text inside that hex value. It works perfecly on a txt file but if I open a binary file (.exe,.bin ecc...) with the same value it wont work, why? Please help! Because the pattern isn't in the file, perhaps. This pattern IS in the file (I made it and I double check with an hex editor). It display the file correcltly (print line) but... No! Peter is right. Regular expressions match ASCII representation of data, not hex. In simple terms, do you see your pattern when you open the file in notepad (or other text editor)? You do not use regex to search binary files. Ravi Teja. -- http://mail.python.org/mailman/listinfo/python-list
Re: Hi, I'm new to python
On Jan 27, 5:37 am, [EMAIL PROTECTED] wrote: Hey Everyone Let me tell you all a little bit about my programming background so you can get an idea of my capability, or lack of, dealing with p.l; so far i've learned some visual basic when i was doing my a-levels and thats about it lol. Basically i like the sound of python and its ease of use and would like to know in depth more about it and its range of useage. Please do tell me all you know, keeping in mind i am a n00b, so do be gentle. :) Thanks Millball54 Start Here http://www.python.org/doc/ There is a ton of documentation tailored to learners with differing skills. You might also want to pick up a book on Python. Be sure to read the docs, use Google, search this group for similar questions in the past before you post questions. They are great resources. If you have very basic questions, IRC (freenode has a Python channel), is a better option. When you post, make the question as specific as possible. Sometimes typing a good question itself gives you an answer. Ravi Teja. -- http://mail.python.org/mailman/listinfo/python-list
Re: While loop with or? Please help!
while usrinp != y or Y or N or n: PROBLEM Correct way: while usrinp != y or usrinp != Y or usrinp != N or usrinp != n: There has to be a boolean evaluation on both sides of or. Or in this case: while usrinp not in ['Y', 'y', 'N', 'n']: Ravi Teja. -- http://mail.python.org/mailman/listinfo/python-list