Hi.
I'm pleased to announce the thirty-second development release of PythonCAD,
a CAD package for open-source software users. As the name implies,
PythonCAD is written entirely in Python. The goal of this project is
to create a fully scriptable drafting program that will match and eventually
I am not happy with any of the Python-as-a-First-Language books out
there. My vague inclination to write one has not yet formed into a firm
intention, but it's close.
Of the books that are out there, Learning Python and Dive Into Python
are best for the hobbyist as opposed to classroom setting,
Hello I found this very strange; is it a bug, is it a feature, am I
being naughty or what?
foo = [[0, 0], [0, 0]]
baz = [ [0]*2 ] * 2
foo
[[0, 0], [0, 0]]
baz
[[0, 0], [0, 0]]
foo[0][0]=1
baz[0][0]=1
foo
[[1, 0], [0, 0]]
baz
[[1, 0], [1, 0]]
Why on earth does foo and baz behave
[EMAIL PROTECTED] wrote:
What am I doing wrong here?
import operator
import itertools
vals = [(1, 11), (2, 12), (3, 13), (4, 14), (5, 15),
... (1, 16), (2, 17), (3, 18), (4, 19), (5, 20)]
for k, g in itertools.groupby(iter(vals), operator.itemgetter(0)):
... print k, [i for i in
D H [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]:
You obviously ignored that and invented some argument that he
posted with malicious intentions. That better describes most of
your thousands of annoying posts.
I don't know what describes what you did. What is the point of bringing
[EMAIL PROTECTED] wrote:
Hello I found this very strange; is it a bug, is it a feature, am I
being naughty or what?
foo = [[0, 0], [0, 0]]
baz = [ [0]*2 ] * 2
...
Why on earth does foo and baz behave differently??
This is a frequently made mistake.
try also:
bumble = [[0]*2 for 0 in
[EMAIL PROTECTED] wrote:
Hello I found this very strange; is it a bug, is it a feature, am I
being naughty or what?
the repeat operator (*) creates a new list with references to the same
inner objects, so you end up with a list containing multiple references
to the same list. also see:
An expression like this creates a list of integers:
[0] * 2
[0, 0]
But an expression like this creates list of references to the list
named `foo':
foo = [0, 0]
baz = [foo] * 2
[foo, foo]
So, setting baz[0][0] = 1, is really setting foo[0] = 1. There is only
one instance of foo, but you have
[EMAIL PROTECTED] wrote:
What am I doing wrong here?
import operator
import itertools
vals = [(1, 11), (2, 12), (3, 13), (4, 14), (5, 15),
... (1, 16), (2, 17), (3, 18), (4, 19), (5, 20)]
for k, g in itertools.groupby(iter(vals), operator.itemgetter(0)):
... print k, [i for i in
Dale King DaleWKing [at]gmail [dot] com writes:
Therefore you do not have the right to do what you want with
Usenet. You have a responsibility to use Usenet in a way that benefits
the group as a whole (e.g. asking interesting questions that educate
others).
...or at least, in a way that
itertools only looks for changes to the key value (the one returned by
operator.itemgetter(0) in your case); it doesn't sort the list for you.
this should work:
for k, g in itertools.groupby(sorted(vals), operator.itemgetter(0)):
print k, [i for i in g]
footnote: to turn the
Hello,
I made a program that iterates through all the pdf's in a folder and
opens them and prints them. However, all of these pdf's are password
protected, so I have to manually type in the password many times.
Is there any way to open a password-protected PDF with the password
entered through
Maybe I just don't know the right special function, but what I am wanting to
do is write something akin to a __getattr__ function so that when you try to
call an object method that doesn't exist, it get's intercepted *along with
it's argument*, in the same manner as __getattr__ intercepts
if you don't know how to do things, you don't need to post.
if you know why this is about the dumbest way to do what you're doing,
and you're posted this on purpose, you really need to grow up.
If this was the case who then would post any questions? I not only made
my post with the best of
Erik Johnson wrote:
Maybe I just don't know the right special function, but what I am wanting to
do is write something akin to a __getattr__ function so that when you try to
call an object method that doesn't exist, it get's intercepted *along with
it's argument*, in the same manner as
Thus spoke D H (on 2006-05-25 23:12):
Fredrik Lundh wrote:
if you don't know how to do things, you don't need to post.
He already posted ...
Based on your Text, you can (in Perl, of course ;-)
extract the Goedel-Number sequence (prime number
sequence) of it:
use Acme::Goedelize;
my
There are a couple factual inaccuracies on the site that I'd like to clear up
first:
Trivial benchmarks put cerealizer and banana/jelly on the same level as far
as performance goes:
$ python -m timeit -s 'from cereal import dumps; L = [Hello, , (w,
o, r, l, d, .)]' 'dumps(L)'
1
In article [EMAIL PROTECTED],
Art Haas [EMAIL PROTECTED] wrote:
Hi.
I'm pleased to announce the thirty-second development release of PythonCAD,
a CAD package for open-source software users. As the name implies,
PythonCAD is written entirely in Python. The goal of this project is
to create
Thanks but now another problem :-(
Examples in books show importing a global so why does below give:
AttributeError: 'module' object has no attribute 'globalvar'
primes.pyx:
from run import globalvar
def prime(int kmax):
result = [run.globalvar]
...
run.py:
from primes import prime
globalvar =
vbgunz wrote:
if you don't know how to do things, you don't need to post.
If this was the case who then would post any questions?
you didn't post a question, you provided a ludicrously bad solution in
response to a simple question.
that's not a good way to promote Python.
/F
--
I just submit the questionnaire to Digg, you can digg for it here:
http://digg.com/software/Survey_on_open-source_software_for_the_desktop
And if you want to fill out the questionnaire, here it is:
http://freeonlinesurveys.com/rendersurvey.asp?sid=iegzi2sbv9j9g8h195091
Thanks for your
Your mail to 'slug' with the subject
Stolen document
Is being held until the list moderator can review it for approval.
The reason it is being held:
SpamAssassin identified this message as possible spam (score 5.3)
Either the message will get posted to the list, or you will receive
Free online resources for learning Python:
To get started, I strongly suggest Josh Cogliati's Non-Programmers
Tutorial for Python ( http://honors.montana.edu/~jjc/easytut/easytut/
).
I learned programming with this little tutorial, which is a very good
introduction.
After that, you could check
I will not try and stop helping others because you don't like my
answers. I found a perfectly good way how not to do something that
wasn't exactly wrong anyway. if you can take another persons honest
attempt to help someone and twist it into something it is not, I can
only suggest you look in the
Mike Kent wrote:
If anyone is successfully compiling Pyton 2.3 on an SCO OpenServer 5
box, I'd appreciate hearing from you on how you managed to do it. So
far, I'm unable to get a python that doesn't coredump.
Hey, I remember trying to compile Python 1.5 on an SCO OpenServer 5 box
back in
[EMAIL PROTECTED] wrote:
Lonnie List comprehensions appear to store their temporary result in a
Lonnie variable named _[1] (or presumably _[2], _[3] etc for
Lonnie nested comprehensions)
Known issue. Fixed in generator comprehensions. Dunno about plans to fix
it in list
I need to compile Python on OpenServer 5 because I need to 'freeze'
our Python app, and running 'freeze' requires a working, compilable
source installation of Python.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for your reply, Nick. My first thought was Ahhh, now I see. That's
slick!, but after playing with this a bit...
class Foo:
... def __getattr__(self, attr):
... def intercepted(*args):
... print %s%s % (attr, args)
... return intercepted
...
f = Foo()
f
vbgunz wrote:
I will not try and stop helping others because you don't like my
answers. I found a perfectly good way how not to do something that
wasn't exactly wrong anyway. if you can take another persons honest
attempt to help someone and twist it into something it is not, I can
only
Oh! Thanx! Great! this is what i was looking for! :)
Scott David Daniels ha escrito:
Pablo wrote:
Second solution: This is what i want, but...
class Base(object):
def __init__(self, attr):
self._attr = attr
def getattr(self):
return self._attr
attr =
Luis M. González [EMAIL PROTECTED] wrote:
Free online resources for learning Python:
To get started, I strongly suggest Josh Cogliati's Non-Programmers
Tutorial for Python ( http://honors.montana.edu/~jjc/easytut/easytut/
).
I learned programming with this little tutorial, which is a very
Is there any safe way to create an instance of an untrusted class
without consulting the class in any way? With old-style classes, I can
recreate an instance from another one without worrying about malicious
code (ignoring, for now, malicious code involving attribute access) as
shown below.
I'm creating a program to calculate all primes numbers in a range of 0
to n, where n is whatever the user wants it to be. I've worked out the
algorithm and it works perfectly and is pretty fast, but the one thing
seriously slowing down the program is the following code:
def rmlist(original,
[EMAIL PROTECTED] wrote:
I'm creating a program to calculate all primes numbers in a range of 0
to n, where n is whatever the user wants it to be. I've worked out the
algorithm and it works perfectly and is pretty fast, but the one thing
seriously slowing down the program is the following
def rmlist(original, deletions):
return [i for i in original if i not in deletions]
original will be a list of odd numbers and deletions will be numbers
that are not prime, thus this code will return all items in original
that are not in deletions. For n 100,000 or so, the program takes
Learning to Program by Alan Gauld
(http://www.freenetpages.co.uk/hp/alan.gauld/)
The best by far, for a n00b, in my opinion.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] writes:
Does anybody know a faster way to do this? (finding the difference all
items in list a that are not in list b)?
a = [3, 7, 16, 1, 2, 19, 13, 4, 0, 8]# random.sample(range(20),10)
b = [15, 11, 7, 2, 0, 3, 9, 1, 12, 16] # similar
Erik Johnson wrote:
Thanks for your reply, Nick. My first thought was Ahhh, now I see. That's
slick!, but after playing with this a bit...
class Foo:
... def __getattr__(self, attr):
... def intercepted(*args):
... print %s%s % (attr, args)
... return
John Bokma [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
Geoffrey Summerhayes [EMAIL PROTECTED] wrote:
After you kill Navarth, will it be nothing but gruff and deedle
with a little wobbly to fill in the chinks?
Comparing Navarth with Xah is a huge insult to Jack Vance. You
Kay Schluehr wrote:
Sounds like me. In rare moments I believe that I'm not alone on usenet
but there are other people as well. I wanted to go to the doctor
because I believed I had a multiple personality but than I discovered
that the doctor was me too.
That's bad, because all of you must be
I got it working using difference() and sets, thanks all! 100,000 takes
about 3 times the time of 10,000, which is what my math buddies told me
I should be getting, rather than an exponential increase :). Thanks,
all!
--
http://mail.python.org/mailman/listinfo/python-list
After a brief search, I didn't find any python package related to OLAP
and pivot tables. Did I miss anything ? To be more precise, I'm not so
interested in a full-blown OLAP server with an RDBMS backend, but
rather a pythonic API for constructing datacubes in memory, slicing and
dicing them,
I need a row of 127 bytes that I will use as a
circular buffer. Into the bytes (at unspecified times)
a mark (0mark128) will be written, one after the other.
After some time the buffer will contain the last 127 marks
and a pointer will point the next usable byte.
What would be the Pythonic way to
Erik Johnson wrote:
Thanks for your reply, Nick. My first thought was Ahhh, now I see. That's
slick!, but after playing with this a bit...
class Foo:
... def __getattr__(self, attr):
... def intercepted(*args):
... print %s%s % (attr, args)
... return
I guess Fredrik's message was more along the lines of ``don't try to
help others after a week or two toying with the language because you
might be offering disservice, despite your good intentions; leave this
to more experienced users``. The words might have been a bit harsher
but that's just
Geoffrey Summerhayes [EMAIL PROTECTED] wrote:
John Bokma [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Geoffrey Summerhayes [EMAIL PROTECTED] wrote:
After you kill Navarth, will it be nothing but gruff and deedle
with a little wobbly to fill in the chinks?
Comparing Navarth
Dr. Pastor wrote:
I need a row of 127 bytes that I will use as a
circular buffer. Into the bytes (at unspecified times)
a mark (0mark128) will be written, one after the other.
After some time the buffer will contain the last 127 marks
and a pointer will point the next usable byte.
What
Is there a better way to do this?
def QuietNamedTemporaryFile(**kwargs):
'''
Return a NamedTemporaryFile that doesn't complain when its file has already
been unlinked at __del__ time.
'''
tf = tempfile.NamedTemporaryFile(**kwargs)
def quiet_del():
try:
Devan L [EMAIL PROTECTED] writes:
Is there any safe way to create an instance of an untrusted class
Why are you instantiating classes you don't trust?
without consulting the class in any way?
If you don't consult the class, how can the instance be created
properly?
--
\ It's easy to
I tried to code the Sieve of Erastosthenes with generators:
def sieve_all(n = 100):
# yield all primes up to n
stream = iter(xrange(2, n))
while True:
p = stream.next()
yield p
# filter out all multiples of p from stream
Ben Finney wrote:
Devan L [EMAIL PROTECTED] writes:
Is there any safe way to create an instance of an untrusted class
Why are you instantiating classes you don't trust?
without consulting the class in any way?
If you don't consult the class, how can the instance be created
properly?
Devan L wrote:
Is there any safe way to create an instance of an untrusted class
without consulting the class in any way? With old-style classes, I can
recreate an instance from another one without worrying about malicious
code (ignoring, for now, malicious code involving attribute access) as
Michael Spencer wrote:
Devan L wrote:
Is there any safe way to create an instance of an untrusted class
without consulting the class in any way? With old-style classes, I can
recreate an instance from another one without worrying about malicious
code (ignoring, for now, malicious code
Also, IronPython cannot access CPython libraries. So it cannot be used
as a drop-in replacement for CPython in most non-trivial apps. Python
for .NET however allows you to both use both CPython and .NET
libraries.
It will be able to access the standard libraries, as long as they are
Can you recommend a book or a link for a person learning Python on
Windows who does not yet know C# or .NET?
Since Python is cross-platform, any Python book will do. If you need to
do MS Windows specific programming (COM and OLE automation, Windows
Services etc), you can use Mark Hammond's
Paul Rubin wrote:
I tried to code the Sieve of Erastosthenes with generators:
def sieve_all(n = 100):
# yield all primes up to n
stream = iter(xrange(2, n))
while True:
p = stream.next()
yield p
# filter out all multiples of
how to write script for these
1.Given a test file containing lines of words such as (abc, abb,
abd,abb, etc), write a script that prints, in order of frequency, how
many times each word appears in the file.
2.
Write a script running in an endless loop that pings an IP (specified
on the command
Chris_147 [EMAIL PROTECTED] wrote:
Thanks for the reply.
you are indeed right, they were included from different places.
from C:\Python24\Lib and D:\mydir
But the strange thing is:
anywhere on C: the file from C:\Python24\Lib was included.
in D:\mydir the one from that directory
BUT: anywhere
Ben Cartwright [EMAIL PROTECTED] writes:
You do realize that you're creating a new level of generator nesting
with each iteration of the while loop, right? You will quickly hit the
maximum recursion limit. Try generating the first 1000 primes.
Yes, I know about the generator nesting, that
The generator is in its own scope. For proof, try accessing q outside
the generator.
There are two possibilities. The first is that you don't know what
closures are and are complaining that python has them. That would be
amusingly ironic, but I'm guessing you do know (if you don't, google
Bugs item #1494787, was opened at 2006-05-25 12:32
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1494787group_id=5470
Please note that this message will contain a full copy of
Feature Requests item #1218333, was opened at 2005-06-10 18:34
Message generated for change (Comment added) made by ronaldoussoren
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=355470aid=1218333group_id=5470
Please note that this message will contain a full copy
Bugs item #1153016, was opened at 2005-02-27 20:41
Message generated for change (Comment added) made by twouters
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1153016group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1488915, was opened at 2006-05-15 17:26
Message generated for change (Comment added) made by twouters
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1488915group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1153016, was opened at 2005-02-27 20:41
Message generated for change (Comment added) made by maltehelmert
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1153016group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1495033, was opened at 2006-05-25 11:51
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1495033group_id=5470
Please note that this message will contain a full copy of
Bugs item #1495089, was opened at 2006-05-25 20:12
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1495089group_id=5470
Please note that this message will contain a full copy of
Bugs item #1495089, was opened at 2006-05-25 18:12
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1495089group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1494387, was opened at 2006-05-24 15:31
Message generated for change (Settings changed) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1494387group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1494671, was opened at 2006-05-24 17:51
Message generated for change (Comment added) made by bcannon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1494671group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1494671, was opened at 2006-05-24 17:51
Message generated for change (Comment added) made by bcannon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1494671group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1495175, was opened at 2006-05-25 17:03
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1495175group_id=5470
Please note that this message will contain a full copy of
Bugs item #1494671, was opened at 2006-05-25 00:51
Message generated for change (Settings changed) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1494671group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1494387, was opened at 2006-05-24 11:31
Message generated for change (Settings changed) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1494387group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1495210, was opened at 2006-05-25 14:39
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1495210group_id=5470
Please note that this message will contain a full copy of
Bugs item #1495210, was opened at 2006-05-25 14:39
Message generated for change (Comment added) made by ephantom
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1495210group_id=5470
Please note that this message will contain a full copy of the comment
101 - 176 of 176 matches
Mail list logo