Re: Algorithms in Python

2012-01-26 Thread Chetan Harjani
On Thu, Jan 26, 2012 at 2:22 AM, Martin Schöön wrote: > On 2012-01-25, Chetan Harjani wrote: >> Thanks Alec for the link. U know I wanted to read this book by Simon >> Singh -> The Code Book, I hear its good. >> > It indeed is. I only remember one error, an error ever

Re: Algorithms in Python

2012-01-25 Thread Chetan Harjani
, I am avoiding it right now but I really liked the author's style when I read his book on python language. Thanks Visgean, the links seem really valuable Thanking all with regards Chetan H Harjani IIT Delhi -- http://mail.python.org/mailman/listinfo/python-list

Algorithms in Python

2012-01-25 Thread Chetan Harjani
Is there any book or site on python algorithms which asks more and teaches less, I don't want to get bored, and at the same time I want to learn and act more. I use ubuntu. (just in case if its needed). #ALGORITHMS -- Chetan H Harjani IIT Delhi -- http://mail.python.org/mailman/listinfo/p

Re: Learning python reading software source code

2011-08-26 Thread Chetan Harjani
Thanks Michael :) . I will keep your suggestions in mind. On Fri, Aug 26, 2011 at 9:01 AM, Chetan Harjani wrote: > Hello friends, > > I have learned the basic syntax of python through the book HOW TO THINK > LIKE A COMPUTER SCIENTIST n by reading first 10-11 chapters of > A

Learning python reading software source code

2011-08-25 Thread Chetan Harjani
or just the python official docs would be enough? thanking you -- Chetan H Harjani -- http://mail.python.org/mailman/listinfo/python-list

Re: Interpreting Left to right?

2011-06-24 Thread Chetan Harjani
wrong? On Fri, Jun 24, 2011 at 10:02 AM, Chetan Harjani wrote: > x=y="some string" > And we know that python interprets from left to right. so why it doesnt > raise a name error here saying name 'y' is not defined? > > another example: > (1,2) + 3, >

Interpreting Left to right?

2011-06-23 Thread Chetan Harjani
now (3,) is a tuple as seen by following: t=3, type(t) Arent both of this contradicting? -- Chetan H Harjani -- http://mail.python.org/mailman/listinfo/python-list

what happens inside?

2011-06-22 Thread Chetan Harjani
why tuples are immutable whereas list are mutable? why when we do x=y where y is a list and then change a element in x, y changes too( but the same is not the case when we change the whole value in x ), whereas, in tuples when we change x, y is not affected and also we cant change each individual e

Re: question about True values

2006-10-28 Thread Chetan
Georg Brandl <[EMAIL PROTECTED]> writes: > Chetan wrote: >>> Steven D'Aprano wrote: >>> > On Sat, 28 Oct 2006 03:13:42 +0100, Steve Holden wrote: >>> > >>> >>> Finally, while True/False is a good mental mapping for numeric >>

Re: question about True values

2006-10-28 Thread Chetan
syntactic sugar that some people like. Many of the projects that I have been associated with had such a define because the language (C) does not provide it. On the other hand, there are many who do just fine without them. For expressions used in control flow, if the expression somehow pr

Re: question about True values

2006-10-28 Thread Chetan
lking about two-value logic > > not semantics. > Cheers, > Cliff I am joining after some network downtime here, so I seem to have missed what the real issue here is. At the risk of being completely irrelevant to the discussion here, I think it doesn't seem to be just about something or nothing - is None something or nothing? It seems to be neither: >>> None >>> None and True >>> None or True True >>> None and False >>> None or False False >>> False or None >>> False and None False >>> True and None >>> True or None True >>> not None True Chetan -- http://mail.python.org/mailman/listinfo/python-list

Re: Safely renaming a file without overwriting

2006-10-28 Thread Chetan
use link to rename the file - which will not overwrite the file if it exists. Then use unlink to remove the src file. Chetan -- http://mail.python.org/mailman/listinfo/python-list

Re: PROBLEM with MOD_PYTHON

2006-10-28 Thread Chetan
on't understand where I am wrong. > > thanks so much >Marco. Even if there is nothing Apache specific, doesn't it look odd that the path has 4 backslashes? Even accounting for half of those being added at the time of printing, it would appear that Apache is trying to use the path that contains two backslashes as path separator but there needs to be only one. Chetan -- http://mail.python.org/mailman/listinfo/python-list

Re: using mmap on large (> 2 Gig) files

2006-10-28 Thread Chetan
if they were made after some discussion. I can submit my patch as it is, but I am working on making some of the other changes I had in mind for the mmap to be useful. Some of the other changes would make more sense for py3k, if it supports a byte array object, but I haven't looked at py3k at all. Chetan -- http://mail.python.org/mailman/listinfo/python-list

Re: using mmap on large (> 2 Gig) files

2006-10-26 Thread Chetan
Paul Rubin writes: > I mean just have an interface to OS locks (Linux futex and whatever > the Windows counterpart is) and maybe also a utility function to do a > compare-and-swap in user space. There is code for spinlocks, but it allocates the lockword in the process me

Re: To remove some lines from a file

2006-10-26 Thread Chetan
an > interpreted languages... however, as i posted last time, i was actually > not aware that you have to call three of them. > > sebastian. I don't have the original post to know exactly what is needed, but looks like something that can be done by a single sed script. -Chetan -- http://mail.python.org/mailman/listinfo/python-list

Re: using mmap on large (> 2 Gig) files

2006-10-26 Thread Chetan
ives, other types of synchronization mechanisms are provided by the OS. However, I do see value in providing a shared memory based spinlock mechanism. These services can be built on top of the shared memory infrastructure. I am not sure what kind or real world python applications use it. -Chetan -- http://mail.python.org/mailman/listinfo/python-list

Re: Fatal Python error: deallocating None

2006-10-25 Thread Chetan
> > so I want it to run overnight too. Any hints ? > > None should *never* be deallocated, so it sounds like it's not being > INCREFed correctly somewhere. Extension module, etc ... > > Tim Delaney Or incorrectly DECREFed, perhaps? -Chetan -- http://mail.python.org/mailman/listinfo/python-list

Re: Ctypes Error: Why can't it find the DLL.

2006-10-25 Thread Chetan
but that would not explain why it fails in the first case - perhaps the OP now knows what happened. Interestingly I get a different error with the distribution binary for 2.5 - I get "Error 22" instead of "Errno 126", but the message text was same, so I assumed this was from a different version and something had changed about how the errno is reported. However, I checked the windows error codes and 126 seems to be the correct error. The error code talks about bad command and the corresponding message text reads "The device does not recognize the command." -Chetan > > Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Ctypes Error: Why can't it find the DLL.

2006-10-24 Thread Chetan
y - in this case, directory of python.exe current directory- set the current drive and path to whereever you want before trying to load the dll windows system directory windows directory Directories specified in PATH evnvironment variable -Chetan > Hi, > &g

Re: return tuple from C to python (extending python)

2006-10-24 Thread Chetan
"Kiran" <[EMAIL PROTECTED]> writes: > PyObject* toRet; > toRet = PyTuple_New(num_addr); > > then, in a for loop, i assign values to the tuple as follows: > > for ( i = 0; i < num_addr; i++ ) > { > printf("%d\n", dat[i]); > PyTuple_SET_ITEM(toRet, i, (PyObject*)dat[i] ); > }

Re: Python thread stack size

2006-10-23 Thread Chetan
The default thread allocated in for pthread is 32K if the system default is lower (it is 16K on my system). If the system default is higher, it is used. -Chetan -- http://mail.python.org/mailman/listinfo/python-list

Re: python class instantiation

2006-10-23 Thread Chetan
pend("SomeString") inst.stringData = "Changed" inst2 = A() print inst2.stringData print inst2.listData print inst.listData.append("NewThing") inst.stringData = "NewChanged" print inst.stringData print inst.listData print inst.stringData print inst.listDat