diffing and uniqing directories

2008-04-26 Thread Rustom Mody
Over years Ive collected tgz's of my directories. I would like to diff and uniq them Now I guess it would be quite simple to write a script that does a walk or find through a pair of directory trees, makes a SHA1 of each file and then sorts out the files whose SHA1s are the same/different. What

Re. suid/sudo in python

2009-03-30 Thread Rustom Mody
Ben Finney wrote The key thing to realise is that, having relinquished privilege, the same process can't get it back again as easily. So if you need to do some tasks as a privileged user, do those *very* early and then drop the privileges for the rest of the life of the process. Taking

Re: Re. suid/sudo in python

2009-03-30 Thread Rustom Mody
On Mon, Mar 30, 2009 at 5:17 PM, andrew cooke and...@acooke.org wrote: Rustom Mody wrote: Ben Finney wrote The key thing to realise is that, having relinquished privilege, the same process can't get it back again as easily. So if you need to do some tasks as a privileged user, do those *very

Re: Re. suid/sudo in python

2009-03-30 Thread Rustom Mody
The outline of what I do (in C) is: 1. Write the CGI program in C, put setuid(0), setgid(0) statements in that file and then perform any other actions (including calling other scripts) 2. Set the S bit of the executable of the CGI binary compiled from the C file (chmod +S xxx.cgi) The C code runs

rope python-emacs problem

2008-10-15 Thread Rustom Mody
Ive been trying to use rope for python in emacs and I get a backtrace which starts with AttributeError: 'module' object has no attribute 'samefile' Any ideas? -- http://mail.python.org/mailman/listinfo/python-list

pickle internals

2008-05-19 Thread Rustom Mody
I am trying to understand pickle internals. This involves: -- the algorithm(s) used for traversal arbitrary structures -- the pickle format -- the use if any of introspection I'll be thankful for any pointers PS Should this question be put on some other list?/ --

python for driving the sound card

2008-06-26 Thread Rustom Mody
I am exploring the use of python to drive the sound card to experiment with tunings. How easy is it to write (or is it already available) to write a function chord which takes a (list of) frequencies and plays them? -- http://mail.python.org/mailman/listinfo/python-list

bicycle repair man help

2007-06-23 Thread Rustom Mody
Does someone know that when using bicycle repair man to refactor python code what exactly extract local variable means? -- http://mail.python.org/mailman/listinfo/python-list

emacs for python

2007-06-24 Thread Rustom Mody
I wish to set up emacs for python usage. The specific questions are: 1. Which python mode should one use? It seems there is one from python and one from emacs and both are deliberately named so as to be confusable!! I would like one that gives... 2. Good support for debugging: I hear pdbtrack

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-06-24 Thread Rustom Mody
Hi folks! Dont want to spoil the fun of a real flame war here but what I want to ask is directly relevant to emacs in python [And the answers may even add some light to the current heat :-) ] I will be training a bunch of kids for using python in a data-center linux-sysadmin context. I intend

amara bugs

2007-06-25 Thread Rustom Mody
I tried to install amara according to the recommendations on this list. There were evidently compilation errors. The results are below Also the quick reference gives 404 not found errors Thanks $ sudo easy_install amara Searching for amara Best match: Amara 1.2.0.2 Processing

Re: Indenting in Emacs

2007-06-26 Thread Rustom Mody
Ive been struggling with this same question -- which python mode -- for a while but not getting anywhere! I understand (from the emacs list) that the new python mode has better support for debugging (pdbtrack in addition to pdb) but dont know much more. On 6/26/07, John J. Lee [EMAIL PROTECTED]

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-06-28 Thread Rustom Mody
On 6/28/07, Andreas Eder [EMAIL PROTECTED] wrote: Twisted In the other corner, we have just about every Unix application ever Twisted developed. When a user needs help, they may do such things as manually Twisted explore the directories where the application was installed

trouble with sqlite under debian etch

2007-06-30 Thread Rustom Mody
I was trying to follow the sqlalchemy tutorial on my debian etch box and got stuck with installation. Any help/pointers will be welcome. First after installing sqlalchemy needed some sqlite package synaptic showed me packages python-pysqlite, python-pysqlite1.1 and python-pysqlite2. Theres some

How to uninstall packages

2007-06-30 Thread Rustom Mody
Recently I had trouble with the sqlite package under my debian etch box as follows: I first installed the debian package python-pysqlite1.1 using synaptic. Since this seemed too old for other packages (sqlalchemy) I downloaded the sources pysqlite-2.3.4.tar.gz and ran setup install. This gave

Re: How to uninstall packages

2007-07-01 Thread Rustom Mody
-management systems which invariably quarell with the native apt/rpm or whatever... On 7/1/07, Thomas Jollans [EMAIL PROTECTED] wrote: On Sunday 01 July 2007, Rustom Mody wrote: I first installed the debian package python-pysqlite1.1 using synaptic. Since this seemed too old for other packages

xml yml and dependency hell

2007-07-10 Thread Rustom Mody
yaml by its indent-orientation is quite pythonic. In comparison xml is cumbersome and laborious. Strangely ruby supports yaml out of the box but python requires a third party package PyYAML. Now this may not seem like a big deal for us -- installing pyYAML takes all of one minute -- but it may

Re: xml yml and dependency hell

2007-07-10 Thread Rustom Mody
On 7/11/07, Stefan Behnel [EMAIL PROTECTED] wrote: Rustom Mody wrote: So is it likely that yaml will make it to the standard python library at some point?? That's up to the maintainers of PyYAML. If they want to get it in, there will be ways to get there. If they do not want to - unlikely

Re: bool behavior in Python 3000?

2007-07-10 Thread Rustom Mody
Considering bools as ints -- Pros: The ALU of any computer uses boolean gates to build an arithmetic functions. Therefore considering the base type of ints and bools to be (strings of) bits seems natural Cons: This comes from the pioneering work of Dijkstra and his coworkers) The distributive

Re: Can a low-level programmer learn OOP?

2007-07-14 Thread Rustom Mody
On 7/14/07, Alex Martelli [EMAIL PROTECTED] wrote: OOP can be abused (particularly with deep or intricate inheritance structures). But the base concept is simple and clear: you can bundle state and behavior into a stateful black box (of which you may make as many instances, with independent

dejagnu equivalent

2007-07-18 Thread Rustom Mody
Does anyone know if a dejagnu equivalent exists for python? [Dejagnu is in tcl] -- http://mail.python.org/mailman/listinfo/python-list

Re: Copy List

2007-07-18 Thread Rustom Mody
The standard idiom (I guess) is to use the slice a=[1,2,3,4] b=a b is a True b [1, 2, 3, 4] c=a[:] c is a False c [1, 2, 3, 4] This is shallow copy If you want deep copy then from copy import deepcopy -- http://mail.python.org/mailman/listinfo/python-list

Re: The Modernization of Emacs: exists already

2007-07-18 Thread Rustom Mody
Xah Lee: I agree with what you say now and most of what you wrote a month back -- I even learnt something useful from there -- longlines mode. Emacs is important to me and (I guess) to many of the subscribers here. But how does posting an emacs related question help on a python mailing list??

Re: The Modernization of Emacs: exists already

2007-07-18 Thread Rustom Mody
Wildenburger [EMAIL PROTECTED] wrote: Rustom Mody wrote: But how does posting an emacs related question help on a python mailing list?? One Word: Ego. Don't reply. /W -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickled objects over the network

2007-07-18 Thread Rustom Mody
Sure pyro may be the solution but it may also be overkill Why not use safe_load from the yaml module? -- http://mail.python.org/mailman/listinfo/python-list

Pickled objects over the network

2007-07-19 Thread Rustom Mody
Irmen de Jong wrote In what way would Pyro be overkill where Yaml (also a module that you need to install separately) wouldn't be? Sure they are the same to install and sure pyro can do the job (pyro is a nice package). But I got the impression that the questioner wanted to do the networking

Re: Pickled objects over the network

2007-07-20 Thread Rustom Mody
that will let us fill out an object's member variables on the other end. It's much less cool, but it seems like it'd be more secure. -Walker On 7/19/07, Rustom Mody [EMAIL PROTECTED] wrote: Irmen de Jong wrote In what way would Pyro be overkill where Yaml (also a module that you need

Re: Pythonic way for missing dict keys

2007-07-20 Thread Rustom Mody
Can someone who knows about python internals throw some light on why x in dic is cheaper than dic.has_key(x) ?? -- http://mail.python.org/mailman/listinfo/python-list

python-mode errors

2008-08-17 Thread Rustom Mody
When I start python mode I get the error: idle error: #buffer easygui.py -Wrong number of arguments : #subr set-match-data 2 The Python mode version is 4.78 Is this a known problem? Thanks -- http://mail.python.org/mailman/listinfo/python-list

rspec for python

2008-08-25 Thread Rustom Mody
Is there anything equivalent to rspec for python? -- http://mail.python.org/mailman/listinfo/python-list

Re: rspec for python

2008-08-26 Thread Rustom Mody
Gerhard Haring wrote: Have you actually used this rspec thing in Ruby? I always wonder with such things. Same with all the other hyped technologies of yesteryear. Anybody out there who really uses model-driven development? -- Gerhard Two laws are (the) most fundamental in our field.

AOP and pep 246

2007-11-01 Thread Rustom Mody
I am interested in AOP in python. From here one naturally (or google-ly) reaches peak. But peak seems to be discontinued. Whereas pep-246 on adaptors seems to be rejected in favor of something else. What?? Can someone please throw some light on whats the current state of the art? --

Re: AOP and pep 246

2007-11-01 Thread Rustom Mody
On 11/1/07, Kay Schluehr [EMAIL PROTECTED] wrote: AOP was a research that gone nowhere - at least not in its orginal AspectJ form: declaring aspect code that targets business code, weaving the aspect code into the business app using a code generator. There was much excitement about it

compiling python 3000 on debian etch

2007-11-02 Thread Rustom Mody
Ive been trying to compile python 3000 on debian etch And on running test I get: 4 skips unexpected on linux2: test_tcl test_dbm test_ssl test_bsddb Can someone tell me what packages I am missing? -- http://mail.python.org/mailman/listinfo/python-list

Re: AOP and pep 246

2007-11-02 Thread Rustom Mody
I find these viewpoints interesting in their divergence. At the risk of being simplistic: Kay: AOP == AspectJ or thereabouts. A failure in itself and uninteresting to pythonistas Michele: AOP not very interesting though does good work himself in decorators, metaclasses and other such AOPish

c interfacing in 2.5

2007-09-15 Thread Rustom Mody
I used python extensive 3-5 years back. Coming back I find some changes. Trying to understand whats new and would appreciate any help/comments/pointers. Earlier there were basically two options: SWIG: convenient but inefficient Native (Extending/Embedding): an efficient way of getting a

Re: trim start and trailing space chars from string

2007-09-15 Thread Rustom Mody
s= abcdef s.strip() 'abcdef' s.rstrip() ' abcdef' s.lstrip() 'abcdef ' On 9/15/07, Konstantinos Pachopoulos [EMAIL PROTECTED] wrote: Hi, is there something corresponding to the java String.trim() method, ie trim start and trailing space/tab chars from string? say

Re: generating list of sub lists

2007-09-16 Thread Rustom Mody
On 9/16/07, cesco [EMAIL PROTECTED] wrote: Hi, is there a one-liner to accomplish the following task? From the list l = ['string1', 'string2', 'string3'] generate the list of lists l = [['string1'], ['string1', 'string2'], ['string1', 'string2', 'string3']] Any help would be appreciated.

Re: can Python be useful as functional?

2007-09-17 Thread Rustom Mody
The following defines the infinite list of primes as a generator [chap 6.5 of the library] def sieve(l): p = l.next() yield p for x in sieve(l): if x % p != 0: yield x After that from itertools import * [p for i,p in izip(range(10), sieve(count(2)))] [2, 3, 5,

Re: can Python be useful as functional?

2007-09-18 Thread Rustom Mody
On 9/18/07, Alex Martelli [EMAIL PROTECTED] wrote: Rustom Mody [EMAIL PROTECTED] wrote: Can someone help? Heres the non-working code def si(l): p = l.next() yield p (x for x in si(l) if x % p != 0) There should be an yield or return somewhere but cant figure it out

cool-compiling python 3

2009-10-28 Thread Rustom Mody
I guess this is a bit OT but anyhow. I just finished compiling compiling python 3 on ubuntu and discovered that my laptop has a builtin toaster :-; Yeah I know this is not a python issue and probably modern laptops are meant to run wondrous beautiful elephantaneous things like eclipse

Another (simple) unicode question

2009-10-29 Thread Rustom Mody
Construct http://construct.wikispaces.com/ is a kick-ass binary file structurer (written by a 21 year old!) I thought of trying to port it to python3 but it barfs on some unicode related stuff (after running 2to3) which I am unable to wrap my head around. Can anyone direct me to what I should

Re. Web development with Python 3.1

2009-10-31 Thread Rustom Mody
Rober Kern wrote But if you insist, you may be interested in Breve: http://pypi.python.org/pypi/Breve/ Thanks for that! Viva internal DSLs! [Sorry -- cut my teeth on lisp] Is there anything like this for xml? Well I guess that is a slightly wrong (if not straight stupid) question. Maybe

Re: python simply not scaleable enough for google?

2009-11-17 Thread Rustom Mody
Language L is (in)efficient. No! Only implementations are (in)efficient I am reminded of a personal anecdote. It happened about 20 years ago but is still fresh and this thread reminds me of it. I was attending some workshop on theoretical computer science. I gave a talk on Haskell. I showed

compiling python 3

2009-09-13 Thread Rustom Mody
Just managed to compile python3 on debian lenny I get (among other things) 7 skips unexpected on linux2: test_dbm_ndbm test_bz2 test_ttk_guionly test_tcl test_tk test_ttk_textonly test_dbm_gnu Any ideas what dev packages I need to add? Also emacs python-mode is not set for python3 it

execfile in python3 breaks emacs mode

2009-10-04 Thread Rustom Mody
Removing execfile from python3 has broken the good-ol python-mode of emacs. Changing the line In python-mode.el in function py-execute-file changing the line (cmd (format execfile(r'%s') # PYTHON-MODE\n filename))) to (cmd (format exec(open(r'%s').read()) # PYTHON-MODE\n filename))) seems to

Re: execfile in python3 breaks emacs mode

2009-10-04 Thread Rustom Mody
Just answering my own question A little googling tells me to use (cmd (format exec(compile(open('%s').read(), '%s', 'exec')) # PYTHON-MODE\n filename filename))) instead of (cmd (format exec(open(r'%s').read()) # PYTHON-MODE\n filename))) sheesh! On Sun, Oct 4, 2009 at 6:57 PM, Rustom Mody

reifying indent and dedent into braces

2009-10-13 Thread Rustom Mody
At http://www.secnetix.de/olli/Python/block_indentation.hawk I find that the python code if foo: ... if bar: ... x = 42 ... else: ... print foo ... has its indentation structure made explicit as if foo :[0] INDENT if bar : [0, 4] INDENT x = 42

error return from urlopen

2009-08-05 Thread Rustom Mody
When I direct urlopen to a non-existent server process I get IOError: [Errno socket error] (10061, 'Connection refused') The connection refused is as expected but whats the 10061? strerror(10061) says 'unknown error' So its like an errno but not quite an errno? Can I find out more about this

TDD in python

2010-11-28 Thread Rustom Mody
Does anyone know of something like this for python? http://www.vimeo.com/13240481 -- http://mail.python.org/mailman/listinfo/python-list

class browser

2010-12-08 Thread Rustom Mody
If I have a medium to large python code base to browse/study, what are the class browsers available? -- http://mail.python.org/mailman/listinfo/python-list

xml in python

2009-05-08 Thread Rustom Mody
Can someone give me a heads up on xml parsing in python? The context is that I want to write a simple docbook to text converter. DOM is alright -- dont want to break my head with SAX just for performance when my documents are not likely to be large. My problem is that there seems to be so many

help with recursive whitespace filter in

2009-05-10 Thread Rustom Mody
I am trying to write a recursive filter to remove whitespace-only nodes for minidom. The code is below. Strangely it deletes some whitespace nodes and leaves some. If I keep calling it -- like so: fws(fws(fws(doc))) then at some stage all the ws nodes disappear Does anybody have a clue? from

using urlretrive/urlopen

2009-05-15 Thread Rustom Mody
I am trying to talk to a server that runs on localhost The server runs on http://localhost:7000/ and that opens alright in  a web browser. However if I use urlopen or urlretrieve what I get is this 'file' -- obviously not the one that the browser gets: htmlbody bgcolor=#ff Query

making a python program in windows

2009-05-21 Thread Rustom Mody
I know how to make a python script behave like a (standalone) program in unix -- 1. put a #! path/to/python as the first line 2. make the file executable The closest I know how to do this in windows is: r-click the file in win-explorer goto properties goto open with change pythonw to python Can

Small emacs fix for Google group users

2013-10-30 Thread Rustom Mody
For the double spacing rubbish produced by GG, I hacked up a bit of emacs lisp code - (defun clean-gg () (interactive) (replace-regexp ^ +\n +\n +$ -=\=- nil 0 (point-max)) (flush-lines +$ 0 (point-max)) (replace-regexp -=\=- nil 0 (point-max))) (global-set-key (kbd f9)

Re: Google Groups + this list

2013-12-25 Thread Rustom Mody
On Thu, Dec 26, 2013 at 3:39 AM, ru...@yahoo.com wrote: On 12/25/2013 05:19 AM, Ned Batchelder wrote: On 12/24/13 8:47 PM, ru...@yahoo.com wrote: On 12/23/2013 09:12 AM, Chris Angelico wrote: Also, you haven't answered the other part of the post, the more important part. Refresh my

Re: Google Groups + this list

2013-12-25 Thread Rustom Mody
On Thu, Dec 26, 2013 at 9:47 AM, Chris Angelico ros...@gmail.com wrote: On Thu, Dec 26, 2013 at 3:11 PM, Ned Batchelder n...@nedbatchelder.com wrote: Kevin started this thread by asking a question. Chris responded without helping the OP, and talked about Google Groups instead. That's not

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Rustom Mody
On Fri, Dec 27, 2013 at 10:50 AM, Andrew Berg robotsondr...@gmail.com wrote: On 2013.12.26 23:04, Travis McGee wrote: The Python.org site says that the future is Python 3, yet whenever I try something new in Python, such as Tkinter which I am learning now, everything seems to default to Python

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-27 Thread Rustom Mody
On Fri, Dec 27, 2013 at 11:53 AM, Dan Stromberg wrote: On Thu, Dec 26, 2013 at 9:43 PM, Rustom Mody wrote: 2. Always write strings with a u prefix 3.0, 3.1 and 3.2 don't understand this, but 3.3 does. Ok I was writing this under the assumption that 2 is really entrenched whereas 3.n

Re: cascading python executions only if return code is 0

2013-12-27 Thread Rustom Mody
On Fri, Dec 27, 2013 at 10:12 PM, Roy Smith wrote: In article mailman.4668.1388160953.18130.python-l...@python.org, Dennis Lee Bieber wrote: On Thu, 26 Dec 2013 23:29:30 -0500, Roy Smith r...@panix.com declaimed the following: NTP is never supposed to move the clock backwards. If your

Re: Python mange with liste

2013-12-28 Thread Rustom Mody
On Sun, Dec 29, 2013 at 5:00 AM, Bala Ji wrote: Hello guys, i need some help with is program I have a txt file test.txt where there is Name;Sexe;Answer(Y or N) example of txt file: -- nam1;F;Y nam2;M;N nam3;F;Y nam4;M;N halo;M;Y rock;M;N nam1;F;N

Re: Python mange with liste

2013-12-28 Thread Rustom Mody
On Sun, Dec 29, 2013 at 8:38 AM, Rustom Mody wrote: Give up on file-IO, ie dont use the EXTERNAL file nam1;F;Y nam2;M;N nam3;F;Y nam4;M;N halo;M;Y rock;M;N nam1;F;N But ASSUME you have the internal python data structure names = [(nam1, F, Y), (nam2, M, N)] # complete the list Well

Re: Python mange with liste

2013-12-29 Thread Rustom Mody
On Sun, Dec 29, 2013 at 3:49 PM, Bala Ji bala...@gmail.com wrote: hello, thank you for your help i wrote this: x=nam1 y=F names = [(nam1, F, Y), (nam2, M, N)] l = len(names) for i in range(0,l): print names[i][0] print names[i][1] if x == names[i][0] and y

Fwd: Mailing list erraticness

2013-12-31 Thread Rustom Mody
On Tue, Dec 31, 2013 at 10:03 AM, Ethan Furman wrote: On 12/30/2013 08:25 PM, Devin Jeanpierre wrote: On Mon, Dec 30, 2013 at 2:38 PM, Ethan Furman wrote: Wow -- another steaming pile! Mark, are you going for a record? ;) Indeed. Every post that disagrees with my opinion and

looking for a quote on age and technology

2013-12-31 Thread Rustom Mody
There is a quote which I vaguely remember seeing on this list. It went something like this: (yeah my rendering is poor) For a new technology: If you are a kid when it comes out, you just take it as a matter of course If you are a young adult, then it becomes a hot topic for discussion If

Re: looking for a quote on age and technology

2013-12-31 Thread Rustom Mody
On Tue, Dec 31, 2013 at 10:30 PM, Rustom Mody rustompm...@gmail.com wrote: There is a quote which I vaguely remember seeing on this list. It went something like this: (yeah my rendering is poor) For a new technology: If you are a kid when it comes out, you just take it as a matter of course

Re: looking for a quote on age and technology

2013-12-31 Thread Rustom Mody
On Tue, Dec 31, 2013 at 10:40 PM, Joel Goldstick wrote: On Tue, Dec 31, 2013 at 12:00 PM, Rustom Mody rustompm...@gmail.com wrote: There is a quote which I vaguely remember seeing on this list. It went something like this: (yeah my rendering is poor) For a new technology: If you

Re: About some problem

2014-01-02 Thread Rustom Mody
On Thu, Jan 2, 2014 at 10:23 PM, Joel Goldstick joel.goldst...@gmail.com wrote: On Thu, Jan 2, 2014 at 11:31 AM, raj kumar rajkumar84...@gmail.com wrote: Hello, I am beginner to python and i am writing following code from pytesser import * and i am getting an error as follow Traceback

looking for a quote on age and technology

2014-01-02 Thread Rustom Mody
On Thu, Jan 2, 2014 at 11:22 AM, Ben Finney wrote: I think you're referring to an article by the late, great Douglas Adams, “How to Stop Worrying and Learn to Love the Internet”: Thanks Ben -- Yes thats the one I was looking for! -- https://mail.python.org/mailman/listinfo/python-list

Re: About some problem

2014-01-02 Thread Rustom Mody
On Thu, Jan 2, 2014 at 11:06 PM, Ned Batchelder n...@nedbatchelder.com wrote: On 1/2/14 12:05 PM, Rustom Mody wrote: i'm not sure about this but isnt it normally the case that different version modules dont get mixed up like that? IOW if pytesser was a properly packaged 2.7 module would

How to read and post tracebacks (was Registry Key Value Help)

2014-01-02 Thread Rustom Mody
On Fri, Jan 3, 2014 at 8:35 AM, Chris Angelico ros...@gmail.com wrote: On Fri, Jan 3, 2014 at 11:12 AM, J. McGaha j2mcg...@gmail.com wrote: When I run the this code I get an error that says the ‘int’ can’t be called. Python errors include full backtraces that show exactly what's going on.

Re: How to read and post tracebacks (was Registry Key Value Help)

2014-01-02 Thread Rustom Mody
On Fri, Jan 3, 2014 at 9:33 AM, Chris Angelico ros...@gmail.com wrote: On Fri, Jan 3, 2014 at 2:58 PM, Rustom Mody rustompm...@gmail.com wrote: Why not write up a few lines on How to read and post python tracebacks and post it on the wiki? You mean copy and paste the whole output? I'm

Re: Is Python really Lisp without parentheses? So would it be easy to *implement* a lot of Python in Scheme/Lisp?

2014-01-03 Thread Rustom Mody
On Fri, Jan 3, 2014 at 12:16 PM, Chris Seberino cseber...@gmail.com wrote: I've heard it said, by no less a guru than Peter Norvig, that Python is a lot like Lisp without the parentheses at least for the basics of Python. For pedagogical reasons, I'm wondering if it would be easy to

Re: Is Python really Lisp without parentheses? So would it be easy to *implement* a lot of Python in Scheme/Lisp?

2014-01-03 Thread Rustom Mody
On Fri, Jan 3, 2014 at 10:20 PM, Chris Seberino cseber...@gmail.com wrote: Exceptions, modules, OOP, etc. would be tricky to implement in Scheme but at least the basics like for loops, while loops, assignment etc. would seem doable and very instructive for students.they would thereafter,

Re: Blog about python 3

2014-01-04 Thread Rustom Mody
On Sun, Jan 5, 2014 at 8:50 AM, Roy Smith r...@panix.com wrote: I wrote: I realize I'm taking this statement out of context, but yes, sometimes fast is more important than correct. In article 52c8c301$0$29998$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano

Re: What's correct Python syntax?

2014-01-14 Thread Rustom Mody
On Tuesday, January 14, 2014 2:16:56 PM UTC+5:30, Igor Korot wrote: Hi, ALL, I'm trying to process a file which has following lines: 192.168.1.6 192.168.1.7: ICMP echo request, id 100, seq 200, length 30 (this is the text file out of tcpdump) Now I can esily split the line twice:

Re: What's correct Python syntax?

2014-01-14 Thread Rustom Mody
On Tuesday, January 14, 2014 2:55:00 PM UTC+5:30, Igor Korot wrote: What if I want field 2 and field 3? (seq 200 and length 30) Wee you did say: I'm interesred in only one element, so why should care about everything else? So its not clear what you want! Do you want a one-liner? You could

Re: What's correct Python syntax?

2014-01-14 Thread Rustom Mody
On Tuesday, January 14, 2014 3:32:24 PM UTC+5:30, Igor Korot wrote: Hi, Rustom, On Tue, Jan 14, 2014 at 1:37 AM, Rustom Mody wrote: On Tuesday, January 14, 2014 2:55:00 PM UTC+5:30, Igor Korot wrote: What if I want field 2 and field 3? (seq 200 and length 30) Wee you did say: I'm

Re: What's correct Python syntax?

2014-01-14 Thread Rustom Mody
On Tuesday, January 14, 2014 4:05:27 PM UTC+5:30, Igor Korot wrote: Hi, Rustom, On Tue, Jan 14, 2014 at 2:16 AM, Rustom Mody wrote: You want this? test = I,like,my,chocolate test.split(',') ['I', 'like', 'my', 'chocolate'] test.split(',')[2:4] ['my', 'chocolate'] Yup

Re: plotting slows down

2014-01-14 Thread Rustom Mody
On Tuesday, January 14, 2014 6:34:43 PM UTC+5:30, Norman Elliott wrote: @Dave, no problem. I am using gedit to write the files and have it set to translate tabs into 4 spaces which is what was recommended to me as the right amount of indenting for python scripts. Dunno what you mean by

Re: Guessing the encoding from a BOM

2014-01-16 Thread Rustom Mody
On Friday, January 17, 2014 7:10:05 AM UTC+5:30, Tim Chase wrote: On 2014-01-17 11:14, Chris Angelico wrote: UTF-8 specifies the byte order as part of the protocol, so you don't need to mark it. You don't need to mark it when writing, but some idiots use it anyway. If you're sniffing a

Re: Guessing the encoding from a BOM

2014-01-17 Thread Rustom Mody
On Friday, January 17, 2014 9:56:28 PM UTC+5:30, Pete Forman wrote: Rustom Mody writes: On Friday, January 17, 2014 7:10:05 AM UTC+5:30, Tim Chase wrote: On 2014-01-17 11:14, Chris Angelico wrote: UTF-8 specifies the byte order as part of the protocol, so you don't need to mark

Re: How to write this as a list comprehension?

2014-01-17 Thread Rustom Mody
On Saturday, January 18, 2014 4:49:55 AM UTC+5:30, Piet van Oostrum wrote: Hi, I am looking for an elegant way to write the following code as a list comprehension: labels = [] for then, name in mylist: _, mn, dy, _, _, _, wd, _, _ = localtime(then) labels.append(somefunc(mn, day,

Re: How to write this as a list comprehension?

2014-01-18 Thread Rustom Mody
On Saturday, January 18, 2014 2:06:29 PM UTC+5:30, Peter Otten wrote: Options I can think of: You could do it in two steps... time_name_pairs = ((localtime(then), name) for then, name in mylist) labels = [somefunc(t.tm_mon, t.tm_mday, t.tm_wday, name) for t, name in

Re: question about input() and/or raw_input()

2014-01-18 Thread Rustom Mody
On Sunday, January 19, 2014 12:00:20 AM UTC+5:30, Roy Smith wrote: Pardon me for being cynical, but in the entire history of the universe, has anybody ever used input()/raw_input() for anything other than a homework problem? Similar 'cynicism' regarding print would be salutary for producing

Re: question about input() and/or raw_input()

2014-01-18 Thread Rustom Mody
On Sunday, January 19, 2014 9:51:36 AM UTC+5:30, Chris Angelico wrote: On Sun, Jan 19, 2014 at 3:15 PM, Rustom Mody wrote: On Sunday, January 19, 2014 12:00:20 AM UTC+5:30, Roy Smith wrote: Pardon me for being cynical, but in the entire history of the universe, has anybody ever used input

Re: question about input() and/or raw_input()

2014-01-19 Thread Rustom Mody
On Sunday, January 19, 2014 10:29:58 AM UTC+5:30, Chris Angelico wrote: On Sun, Jan 19, 2014 at 3:43 PM, Rustom Mody wrote: Because these two pieces of code def foo(x): print x+1 def bar(x): return x+1 look identical (to a beginner at least) foo(3) 4 bar(3) 4 As do these pieces

Re: How to write this as a list comprehension?

2014-01-20 Thread Rustom Mody
On Monday, January 20, 2014 4:32:40 PM UTC+5:30, Piet van Oostrum wrote: Rhodri James writes: On Sat, 18 Jan 2014 16:00:45 -, Jussi Piitulainen wrote: [...] I would write that on three lines anyway, properly indented: [ somefunc(mn,day,wd,name) for (then, name) in mylist

Re: Can post a code but afraid of plagiarism

2014-01-20 Thread Rustom Mody
On Monday, January 20, 2014 7:38:28 PM UTC+5:30, Roy Smith wrote: Chris Angelico wrote: On Mon, Jan 20, 2014 at 4:21 PM, Dan Stromberg wrote: I did a short time of teaching while I was in school. If three students all turned in the same assignment, they all got docked significantly.

Re: regex multiple patterns in order

2014-01-20 Thread Rustom Mody
On Monday, January 20, 2014 10:10:32 PM UTC+5:30, Devin Jeanpierre wrote: On Mon, Jan 20, 2014 at 8:16 AM, Mark Lawrence wrote: On 20/01/2014 16:04, Neil Cerutti wrote: I use regular expressions regularly, for example, when editing text with gvim. But when I want to use them in Python I

Re: Diving in to Python - Best resources?

2014-01-21 Thread Rustom Mody
On Tuesday, January 21, 2014 1:04:16 AM UTC+5:30, Matt Watson wrote: Getting in the habit of dropping in a google group for any new project - everyone tends to be so helpful. I work in the automotive sales industry(management) and find myself doing so many day to day tasks that could easily

Re: Can post a code but afraid of plagiarism

2014-01-21 Thread Rustom Mody
On Wednesday, January 22, 2014 6:21:37 AM UTC+5:30, Steven D'Aprano wrote: On Mon, 20 Jan 2014 19:17:35 +1100, Ben Finney wrote: indar kumar writes: Hint would have been enough but I was strictly discouraged. You asked for private help, specifically to subvert the rules against

Re: Early retirement project?

2014-01-22 Thread Rustom Mody
On Wednesday, January 22, 2014 7:15:34 PM UTC+5:30, Larry wrote: On Wed, Jan 22, 2014 at 1:18 AM, wrote: In fact, Python just becomes the last tool I (would) recommend, especially for non-ascii users. That's right - only Americans should use Python! Of whom the firstest and worstest is

Re: any wheel experts here?

2014-01-22 Thread Rustom Mody
On Wednesday, January 22, 2014 4:31:32 PM UTC+5:30, Oscar Benjamin wrote: Sounds reasonable. I don't know the answer or whether anyone else on this list will but you can definitely find the relevant developers at this mailing list: https://mail.python.org/mailman/listinfo/distutils-sig/ I

Re: Can post a code but afraid of plagiarism

2014-01-22 Thread Rustom Mody
On Wednesday, January 22, 2014 2:06:17 PM UTC+5:30, indar kumar wrote: So my question is if I am giving multiple inputs(a new device say for example) in a loop and creating a database(dictionary) for each new devices for example. I want subsequent devices to save their data(values only not

sqlite3 docbug (was problem with sqlite3)

2014-01-22 Thread Rustom Mody
On Thursday, January 23, 2014 8:35:58 AM UTC+5:30, Tim Chase wrote: On 2014-01-23 03:32, lgabiot wrote: cursor = conn.execute(SELECT filename, filepath FROM files WHERE max_level(?), threshold) that doesn't work (throw an exception) That last argument should be a tuple, so unless

Re: sqlite3 docbug (was problem with sqlite3)

2014-01-22 Thread Rustom Mody
On Thursday, January 23, 2014 10:03:43 AM UTC+5:30, Rustom Mody wrote: The builtin connection.execute is even less helpful I meant help(conn.execute) -- https://mail.python.org/mailman/listinfo/python-list

Re: sqlite3 docbug (was problem with sqlite3)

2014-01-22 Thread Rustom Mody
On Thursday, January 23, 2014 10:11:42 AM UTC+5:30, Chris Angelico wrote: I think it's fairly clear from the example that it has to be either a tuple or a dict. Looks fine to me. yes 'from the example' and only from there! -- https://mail.python.org/mailman/listinfo/python-list

Re: sqlite3 docbug (was problem with sqlite3)

2014-01-23 Thread Rustom Mody
On Thursday, January 23, 2014 3:15:07 PM UTC+5:30, lgabiot wrote: Le 23/01/14 10:04, Mark Lawrence a écrit : No, you need to remember how to type xyz into your favourite search engine. For this case xyz would be something like python single element tuple. No big deal, but I don't think

  1   2   3   4   5   6   7   8   9   10   >