Re: how to bypass firewall

2005-11-15 Thread Gregory Bond
Parth wrote: I need some help regrading byassing firewalls.My college has internet aces but it prevents us from dowloading music(*.mp3,*.mid,etc.)from the net. Hello everyone, I need help getting my college degree. I downloaded a hack to bypass the college internet firewall and the college

Re: which feature of python do you like most?

2005-11-13 Thread Gregory Bond
[EMAIL PROTECTED] wrote: which feature of python do you like most? Duck typing (All I care about is that it quacks, and it doesn't have to derive from Duck() to do that!) And decorating (the ability to add attributes to objects on-the-fly, not the @XXX stuff) --

Re: C#3.0 and lambdas

2005-09-25 Thread Gregory Bond
Mike Meyer wrote: This is a well-known phenomenon, having picked up the name bikeshed something like 40 years ago. Google for bikeshed color. My favourite bikeshed story: A colleague just joined his local Primary School council. On the agenda for his first meeting was that the shelter shed

Re: Brute force sudoku cracker

2005-09-19 Thread Gregory Bond
My current solver does 1 level of backtracking (i.e. constant space, and bounded time) only, and it has been able to solve every puzzle I've thrown at it. It's based on the usual logic and book-keeping for the most part. (It also explains how it comes up with each answer step as it goes,

Re: Why do Pythoneers reinvent the wheel?

2005-09-12 Thread Gregory Bond
François Pinard wrote: In computer science, I often saw old concepts resurrecting with new names, and then mistaken for recent inventions. New ideas are not so frequent... There are very few problems in Computer Science that cannot be solved with an additional level of indirection. --

Re: Ode to python

2005-09-07 Thread Gregory Bond
Hmmm... OK... you forced me into it. Python uses whitespace Where C++ uses a brace New users fret, But old pros forget - it quickly all falls into place. I could go on.. -- http://mail.python.org/mailman/listinfo/python-list

Re: Function returns a function

2005-09-07 Thread Gregory Bond
Paul Rubin wrote: Aldo Cortesi [EMAIL PROTECTED] writes: Thanks to Paul and Aldo... one more question on the implementation. Why is the func_closure a tuple of Cells and not just a tuple of objects? Why the extra level of indirection? -- http://mail.python.org/mailman/listinfo/python-list

Re: round function problem

2005-09-06 Thread Gregory Bond
mg wrote: Is it a bug or a control behavour ? I don't understand ?!?!?!?!... It's a case of applying different float-to-text rounding in different situations, on a variable that (even after round()) is not representable in binary floatingpoint. print var does one sort of string conversion

Re: Function returns a function

2005-09-06 Thread Gregory Bond
Paul Rubin wrote: def FunctionMaker(avar, func, label): def callback(): avar.set(label) func() return callback I've seen this idiom a lot and I know _what_ it does. but I can't work _how_ it does it. How does the name binding work so that avar

Re: Adding bound methods dynamically...

2005-08-31 Thread Gregory Bond
Kevin Little wrote: I want to dynamically add or replace bound methods in a class. I want I asked a seemingly-unrelated question a week or so ago, and learned something interesting: Python 2.3.4 (#2, Jul 12 2004, 12:46:36) [GCC 3.3] on sunos5 Type help, copyright, credits or license for

Re: Eve from Adams' Ribs

2005-08-23 Thread Gregory Bond
Godwin wrote: But the funny fact is that i want this class to be dynamically generated at run time simply from a table name string. The thing you are looking for is called an object-relational mapper. try SQLObject http://sqlobject.org/ This is mainly intended to work the other way (i.e.

Re: loop in python

2005-08-22 Thread Gregory Bond
km wrote: Is python runtime slow at all aspects when compared to perl ? And in addition to all that everyone else has said most of this is startup time. The python interpreter is a fair bit slower to start up (i.e. does much more at startup time) than the perl one: lenford$ time

keeping a ref to a non-member function in a class

2005-08-16 Thread Gregory Bond
I'm building a class hierarchy that needs to keep as a class variable a reference to a (non-member) function, so that different subclasses can use different generator functions. But it seems Python is treating the function as a member function because the reference to it is in class scope

Re: keeping a ref to a non-member function in a class

2005-08-16 Thread Gregory Bond
Peter Otten wrote: You are on the right track with staticmethod, but you have to apply it to fn: ... fn = staticmethod(foo) Thanks Peter, that's a big help. I can solve my problem now, but I'm chasing this further in the name of education, because it seems there is some deep magic

Re: Printing literal text of an argument

2005-08-11 Thread Gregory Bond
Rex Eastbourne wrote: def debug(aname, avalue): print aname, 'is': pprint.pprint(avalue) use eval: def debug(s): print s, 'is' pprint.pprint(eval(s)) (it does mean the arg is a string not code..) On a slightly different topic, is it also possible to make

Re: Adding and attribute to an instance

2005-08-10 Thread Gregory Bond
J wrote: I have looked at some of the source code in PyObject_GenericGetAttr and it turns out that the object has no dictionary. It seens that the address of the dictionary is computed somehow via tp_dictoffset in the type object. I asked this a few months ago.. Basically, you need a

Re: Module Extension C/CPI Question

2005-08-10 Thread Gregory Bond
Jeremy Moles wrote: Or, perhaps, there's even a better way? I'm getting more and more experienced with the Python/C API, so I don't need a walk-through or anything. :) Just an experienced recommendation... Better by far to create a new python type in C that has your struct inside it and

Re: (Win32 API) callback to Python, threading hiccups

2005-07-08 Thread Gregory Bond
Tim Roberts wrote: PyGILState_STATE gil = PyGILState_Ensure(); result = PyEval_CallObject(my_callback, arglist); PyGILState_Release(gil); Py_DECREF(arglist); Py_DECREF(result); If someone else holds a reference to arglist, then the

Re: How do you program in Python?

2005-07-07 Thread Gregory Bond
Jorgen Grahn wrote: Emacs and vim are almost always installed, or trivially installable. All I need to remember is to bring my emacs config file. And, fortunately, USB pen drives are now big enough to hold it! -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Gregory Bond
Rocco Moretti wrote: Actually, Google's answer to that question is something called ILOG CPLEX, We use this. It's a library / command line tool (not a language) for doing optimization - linear programming, quadratic programming, mixed-integer programming etc. Very cool and very, very

Re: is there an equivalent of javascript's this[myMethod] for the currently running script?

2005-07-05 Thread Gregory Bond
[EMAIL PROTECTED] wrote: I'd like to dynamically find and invoke a method in a Python CGI. boundmeth = obj.meth # nb: no () # stuff. boundmeth() # call it, with args if needed -- http://mail.python.org/mailman/listinfo/python-list

Re: web programming with mod_python

2005-07-04 Thread Gregory Bond
Rodrigo Dominguez wrote: My question is: is there some kind of framework that works with mod_python? I use and love Albatross, but there are heaps of others. Check the mod_python FAQ, in particular http://www.modpython.org/FAQ/faqw.py?req=showfile=faq03.010.htp --

Re: processing a Very Large file

2005-05-19 Thread Gregory Bond
Mike Meyer wrote: Unknown. Python relies on the C alloc/free routines for handling memory. del may immediately free() the memory (I don't know), but that doesn't mean it gets released to the OS. None of the implementations of alloc/free I'm aware of ever give the memory back to the OS. They

Re: processing a Very Large file

2005-05-17 Thread Gregory Bond
DJTB wrote: Hi, I'm trying to manually parse a dataset stored in a file. The data should be converted into Python objects. In addition to what the others have mentioned, this sort of problem is pretty easy to do with a C coded extension type, if you have (or can buy/borrow) any C skills.

Re: PyObject_New not running tp_new for iterators?

2005-04-21 Thread Gregory Bond
I wrote: [snip] What am I missing? The fundamental problem is that this: if (!(ro = PyObject_New(MyIter, MyIterType))) return NULL; is really only a malloc() - it doesn't call the tp_new function at all. This is not really clear in the 2.3 version of the C API document that I was

Can an object of a C type have random members added? tp_dictoffset?

2005-04-21 Thread Gregory Bond
One of the cool things about Python is the ability to decorate objects with random extra members: class C: def __init__(self): self.foo = 0 c = C() c.bar = 1 I have a class implemented in C using tp_members to specify (read-only) access to data members in the C struct. I'd like to be

Threads and variable assignment

2005-04-11 Thread Gregory Bond
I've had a solid hunt through the (2.3) documentation but it seems silent on this issue. I have an problem that would naturally run as 2 threads: One monitors a bunch of asyncrhonous external state and decides if things are good or bad. The second thread processes data, and the processing