praba kar wrote:
> Dear All,
>I want to know the link between c and python.
>Some people with C background use Python instead
> of programming in C.why?
For me, the choice is typically among C++, Perl, Python, and Java. The
arguments for Python relative to these languages are:
Dear Casino Player,
YOU HAVE BEEN PREAPPROVED.
Receive $100 FREE at the Online Casino Of The Year 2002 when you open a new
account.
DOWNLOAD AWARD WINNING CASINO GAMES
or
VISIT THEIR WEBSITE FOR MORE INFORMATION.
http://webmaster.windowscasino.com/SmartDownload.asp?affid=14409
WINDOWS CASINO
APCass wrote:
> How do you execute a .py in Linux with KDE? If I double click on my
> program it opens Kwrite, for editing.
Try inserting this as the first line of the file:
#!/usr/bin/env python
--
http://mail.python.org/mailman/listinfo/python-list
es_uomikim wrote:
> $ echo "something" | ./my_script.py
echo "test" | python -c "import sys; print sys.stdin.readlines()"
--
http://mail.python.org/mailman/listinfo/python-list
My opinion, as posted there, was pretty immediate and only going off of
surface values. I just saw in Django what I had seen too much of in my
own code. I've written similar things in Zope and Formulator that did
all sorts of fancy automatic 'admin screen' generation, DBMS CRUD
statements. I even a
If it's embedded, is there any reason why it should be SQL? A solid
alternative could me MetaKit, which has Python bindings:
http://www.equi4.com/metakit/python.html
"""
Buzzwords - Metakit is an embeddable database which runs on Unix,
Windows, Macintosh, and other platforms. It lets you build ap
Steven D'Aprano wrote:
> As a Linux user, I really am sick of every damn application, script and
> program under the sun filling the top level of my home directory with
> dot-files.
>
> I wish the Linux Standard Base folks would specify that settings files
> should all go into a subdirectory like
t; 3. How can i input root?
Assuming that you've already executed
import math
Here are some ways to find the square root of a number:
math.sqrt(4)
4 ** .5
math.pow(4, .5)
Jeff
pgpUKyYywumMf.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
Spyce has support for Cheetah Templates:
http://spyce.sourceforge.net/doc-mod_template.html
as well as pooling:
http://spyce.sourceforge.net/doc-mod_pool.html
Spyce templates are converted into python before execution, and you can
enable caching in the Spyce configuration file. Spyce also comes w
xcept', which is
really offensive. If I want to beg my computer to run programs, I know
where to find Intercal with its "PLEASE" and "DO PLEASE" constructions.
Jeff
pgpmDM5lPWYOK.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
.
After it, on step (3) you can safely and peacefully add new PowerOfGenerator
variable.
You can also get all places where said variable exists by using grep,
or your editor's search feature. I don't see how a var declaration
gains you anything over 'grep PowerOfGenerator *.py
losed during program
shutdown if it hasn't happened before then.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
on a single installation medium would be a tricky
edge case. I suspect it *could* be done in a GPL-acceptable way, but
one would need to take care about it.)
Of course, this is only my own personal interpretation and opinion --
IANAL, TINLA, YMMV, etc, etc.
Jeff Shannon
Technician/Program
real security, because malicious
code can still get to __builtins__ from almost any object...)
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
the exec'ed statement actually
sees, as well as what happens with the results. (But as I mentioned
before, there is no real security here if you're exec'ing arbitrary
code -- there's no sandboxing involved, and the exec'ed string *can*
use that __builtins__ reference (among other things) to do all sorts
of malicious stuff.)
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
may (as just one of many examples) be much
better off with something more like:
for i in range(n)[::-1]:
func(n)
The '[::-1]' iterates over the range in a reverse (decreasing)
direction; this may or may not be necessary depending on the
circumstances.
Jeff Shannon
Technician/
Courageous wrote:
*checks self to see if self is wearing rose colored glasses*
assert(self.glasses.color != 'rose')
;)
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber wrote:
On Wed, 09 Feb 2005 18:10:40 -0800, Jeff Shannon <[EMAIL PROTECTED]>
declaimed the following in comp.lang.python:
for i in range(n)[::-1]:
func(n)
Shouldn't that be
func(i)
(the loop index?)
You're right, that's what I *
--
def pr(self):
print self.var
---
(Though frankly I don't see the advantage of having this tiny function
in a separate file to begin with...)
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
the interval [0...4)
(including 0 but not including 4).
Modulus is useful for all sorts of periodic behavior.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
The Tkinter Canvas directly supports saving to postscript format, but
not any standard bitmap format (or even modern vector formats like pdf
or svg).
Jeff
pgpBVvDhXslRq.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber wrote:
On Thu, 10 Feb 2005 09:36:42 -0800, Jeff Shannon <[EMAIL PROTECTED]>
declaimed the following in comp.lang.python:
And as Peter Hansen points out, none of the Python versions leave n in
the same state that the C loop does, so that's one more way in whic
not* take that opportunity to
purge things like GOTO.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
In this case, you can use getattr() instead of the exec statement:
getattr(self.frame, t).SetTable(DataTable(d, r[0]), True)
Jeff
pgp6KrffC7xJf.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
to get rid of this binding, you would do it with something
like
w.bind_all("", "")
for some widget w.
I don't know why you see the "L1" and "L2" keysyms. I don't on my
system (Fedora Core 2)
Jeff
pgpzGQcAMSSXd.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
installed on their system (yes, a
pretty Linux-centric view).
One criticism of Make that I'd take seriously is that it's a
domain-specific language and usually I say those are terrible ideas. I
still have to refer to the manual to remember which of $*, $@, $^ or $<
I need, sometimes,
you could change the
type of ob_size to long in the "#define PyObject_VAR_HEAD". I don't
know what breaks when you do this, but maybe a few google or google
groups searches could help you find others who have tried this.
Jeff
PS the limit of 500MB of "real data" in the 32-bit system m
activities, os.shutil provides
something that is between os.xxx and os.system("xxx") in complexity and
capability.
Jeff
pgpQO2TDLG6iB.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
suggestion with the simplest Python CGI program.
http://docs.python.org/lib/node462.html
that program would look something like
#!/usr/bin/python
import cgi; cgi.test()
though you must know the correct path to the Python interpreter for this
to work.
Your best bet may be to a
act) matches to his
"requirements". Instead of saying "Hey, someone's done half my work
for me -- great!", he's saying "Hey, why haven't you done the rest of
my work!"
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
eed -- it looks like this worked perfectly to me, so the issue is
in what's expected. :)
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
ot;Interpretation is irrelevant. Logic is irrelevant. You will be
assimilated."
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
names do that nicely. What do you see as the harm of using it?)
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
Bruno Desthuilliers wrote:
Jeff Shannon a écrit :
If running a console app from Explorer, the console will close as soon
as the app terminates. Using raw_input() at the end of the app means
that it won't close until the user hits Enter.
So why dont you just open the console before runnin
dules are cleaned up.
If anybody knows if this is better-documented somewhere, please speak
up!
Jeff
pgpQsq77lVQfz.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
x27;t ever (normally) be cleaned up while they're still in use, but
during program shutdown refcounting necessarily ceases to apply.
The closest that would happen in C++, I believe, would manifest itself
as memory leaks and/or access of already-freed memory.
Jeff Shannon
Technician/Programmer
Credi
u insist on using an OS that's been obsolete for a decade or
more. ;)
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
name to this
new function, it's simply calling itself.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
se, one could ensure that unicode.join() used unicode() and
str.join() used str(), but I can conceive of the possibility of
wanting to use a plain-string separator to join a list that might
include unicode strings. Whether this is a realistic use-case is, of
course, a completely different quest
do more command-line checking than
this...)
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
__() is not a C++/Java destructor. Trying to make it
into one is unlikely to give an overal benefit.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
27;t
actually looked at it, but EasyGui (recently mentioned here; google
should help you find it) may meet your needs and be simpler to use.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
e), then str() will throw an exception.
The Effbot mentioned a join() implementation that would be smart
enough to do the right thing in this case, but it's not as simple as
just implicitly calling str().
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
eep using that word. I do not think that it means
what you think it means."
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
se a timer to do this; just have it fire periodically every
second or so, rather than only after several minutes.)
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
questionable.
There *are* similar-but-not-compatible libraries for DOS... or perhaps
I should say *were*, because I have no idea where one might find such
a thing now. (Though I presume that Google would be the best starting
place.) One would then need to find/create a Python wrapper for th
our
server changing status without your client taking direct action.
I really think that you *do* want to do fairly frequent status checks
with your server. The cost is small, and the gains in responsiveness
and robustness are potentially very significant.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
rgs, **kwargs)
if s != 'OK':
raise NotOK((s,r))
return r
return wrapped
I believe that this will be semantically almost equivalent, but
conceptually slightly simpler.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
Christopher J. Bottaro wrote:
Jeff Shannon wrote:
Python's __del__() is not a C++/Java destructor.
Learn something new everyday... What is it then? Excuse my ignorance, but
what are you suppose to do if your object needs to clean up when its no
longer used (like close open file handles
module-level reference "var". No variables are
actually created in the execution of "global var".
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
stuff like sending the text of an
exception as the result of the 'send' command.
Jeff
#
import Tkinter
__all__ = 'python', 'setup_send'
def makecommand(master, name, func, subst=None, needcleanup=0):
unpickler, eval() or the exec
statement)? If your program opens files with user-controlled names, did
you make all the right checks?
Jeff
pgpLhnjBDThEJ.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
at specially. If you want to suppress that character, return the
string "break" from the binding. Example:
from Tkinter import *
t = Tkinter.Tk()
e = Tkinter.Entry(t); e.pack()
e.bind("x", lambda event: "break")
Jeff
pgpdlybvqgp9Z.pgp
Description: PGP signature
-
;waitpid result is", os.waitpid(pid, 0)
and the output is
$ python /tmp/googlemike.py
child is pid 13874
spawned program
waitpid result is (13874, 0)
the fact that "spawned program" is printed after "child is pid N"
shows that the python program continu
(x), i, x)
Jeff
pgpKui90u477G.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
it's probably due
to something unique SUSE did in packaging Python. If you're having
problems with SUSE's own modifications, then the place to go is probably
their bug database or mailing lists.
Jeff
pgp3KIk3XPCY9.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
ocol */
} PyUnicodeObject;
Py_UNICODE is some "C" integral type that can hold values up to
sys.maxunicode (probably one of unsigned short, unsigned int, unsigned
long, wchar_t).
Jeff
pgpP4skAuElRz.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
LE_SHARED and HAVE_DECLSPEC_DLL that Python decides how to define
PyAPI_FUNC, and this little detail is usually below the radar.
Jeff
pgppEf9f5kh5m.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
ld reasonably synthesize
> different values for that flag for _any_ time value converted in about
> the same millisecond. What gives?
The tm_isdst field is not about the DSTness at the time of
conversion---it's about the DSTness of the converted time.
Jeff
pgpNFKAG8aJuW.pgp
Description
You may also want to look at Spyce. It is similar to JSP,PHP, or ASP.
There are some good docs and examples at the site.
http://spyce.sourceforge.net/
-jjr
--
http://mail.python.org/mailman/listinfo/python-list
Corey,
WinCvs can use python for macros, you might want to look at their code:
http://cvs.sourceforge.net/viewcvs.py/cvsgui/cvsgui/PythonLib/cvsgui/
You may also want to look at viewcvs, which is written in Python.
-jjr
--
http://mail.python.org/mailman/listinfo/python-list
untested
def my_getter(m, i, f):
try:
return m[i]
except (KeyError, IndexError):
return f()
my_getter(d, 'x', bigscaryfunction)
my_getter(d, 'y', lambda: scaryinlineexpresion)
pgp04VRKFqQL1.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python
Ah -- I'm sorry I was off-target, and I'm glad someone else had what may
be better advice for you.
Jeff
pgptOZnkOhiE1.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
sizes, octal is nearly useless but is still carried
about for backwards compatibility.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
Steven Bethard wrote:
Jeff Shannon wrote:
now that almost the entire industry has standardized on power-of-2
word sizes, octal is nearly useless but is still carried about for
backwards compatibility.
So do you think it's worth lobbying for its removal in Python 3.0 when
we can break
that, then this idiom should be harmless even under Jython.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
the system network code instead of the application code.)
If you need to care about when the network access happens, then you
should be using the lower-level protocols -- httplib and/or socket.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
m
constructing a single hash collision to make it worthwhile to invest a
*large* number of petaflops of processing power.) Sure it's not "100%
perfect", but... how perfect do you *really* need?
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
Tobiah wrote:
m = get_next_module()
some_nice_function_somehow_loads( m )
that'd be
mymodule = __import__('modulename')
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
Martin v. Löwis wrote:
Jeff Shannon wrote:
I'd be in favor of that, unless someone can come up with a compelling
current use-case for octal literals.
Existing code. It may use octal numbers, and it would break if they
suddenly changed to decimal.
Right, which was my original point -- i
my guess being that it's towards the
hight end of that range.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
lang.python/msg/71b57a32b311ffc8?dmode=source
Jeff
pgpXLMoKMtyfX.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
icial things, and in many cases there's real evidence to support
the contention that Python's design choices will decrease the
frequency of bugs.
Perhaps Python *is* becoming less Lisp-like... but I've never been
convinced that Lisp is the best of all possible programming l
the automatic file closing
happens as part of the object deletion, files opened in this way won't
be closed until the garbage collector runs (and collects this file
object).
Most of the time, this won't be a problem, but it's good to be aware
that things are not necessar
in
other cases it won't be, so it's important to keep in mind that the
cost exists.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
As far as I'm concerned, if you're just going to
'import *' your helper modules, you might as well leave the whole mess
as one big file, because you're throwing away almost all of the
benefits of dividing it into modules.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
st would enable you to do this
for multiple local names with a single call, but getvinfo() doesn't
try to do that...
Don't forget, in Python, all names are references. You only have to
be careful when you start re-binding names...
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
Op 2005-03-16, Jeff Shannon schreef <[EMAIL PROTECTED]>:
Bruno Desthuilliers wrote:
- if x is a class attribute of class A and a is an instance of A,
a.x=anyvalue create a new instance attribute x instead of modifying A.x
This is very consistent with the way that bin
raise ValueError("...")
The for/else pattern may look a bit odd, but the key feature here is
that the else clause only runs if the for loop terminates normally --
if you break out of the loop, the else does *not* run.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
lopers working on OO.o), it's not too surprising
that OpenOffice hasn't changed that much.
Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list
Raymond Hettinger wrote:
def count(self, value, qty=1):
try:
self[key] += qty
except KeyError:
self[key] = qty
I presume that the argument list is a typo, and should actually be
def count(self, key, qty=1): ...
Correct?
Jeff
Maybe something for sets like 'appendlist' ('unionset'?)
Jeff
pgpCq9GushexV.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
> [Jeff Epler]
> > Maybe something for sets like 'appendlist' ('unionset'?)
>
On Sat, Mar 19, 2005 at 04:18:43AM +, Raymond Hettinger wrote:
> I do not follow. Can you provide a pure python equivalent?
Here's what I had in mind:
$ python /tmp/uni
. Perhaps
some of the functions in the 'win32process' module of win32all can help.
Here's an example for Windows written in C:
http://win32.mvps.org/processes/fkill.html
Jeff
pgpZEr2XdFCHl.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
sheldon279 wrote:
Hi guys. First time poster long time reader.
Just wanted to say "Hi" ;)
On a side note my Hubby is REAL excited about
this new IPO stock GRDX. They just started trading
this one like 2 days ago. It's already almost
doubled in just 2 days! My Husband is really
excited about this st
Now(tm), though, now that 2.4 is officially released.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
ll have 2.4-compiled binary
distributions pretty soon.
As for 2.3 being broken, check your application path and file
associations. You may be inadvertently running the 2.3 version of
Pythonwin under the 2.4 interpreter.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mai
ou
can try reinstalling 2.4, uninstalling the packages, and then
uninstalling 2.4 again... or, if the packages' files were deleted when
Python was uninstalled, you may have to hack your registry to remove
those entries from the uninstall list.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
;""My
"foo" object"""), then things break down again.
In order to handle this sort of nested structure with anything
resembling true reliability, it's necessary to step up to a true
lexing/parsing procedure, instead of mere string matching and regular
such
special-case behavior would be extremely foolish to do...)
Of course, I'm just going off of what I remember having been said
elsewhere on c.l.p., and I wouldn't recommend anyone betting their life
savings on the reliability of my memory... :)
Jeff Shannon
Technician/Programmer
Credi
Steven Bethard wrote:
Jeff Shannon wrote:
Note also that functions which use exec cannot use the static
namespace optimization, and thus tend to be *much* slower than normal
functions
In what circumstances will this be true? I couldn't verify it:
[...]
exec """\
def fib2
ed-length block.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
eference C++ members despite the fact that 'this'
was not required, just because I wanted to be able to *see* which
variables were members and which weren't...)
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
have my modules use 'from
const import const'. But I will admit that the extra complication on
import may not be worth the "cleaner" module internals... As always,
it's a tradeoff, and each programmer must decide which costs are worth
bearing in their particular situ
a
UI to use that code in IDLE. An optional stage two could then be
rewriting the name-finding code to be smarter.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
hon
code is slow, and not all C code is fast, and if you're writing C from
scratch then you want to be sure where the hotspots are and focus on
converting only those areas to C.
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
7;s called, an instance of this class is created. All subsequent
calls just return a reference to the same instance. This ensures that
any changes to the instance are reflected anywhere that the object is
used. (In your code, only changes to the class SW1_DICT are reflected
elsewhere, not changes
VS.NET, and hopes to have wxPython built
for 2.4 Real Soon Now(tm).
Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list
>
> I want to write some kind of install script for my python app that
> will add c:\cygwin\usr\bin to the system path. I don't want
> to walk around to 50 PC's and twiddle through the GUI to:
>
> My Computer --> Control Panel --> System --> Advanced --> Environment
>
>
> How can a python, or even
her copyright information.
>>> type(list)
>>> class my_list(list):
... pass
...
>>> type(my_list)
>>> l = my_list()
>>> l.append('foo')
>>> l.extend(['bar', 'baz'])
>>> l[2]
'baz'
>>> l
[
301 - 400 of 1056 matches
Mail list logo