File "", line 1, in
File "vector.py", line 15, in __init__
return list.__new__(cls, list(a))
TypeError: list.__new__(X): X is not a type object (Vector)
Good luck in your journey!
~ethan~
--
http://mail.python.org/mailman/listinfo/python-list
a continue.
if x1 < limit:
do a
if x2 < limit:
do b
if x3 < limit:
do c
.
.
.
etc
On the plus side, it's easy to read and understand -- on the minus side,
it doesn't jump to the end once the tests start failing.
Hope this helps.
~ethan~
--
http://mail.python.org/mailman/listinfo/python-list
]
Thanks Len
I've never had the (mis?)fortune to work with COBOL -- what are the
files like? Fixed format, or something like a dBase III style? I
presume also that you only need access to them in COBOL format long
enough to transfer them into MySQL -- true?
~ethan~
--
http://mail.pyt
Grant Edwards wrote:
On 2008-11-14, Ethan Furman <[EMAIL PROTECTED]> wrote:
jzakiya wrote:
I'm translating a program in Python that has this IF Then chain
IF x1 < limit: --- do a ---
IF x2 < limit: --- do b ---
IF x3 &
len wrote:
On Nov 13, 7:32 pm, Ethan Furman <[EMAIL PROTECTED]> wrote:
len wrote:
Hi all;
[snip]
Here is my problem. I need to start doing this in the really world at
my company converting some older cobol system and data to python
programs and MySQL. I have gotten past packed d
.
Documentation will be improved as time permits.
Current web location is http://groups.google.com/group/python-dbase.
My apologies for the extremely bare-bones web site.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
make this work.
regards
Steve
--> class tester(object):
... @property
... def pi(self):
... return 3.141596
...
--> testee = tester()
--> testee.pi
3.14159598
Looks like that's how property works, so the same behavior on a module
level would do as Brian
w name (pbr) different, in Python, from a new
name initialized as if by assignment (pbv)? It seems to me than you end
up with the same thing in either case (in Python, at least), making the
distinction non-existent.
def func(bar):
bar.pop()
Pass-by-reference:
foo = ['
Steve Holden wrote:
Gabriel Genellina wrote:
En Tue, 24 Feb 2009 22:52:20 -0200, Ethan Furman
escribió:
Steve Holden wrote:
Brian Allen Vanderburg II wrote:
One idea to make constants possible would be to extend properties to be
able to exist at the module level as well as the class
paper... should rows wrap at 80 columns, etc, etc. My
quick (dare I say lazy? ;) ) perusal of the links did not reveal those
behavior traits to me.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
groups.google.com/group/python-dbase
At this point, the only data types allowed to be Null are dates and
times, everything else is coerced to Pythons idea of nothing if not set
(strings are '', numerics are 0, etc -- again, the only exception being
dates and times which, IIRC, defaul
Greetings!
I'm hoping to be able to generate pdf files on the fly -- are there any
python modules out there to do that?
All help appreciated!
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
Gary Herron wrote:
Ethan Furman wrote:
Greetings!
I'm hoping to be able to generate pdf files on the fly -- are there
any python modules out there to do that?
All help appreciated!
--
Ethan
--
http://mail.pytho
Gabriel Genellina wrote:
En Mon, 05 May 2008 15:56:26 -0300, Ethan Furman <[EMAIL PROTECTED]> escribió:
I tried adding a form to our website for uploading large files.
Personally, I dislike the forms that tell you you did something wrong
and make you re-enter *all* your data aga
iterate.
Until Python 3.0, where 'range' returns an iterable.
Is there a thread somewhere of the discussion for this change? I'm
presuming range is used almost exclusively in loops where a change in
the return type would have no negative effect.
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel Genellina wrote:
En Wed, 14 May 2008 13:51:40 -0300, Ethan Furman
<[EMAIL PROTECTED]> escribió:
Gabriel Genellina wrote:
En Mon, 05 May 2008 15:56:26 -0300, Ethan Furman
<[EMAIL PROTECTED]> escribió:
I tried adding a form to our website for uploading large files
3
Record length: 24
--Fields--
name C(10)
age N(3.0)
wisdom M(10)
>>> table.Append()
>>> table.name = 'Ethan'
>>> table.age = 37
>>> table.wisdom = 'Python rules!'
>>> table.Scatter()
{'age': 3
o I needed :).
Hope this helps.
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
chine, and four
bytes on the next. Can any C programmers verify this? If it is true,
does that mean that struct.pack('h', 8001) might give me different
results depending on the machine it's running on?
Thanks for any help!
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
Robert Kern wrote:
Ethan Furman wrote:
Greetings,
I'm looking at the struct module for binary packing of ints and
floats. The documentation refers to C datatypes. It's been many
years since I looked at C, but I seem to remember that the data type
size
John Machin wrote:
Robert Kern wrote:
Ethan Furman wrote:
Greetings,
I'm looking at the struct module for binary packing of ints and
floats. The documentation refers to C datatypes. It's been many
years since I looked at C, but I seem to remember that the data type
size
;>> len(contents)
381
You still get a list that you can easily use, that has gone through the
csv routines.
Hope this helps.
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
on of a good programmer is someone who can write good code in
a computer language. I would use the word 'versatile' or even
'multi-lingual' to broaden the scope to more than one language.
--
Ethan
P.S.
My apologies, Jerry, for writing back to you directly -- I haven't y
he routines that are to be called, and that constitute
the kernel itself, *is* kernel coding. And as wonderful as Python is,
it is *not* for kernel coding.
Having just looked at Py-PF, it is *managing* the firewall, not
implementing it. Again, not kernel coding.
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
hould be tested to ensure proper results. It's my
understanding that unit testing (a.k.a. PyUnit) is designed for just
such a purpose.
So is this argument simply over *who* should be (unit) testing the
internals? I.e. The fellow that wrote the code library vs. the other
fellow that wants to use the library? Or is it actually, as it seems,
over the internals being tested at all?
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
Hello,
I am testing object identity.
If I do it from the interpreter, I get strange results.
*print [] is []*
*False*
print id([]), id([])
3083942700 3083942700
Why is that? Isn't this an error?
If I test it in a script, all is OK.
#!/usr/bin/python
a =
u only need open them when you want
to read/edit them; the rest of the time, only one line is visible
between the function header and the function. I like Vim. :)
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
e:
return 0
def __str__(self):
s = str(self.value)
if s[0] == '-':
minus = '-'
s = s[1:].zfill(self.scale+1)
else:
minus = ''
s = s.zfill(self.scale+1)
return '%s%
h a class already in existence?
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
own.
http://www.vim.org/
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
TheSaint wrote:
On 00:15, giovedì 12 giugno 2008 Ethan Furman wrote:
I like Vim (Vi Improved)
What about justifying text ?
Do you mean indenting, or wrapping? Vim has excellent indenting
support, and Python files already included that support proper
indenting, syntax coloring, etc.
I
Alexnb wrote:
> Haha, okay well sorry that I was being so stupid, but I get it now
and > I apoligize for causing you all the frustration. But I did get it to
> work finally.
>
--
http://mail.python.org/mailman/listinfo/python-list
TheSaint wrote:
On 01:37, giovedì 12 giugno 2008 Ethan Furman wrote:
Do you mean indenting, or wrapping?
I mean fill the line by increasing spaces between words in order to get a
paragraph aligned both side, left and right on the page.
So if the width is 78 chars it wouldn't have ji
;cmowz.')
'example'
.??? --> --- 'www.example.com'.strip('cmowz.')
'exaple'
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
Ethan Furman wrote:
Greetings.
The strip() method of strings works from both ends towards the middle.
Is there a simple, built-in way to remove several characters from a
string no matter their location? (besides .replace() ;)
For example:
.strip --> 'www.example.com'.strip('
ce to have at least
one floating-point number in the calculation.
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel Genellina wrote:
(This thread is getting way above 1cp...)
What is 1cp?
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
An example would help, too.
Thanks for the feedback.
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
Mark Dickinson wrote:
On Jul 8, 12:12 am, Ethan Furman <[EMAIL PROTECTED]> wrote:
1) Any reason to support the less common operators?
i.e. <<, >>, &, ^, |
No reason to support any of these for a nonintegral
nonbinary type, as far as I can see.
2) What, exact
Terry Reedy wrote:
Ethan Furman wrote:
Anybody have an example of when the unary + actually does something?
Besides the below Decimal example. I'm curious under what circumstances
it would be useful for more than just completeness (although
completeness for it's own sake is impo
read:
folders = ['1', '2', '3']
for x in folders:
print x
filename = 'Folder/%s/myfile.txt' % x
f = open(filename, 'r')
Again, in order for that to work, you *must* have a path/file of
'Folder\1\myfile.txt' existing from the same folder that this code is
running from. This is O/S related, not Python related.
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
bservations about the two test programs I've
described.
Any thoughts? Thanks!
Doug
The solution my team has used is to monitor the file size. If the file
has stopped growing for x amount of time (we use 45 seconds) the file is
done copying. Not elegant, but it works.
--
Ethan
--
http://mail
r
*non-Python* language, get your quotes right.
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
Tim Roberts wrote:
Ethan Furman <[EMAIL PROTECTED]> wrote:
Ben Keshet wrote:
it didn't help. it reads the pathway "as is" (see errors for both
tries). It looks like it had the write pathway the first time, but
could not find it because it searched in the path/way in
Greetings, List!
Still working on my Measure class, and my next question is... (drum roll
please ;)
What are the advantages of using __[eq|ne|lt|gt|le|ge]__ vs __cmp__?
Thanks in advance!
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel Genellina wrote:
En Thu, 10 Jul 2008 17:37:42 -0300, Ethan Furman <[EMAIL PROTECTED]>
escribi�:
Greetings, List!
Still working on my Measure class, and my next question is... (drum
roll please ;)
What are the advantages of using __[eq|ne|lt|gt|le|ge]__ vs __cmp__?
I
Sean DiZazzo wrote:
On Jul 9, 5:34 pm, keith <[EMAIL PROTECTED]> wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Ethan Furman wrote:
writeson wrote:
Guys,
Thanks for your replies, they are helpful. I should have included in
my initial question that I don't have as m
Michiel Overtoom wrote:
Ethan wrote:
One more option may be to attempt to rename
the file -- if it's still open for copying, that will fail;
success indicates the copy is done.
Caveat -- this is dependent on the operating system!
Windows will indeed not allow you to rename or del
inaccury present in the measured value a? Should I have floordiv
preserve inaccuracy, and divmod be exact?
Any and all feedback welcome, particularly from anyone who might
actually use the Measure class. ;)
~Ethan
--
http://mail.python.org/mailman/listinfo/python-list
7;10.25')
--> n10_25
Decimal("10.25")
--> "%d" % n10_25
'10'
About the only thing it had even partially right is not using %d, as it
will truncate the fractional part of your opening balance. As far as
why you are getting that error, I now have no idea, and I apologize for
any confusion created by my error.
~Ethan
--
http://mail.python.org/mailman/listinfo/python-list
d to %f
and change dec to float(dec). My experience with the Decimal type is
limited, so there may be other options as well.
~Ethan
--
http://mail.python.org/mailman/listinfo/python-list
Ken Starks wrote:
Ethan Furman wrote:
Hey all.
As I have mentioned before, I am making this Measure class for two
reasons: experience with unit testing, I like playing with numbers, I
am unaware of anything like this having yet been done (okay, three
reasons ;).
Any and all
f a Real Programmer:
http://www.pbm.com/~lindahl/mel.html
Iain
Wow. Awesome story.
~Ethan
--
http://mail.python.org/mailman/listinfo/python-list
e there is
> no single obvious interpretation of what is means for an object to
> evaluate to true.
If you are using somebody else's code, and maybe even your own, you
should always check the docs if you don't know/can't remember what a
function does.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
ponsible for his (or her) program. An analogy would be
a driver and a car -- if the driver cannot handle the power and speed of
a fancy car (python :), then the driver should get a different car
better matched to his abilities. It's not up to the car to say "oh, the
speed lim
move the conversation
along. In fact, somebody did post some code about a custom matrix
class, where __len__ was useless, and still you kept on with... pah.
It's late, so before I say something stupid I'll finish this. My last
thought on the matter -- up until this thread I had l
Carl Banks wrote:
On Jul 30, 4:49 am, Ethan Furman <[EMAIL PROTECTED]> wrote:
Even for those that did realize, and in fact hoped that that is what you
were attempting to accomplish,
I was not attempting to accomplish what you think I was.
I was looking for it, but I didn't want to
convert it to actual Python. Would be
an interesting experiment, anyway.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Anders J. Munch wrote:
Ethan Furman wrote:
> Even if we find out that C.__nonzero__ is called, what was it that
> __nonzero__ did again?
reinforce the impression that he is unaware of the double-underscore
functions and what they do and how they work.
Only if your news
imals were really immutable, that should not have worked -- so in
what sense are they immutable? Does Python treat them as immutable if
they are created with __new__ instead of __init__?
Any pointers to appropriate docs also greatly appreciated.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Emile van Sebille wrote:
Ethan Furman wrote:
--> d25._int = (1, 5)
Python considers names that start with a leading underscore as internal
or private, and that abuse is the burden of the abuser...
Is bytecodehacks still around? That was serious abuse :)
Emile
Good point. What
Calvin Spealman wrote:
[snip]
ask if you really feel the need to know.
I am. ;)
--
http://mail.python.org/mailman/listinfo/python-list
doubt, try doing :retab as well -- it takes any tab characters
in the file and converts them to spaces. Very handy.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
ndentationError exceptions to be raised.
I have Emacs configured to show tabs as 4 columns wide, and I've never had
such an exception happen in my Python code as a result.
I have no Emacs experience -- does it actually put tabs in the file, or
spaces?
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Mel wrote:
Ethan Furman wrote:
Emile van Sebille wrote:
Ethan Furman wrote:
--> d25._int = (1, 5)
Python considers names that start with a leading underscore as internal
or private, and that abuse is the burden of the abuser...
Is bytecodehacks still around? That was serious ab
Rhamphoryncus wrote:
On Aug 4, 11:46 am, Ethan Furman <[EMAIL PROTECTED]> wrote:
Mel wrote:
Ethan Furman wrote:
Emile van Sebille wrote:
Ethan Furman wrote:
--> d25._int = (1, 5)
Python considers names that start with a leading underscore as internal
or private, and t
ask_number()
print "You guessed it! The number was", the_number
print "And it only took you", tries, "tries!\n"
raw_input("\n\nPress the enter key to exit.")
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
entered data is good. However, the first time the form loads it can
take up to 30 seconds... any ideas why?
My server is using Apache 2.0.53 and Python 2.4.1 on a FreeBSD 5.4 system.
Thanks!
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
os.O_EXCL flag?
Thanks for any help.
--
Ethan
--
http://mail.python.org/mailman/listinfo/python-list
link to it there.
So why not put symlink to Python over there on all machines, if we can
put one (or env itself) there ?
A symlink directly to python (or whatever) would not help when testing
version x.y.z, while still leaving version a.b.c in place for the other
tools/scripts/programs to keep
tions?
Thanks
> Hm,
>
>
> It seems my previous reply got lost.
>
>
> if a*b > 0:
> print "same sign"
> else
> print "different sign"
>
>
Looks good at first, but -5 * 0 == +7 * 0.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
either since the
-- *case of the keys is actually valuable* ***later on***. It's only for
-- the purposes of this specific comparison operation that the case
-- should be ignored.
In other words, the key (as a key) is case-insensitive, and the key (as
a value) is case-sensitive -- making Clifford's comments and solution
perfectly acceptable.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
#x27;: None,
'__getattribute__': None, '__iter__': None, 'readline': None,
'fileno': None, 'writelines': None, 'tell': None, '__delattr__': None,
'__repr__': None, '__hash__': None}
Testing: 1, 2, 3...
I tried the code (on Windows, so had to change /dev/stdout to
/temp/notafile.txt) and it worked just fine. Perhaps the issue is that
n is being set to /dev/stdout instead of some other file so no
difference is apparent?
In other words, you're assigning stdout to stdout.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
decent OO language should* ." [emphasis added]
Just to be clear.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
same folder I'm running setup.py
from, into my home folder (USERPROFILE, I think) -- and the really
frustrating part is that it worked a couple times (but maybe that was
from my home computer) but mostly it does not.
Any and all pointers gratefully accepted!
~Ethan~
--
http://mail.
Philip Semanchuk wrote:
On Dec 14, 2009, at 12:04 PM, Ethan Furman wrote:
Greetings!
I'm using Python 2.5 on Windows XP, and trying to get the upload
portion of setup.py to work. According to what I have found, I can
put my info into a .pypirc file to have the process pick
Philip Semanchuk wrote:
On Dec 14, 2009, at 1:00 PM, Ethan Furman wrote:
Philip Semanchuk wrote:
On Dec 14, 2009, at 12:04 PM, Ethan Furman wrote:
Greetings!
I'm using Python 2.5 on Windows XP, and trying to get the upload
portion of setup.py to work. According to what I have
down what they gave you into something usable.
To rephrase, the issue that Shawn is referring to is the huge amount of
data *already out there*, not brand new data.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
ery well end up in the rocks.
To sum up: I agree with your "poor programmer" line of reasoning in the
second paragraph above, but not with the "tools influencing the way we
think" line of reasoning -- while I am cognizant of Python's
shortcomings, I am very much enj
>
> Python is great for alot of things but it's not perfect for anything.
>
s/anything/everything/
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
appreciated!
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Anthra Norell wrote:
> I consider the encryption unbreakable [...] (from previous thread)
I am not a cryptographer. (from this thread)
Then you shouldn't be making claims about your encryption algorithms.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
d you want to make sure you don't mail twice to the same person?
yes. We have one customer who gives us *everything* they have -- about
20,000 records, and after the duplicate purge process they mail to about
3,000. In other cases we'll be combining different data sets from the
same customer, and again we don't want duplicate mailings.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Lie Ryan wrote:
On 01/14/10 05:33, Albert van der Horst wrote:
(I encountered this before. A dictionary is a natural for a
boardgame position, i.e. chess. Now we want to look up chess
positions.)
or use collections.namedtuple
Which is great until you want to make a move. ;)
~Ethan
I'll start by
going over that again, and we'll see how confident I feel afterwards. ;)
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
h is fine. Instead of waiting for the (hundreds
of?) posts wondering why making a FIFO queue from a list is so slow, and
what's wrong with Python, etc, etc, it points out up front that yes you
can, and here's why you don't want to. This does not strike me as too
much knowledge.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
incompatibility (which surely
exists) between 2.6 and 3.x he/she has to look elsewhere.
Cheers,
Daniel
I think what Andre is saying is that you can't get 2.x behavior in 3.x,
only the other way 'round.
In the integer division instance, the 2.x behavior of 6/5 = 1 is not
going to happen in 3.x.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
4. Python 3 will make you irresistible to women.
FALSE
What?!? Drat!!! Guess I'll have to learn Lisp... ;)
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
in 5.2.1 Identifiers
Hope this helps!
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
mes:
for var in new_names:
item = new_names[var]
do_something_with(item)
Hope this helps!
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
ce
the quotes around line42.
Good luck! Python is a fine language, I hope you like it.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
board)
O | O | O
X | O | O
O | O | O
You might not want to start out with 'O' already being everywhere,
though. ;-)
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
print i
...: if i == 1:
...: break
...: else:
...: print i
...:
0
1
Hope this helps!
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
it is, it's one he's contemplating giving his students. :-D
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
associated with form
field name. The method returns an empty list if no such form field or
value exists for name. It returns a list consisting of one item if only
one such value exists.
Hope this helps.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
es of such failing code.
My google search was fruitless (although still educational !-), so if
anyone could point me in the right direction I would greatly appreciate it.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
of return names to match
the unpacking you'll get the normal errors from that.
Hope this helps!
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
Ethan Furman writes:
some_list = [1, 2]
this, that = func(alist)
At least, in 2.5.4 this works. :-)
But that fails if there are fewer than two elements in the list. It's
better to just make the logic either expect a list, or if it's
implementing somethi
Thanks to all for the answers!
:)
--
http://mail.python.org/mailman/listinfo/python-list
wt-0.7.2-py2.5-win32.egg.tmp\xlwt\Workbook.py",
line 615, in get_biff_data
IndexError: list index out of range
-->
Anyone know why that is?
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
1401 - 1500 of 1941 matches
Mail list logo