he reduce-lambda expressions are a lot harder
to read than a properly named function.
And a function will often work faster than the reduce-lambda version as
well.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
# error
10 while undefined==None:
Possible loop till defined behavior.
Ok... and undefined var returning None is a bad idea, but using None to
del names could still work. And (undefined==None) could be a special
case for checking if a variable is defined. Otherwise using an
undefined name should give an error as it currently does.
Cheers,
Ron
> Regards,
> Dan
--
http://mail.python.org/mailman/listinfo/python-list
Scott David Daniels wrote:
> Ron Adam wrote:
>
>> Dan Sommers wrote:
>>
>>> Lots more hard-to-find errors from code like this:
>>> filehandle = open( 'somefile' )
>>> do_something_with_an_open_file( file_handle )
>>> fil
Ron Adam wrote:
> And accessing an undefined name returned None instead of a NameError?
I retract this. ;-)
It's not a good idea. But assigning to None as a way to unbind a name
may still be an option.
--
http://mail.python.org/mailman/listinfo/python-list
Stian Søiland wrote:
> On 2005-07-06 16:33:47, Ron Adam wrote:
>
>
>>*No more NamesError exceptions!
>> print value
>> >> None
>
>
> So you could do lot's of funny things like:
>
> def my_fun(extra_args=None):
>
Reinhold Birkenfeld wrote:
> Ron Adam wrote:
>
>>Ron Adam wrote:
>>
>>
>>>And accessing an undefined name returned None instead of a NameError?
>>
>>I retract this. ;-)
>>
>>It's not a good idea. But assigning to None as a way
Benji York wrote:
> Ron Adam wrote:
>
>> "if extraargs:" would evaluate to "if None:", which would evaluate to
>> "if:" which would give you an error.
>
>
> In what way is "if None:" equivalent to "if:"?
> --
>
Grant Edwards wrote:
> On 2005-07-06, Ron Adam <[EMAIL PROTECTED]> wrote:
>
>
>>It would be a way to set an argument as being optional without actually
>>assigning a value to it. The conflict would be if there where a global
>>with the name baz as well. Pro
d just
barely winning out in the very deep catagory. But they're all
respectable times so everyone wins. ;-)
And here's the source code.
Cheers, :-)
Ron
# ---
import sys
import time
TIMERS = {"win32": time.clock}
timer = TIMERS.get(sy
Grant Edwards wrote:
> On 2005-07-07, Ron Adam <[EMAIL PROTECTED]> wrote:
>
>>Grant Edwards wrote:
>>
>>
>>>On 2005-07-06, Ron Adam <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>
>>>>It would be a way to set an argument
Mike Meyer wrote:
> Ron Adam <[EMAIL PROTECTED]> writes:
>
>>So doing this would give an error for functions that require an argument.
>>
>> def foo(x):
>> return x
>>
>> a = None
>> b = foo(a)# error because a dissap
Reinhold Birkenfeld wrote:
> Ron Adam wrote:
>
>
>>Given the statement:
>>
>>a = None
>>
>>And the following are all true:
>>
>> a == None
>
>
> Okay.
>
>
>>(a) == (None)
>
>
> Okay.
>
>
>>(a) =
#x27;))
def func_x(x): return someother_func_x(x,'value')
There's both nearly identical, but the def is understandable to
beginners and advanced python programs.
Cheers,
Ron
> Am I just weird?
Aren't we all? ;-)
--
http://mail.python.org/mailman/listinfo/python-list
Grant Edwards wrote:
> On 2005-07-07, Ron Adam <[EMAIL PROTECTED]> wrote:
>>>>>>It would be a way to set an argument as being optional without
>>>>>>actually assigning a value to it.
>>
>>So it would still work like you expect even tho
Steven D'Aprano wrote:
> Ron Adam wrote:
>
>> Why would you want to use None as an integer value?
>>
>> If a value isn't established yet, then do you need the name defined?
>> Wouldn't it be better to wait until you need the name then give it a
>
[list_comp] is a nice
distinction. Maybe a {dictionary_comp} would make it a complete set. ;-)
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Erik Max Francis wrote:
> Ron Adam wrote:
>
>> It's not an empty tuple, it's an empty parenthesis. Using tuples it
>> would be.
>>
>> (a,) == (,)
>>
>> which would be the same as:
>>
>> (,) == (,)
>
>
> &
Erik Max Francis wrote:
> Ron Adam wrote:
>
>> Well in my previous explanation I *mean* it to be empty parenthesis.
>>
>> Does that help?
>
>
> Maybe it might be beneficial to learn a little more of the language
> before proposing such wide-reaching
Steven D'Aprano wrote:
> Ron Adam wrote:
>> def count_records(record_obj, start=0, end=len(record_obj)):
>
>
> That would work really well, except that it doesn't work at all.
Yep, and I have to stop trying to post on too little sleep.
Ok, how about... ?
as a serious idea quite a while ago and said so in
several posts.
From two days ago... in this same thread ... I said.
>>Yes, I agree using None as an alternative to delete currently is
>>unacceptable.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
r than "if
True/ if False" expressions.
But the actual different is so small as to be negligible. I'm just kind
of curious why testing is objects isn't just as fast as testing is string?
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
st()
>
> list('a','b','c')
"abc".splitchrs()
There's already a str.split() to create a list of words,
and a str.splitline() to get a list of lines, so it would group related
methods together.
I don't thin adding sting methods to lists is a good idea.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
2,3]
mylist(*"abc") -> ['a','b','c']
mylist(1,2,3) -> [1,2,3]
mylist([1],[2]) -> [[1],[2]]
mylist('hello','world') -> ['hello','world']
Works for me. ;-)
I always thought list([1,2,3]) -> [1,2,3] was kind of silly.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Scott David Daniels wrote:
> Ron Adam wrote:
>
>> George Sakkis wrote:
>>
>>> I get:
>>>
>>> None: 0.54952316
>>> String: 0.498000144958
>>> is None: 0.45047684
>>
>>
>>
>> What do yo get for "na
concepts that have been floating around into one tool.
I like the place holders because I think they make the code much more
explicit and they are more flexible because you can put them where you
need them.
> orthogonal-musing-ly ;-)
"Orthogonal is an unusual computer language in which your program flow
can go sideways. In actuality in can go in just about any direction you
could want."
http://www.muppetlabs.com/~breadbox/orth/
;-)
Cheers,
Ron
> Regards,
> Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
Reinhold Birkenfeld wrote:
> Ron Adam wrote:
>
>
>>>>>> 'abc' is 'abcd'[:3]
>>>False
>>
>>Well of course it will be false... your testing two different strings!
>>And the resulting slice creates a third.
>&g
mputers, some of
them may be fairly old. It might be worth slowing your computer down
and then optimizing the parts that need it.
When it's run on faster computers, those optimizations would be a bonus.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Bengt Richter wrote:
> On Sun, 10 Jul 2005 05:35:01 GMT, Ron Adam <[EMAIL PROTECTED]> wrote:
>>So far they are fairly equivalent. So there's not really any advantage
>>over the equivalent inline function. But I think I see what you are
>>going towards. Decora
:
yell_for_help()
else:
leave()
else:
leave()
Interesting idea, but I think it might make reading other peoples code
more difficult.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Overall it's about 10 times slower than pythons built in sort for large
lists, but that's better than expected considering it's written in
python and not C.
Cheers,
Ron
# Quick Sort
def qsort(x):
if len(x)<2:
return x# Nothing to sort.
',) # trailing comma is needed here.
# This is an error opportunity IMO
Choice of symbols aside, packing and unpacking are a very big part of
Python, it just seems (to me) like having an explicit way to express it
might be a good thing.
It doesn't do anything that can't already be done, of course. I think
it might make some code easier to read, and possibly avoid some errors.
Would there be any (other) advantages to it beside the syntax sugar?
Is it a horrible idea for some unknown reason I'm not seeing. (Other
than the symbol choices breaking current code. Maybe other symbols
would work just as well?)
Regards,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Kay Schluehr wrote:
>
> Ron Adam wrote:
>
>>Kay Schluehr wrote:
>>On a more general note, I think a constrained sort algorithm is a good
>>idea and may have more general uses as well.
>>
>>Something I was thinking of is a sort where instead of giving a
Raymond Hettinger wrote:
> [Ron Adam]
>
>>Currently we can implicitly unpack a tuple or list by using an
>>assignment. How is that any different than passing arguments to a
>>function? Does it use a different mechanism?
>
>
> It is the same mechanism, so it
7;m tried to reinvent the
wheel yet again.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
eeds some better logic to merge adjacent like groups. I
think the reverse sorting my be a side effect of the nesting that takes
place when the expressions are built.
Having the digits first might be an advantage as you can use a for loop
to add or multiply them until you get to a not digit.
Anyway, interesting stuff. ;-)
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Kay Schluehr wrote:
> Hi Ron,
>
> I really don't want to discourage you in doing your own CAS but the
> stuff I'm working on is already a bit more advanced than my
> mono-operational multiplicative algebra ;)
I figured it was, but you offered a puzzle:
"Here
Kay Schluehr wrote:
> Ron Adam wrote:
>
>> Kay Schluehr wrote:
>> BTW.. Usually when people say "I don't want to discourage...", They
>> really want or mean the exact oppisite.
>
> Yes, but taken some renitence into account they will provoke the
&g
o be:
>
>scripts = userfolder.joinpath(scriptfolder)
>scriptpath = scripts.joinpath(self.config['system']['commandfile'])
>
> Even so I'm only +0 on it.
>
> -Peter
I think the '+' is used as a join for both strings and lists, so i
ct or modify the original?
p = path('C://somedir//somefile')
p+='.zip' what would this do?
p[-1]+='.zip' Or this?
Cheer's Ron.
--
http://mail.python.org/mailman/listinfo/python-list
Michael Hoffman wrote:
> Ron Adam wrote:
>
>> In all current cases, (that I know of), of differing types, '+' raises
>> an error.
>
>
> Not quite:
>
> >>> "hello " + u"world"
> u'hello world'
> >>
Peter Hansen wrote:
> Ron Adam wrote:
>
>> Michael Hoffman wrote:
>>
>>> Ron Adam wrote:
>>>
>>>> In all current cases, (that I know of), of differing types, '+'
>>>> raises an error.
>>>
>>>
>>>
rials and
books might be best for newbies to Python, depending on their
background. It can be reached at
http://www.awaretek.com/python/index.html
Ron
--
http://mail.python.org/mailman/listinfo/python-list
en done.
apath.close()
etc...
With this you can iterate a file system as well as it's files. ;-)
(Add more or less methods as needed of course.)
apath = device(dev_obj).path(some_path_sting)
apath.open().write(data).close()
or if you like...
device(dev_obj).append(path_sting).open().write(data).close()
Just a few thoughts,
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
;/' will be considered a wart by many and
a boon by others. If I'm right, there will be endless discussions over
it if it's implemented. I'd rather not see that, so I'm still -1
concerning '/' for that reason among others.
Cheers,
Ron
PS. Could someone repost
x27;b')
item = D_tree[path]
or
item = D_tree[Path('a','b')]
That would be in place of..
item = D[path[0]][path[1]] -> item = D['a']['b']
This give a more general purpose for path objects. Working out ways to
retriev
Brian Beck wrote:
> Ron Adam wrote:
>
>> This give a more general purpose for path objects. Working out ways
>> to retrieve path objects from a dictionary_tree also would be useful I
>> think. I think a Tree class would also be a useful addition as well.
>>
>
t all if anyone posted
improvements. (hint hint) ;-)
Cheers,
Ron Adam
+ output --
Define paths:
path1 = ['hello', 'world']
path2 = ['hello', 'there', 'world']
path3 = ['hello', 'there', 'wide',
n None. So you don't
need to return 'no'.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
uld just increment a reference counter, and it wouldn't be
removed from shared until it reaches zero again.
Using 'share' twice with the same name in the same function should cause
an error. Using 'shared' with a name that is not in shared name space
would cause an error.
Just a few thoughts.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
r is it just me?
I use copy.deepcopy() sometimes, and more often [:] with lists.
Dictionary objects have a copy method. All non mutable objects are copies.
I too have wondered why copy isn't a builtin, and yet some builtin
objects do make copies.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
in a module you
wouldn't be able to access any builtin functions or class's without
declaring them as global (or importing them) in every function or class
that uses them.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
he alternative would be to use a flag and shallow copies in all the
methods that altered the object. copy.deepcopy() was a lot easier as
it's only needed in the method that initiates the result calculation.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
there may be a lot of differing opinions on just what those
minimum Python programs should be. But that is where the PEP process
comes in.
Regards,
Ron
> Regards,
> Martin
--
http://mail.python.org/mailman/listinfo/python-list
Martin v. Löwis wrote:
> Ron Adam wrote:
>
>>I would put the starting minimum boundary as:
>>
>> 1. "The minimum required to start the python interpreter with no
>>additional required files."
>>
>>Currently python 2.4 (on windows) does not
In article <[EMAIL PROTECTED]>,
Benji York <[EMAIL PROTECTED]> wrote:
> Peter Maas wrote:
> > >>> suffix = 'var'
> > >>> vars()['a%s' % suffix] = 45
> > >>> avar
> > 45
>
> Quoting from http://docs.python.org/lib/built-in-funcs.html#l2h-76 about
> the "vars" built in:
>
> The returned dicti
In article <[EMAIL PROTECTED]>,
Robert Kern <[EMAIL PROTECTED]> wrote:
> In the
> bowels of my modules, I may not know what the contents are at code-time,
Then how do you write your code?
rg
--
http://mail.python.org/mailman/listinfo/python-list
In article <[EMAIL PROTECTED]>,
Steve Holden <[EMAIL PROTECTED]> wrote:
> rafi wrote:
> > Reinhold Birkenfeld wrote:
> >
> >
> exec(eval("'a%s=%s' % (count, value)"))
> >>>
> >>>why using the eval?
> >>>
> >>>exec ('a%s=%s' % (count, value))
> >>>
> >>>should be fine
> >>
> >>And this demo
m a single exe
file that's very professional. Most users won't need to know or care
what language you developed your application with as long as it works.
Hope that helps,
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
t; -1, but about an easy way to get the last value.
>
> But I like your idea. I just think there should be two differnt ways
> to index. maybe use braces in one case.
>
> seq{i} would be pure indexing, that throws exceptions if you
> are out of bound
>
> seq[i
Fredrik Lundh wrote:
> Ron Adam wrote:
>
>
>>The problem with negative index's are that positive index's are zero
>>based, but negative index's are 1 based. Which leads to a non
>>symmetrical situations.
>
>
> indices point to the "gap&q
Terry Reedy wrote:
> "Ron Adam" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
>>Fredrik Lundh wrote:
>>
>>>Ron Adam wrote:
>>>
>>>>The problem with negative index's are that positive index'
Terry Reedy wrote:
>>b[-1:] = ['Z']# replaces last item
>>b[-1:-0] = ['Z'] # this doesn't work
>>
>>If you are using negative index slices, you need to check for end
>>conditions because you can't address the end of the slice in a
>>sequential/numerical way.
>
> OK, now I understand
Bengt Richter wrote:
> IMO the problem is that the index sign is doing two jobs, which for zero-based
> reverse indexing have to be separate: i.e., to show direction _and_ a _signed_
> offset which needs to be realtive to the direction and base position.
Yes, that's definitely part of it.
> A l
y, it would be nice to get
a few opinions at this point. So blast away... or hopefully tell me
what you like about it instead. ;-)
(Any suggestions or contributions to make it better would be appreciated.)
Cheers,
Ron Adam
"""
IMPROVED SLICING
Slicing is one
Terry Reedy wrote:
> "Ron Adam" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
>>Slicing is one of the best features of Python in my opinion, but
>>when you try to use negative index's and or negative step increments
>>it can be
fear you might need a similar helper function for
> similar issues with your change. I just don't know what those are
> without more thought.
>
> Regards,
> Pat
Thanks for the feedback, it was helpful.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Scott David Daniels wrote:
> Magnus Lycka wrote:
>
>> Ron Adam wrote:
>>
>>> ONES BASED NEGATIVE INDEXING
>
>
> I think Ron's idea is taking off from my observation that if one's
> complement, rather than negation, was used to specify measure
m right
The symmetry is easier to see when using the '~' values.
LL=list(range(10))
Lx=nxlist(range(10))
LL[ 1: 2]==[LL[ 1]]==[1]
Lx[~2:~1]==[Lx[~1]]==[8]
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Magnus Lycka wrote:
> Ron Adam wrote:
>
>> Slicing is one of the best features of Python in my opinion, but
>> when you try to use negative index's and or negative step increments
>> it can be tricky and lead to unexpected results.
>
>
> Hm... Just as w
selection of negative strides to be
fixed if possible. If you could explain the current reason why it does
not return the reverse order of the selected range. I would appreciated it.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
) however would require a lot of small changes in index's.
Mostly changing.. L[:-1] to L[:~1] or to L[:-2]. So no, I don't expect
one's based indexing to be added any time soon. It could be useful as a
function or object in it's own.
> "Professor Einstein, could you tell our readers how general relativity
> works?"
Actually I can, but it would be off topic for this news group.
Cheers,
Ron
> regards
> Steve
--
http://mail.python.org/mailman/listinfo/python-list
slice of a slice object
r.range_sub(d,3) # subtract 3 from items in range d
Or more flexible ...
r.range_modify(d, add(), 5)
Using your suggestion that would be...
r = range(100)
d = [10:10]
r.range_add(d,5)
d = d[5:] -> [15:5] # interesting symmetry.
r.range_sub(d,3)
Of course adding and subtracting slice objects could also be possible.
d = [10:20]
e = [15:25]
f = d + e-> [10:25]
or ...
d = [10:10]
e = [15:10]
f = d + e-> [10:15]
Cheers,
Ron
> Regards,
> Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
Terry Reedy wrote:
>>Ron Adam wrote:
>>
>>
>>>However, I would like the inverse selection of negative strides to be
>>>fixed if possible. If you could explain the current reason why it does
>>>not return the reverse order of the selected ra
Patrick Maupin wrote:
> I previously wrote (in response to a query from Ron Adam):
>
>
>>In any case, you asked for a rationale. I'll give you mine:
>>
>>
>>>>>L = range(10)
>>>>>L[3:len(L):-1] == [L[i] for i in range(3,len(L),-1)]
Steve Holden wrote:
> Ron Adam wrote:
>
>> Steve Holden wrote:
>>
>> What misconception do you think I have?
>>
> This was not an ad hominem attack but a commentary on many attempts to
> "improve" the language.
Ok, No problem. ;-)
>> No o
Patrick Maupin wrote:
> Ron Adam wrote:
>
>
>>>This should never fail with an assertion error. You will note that it
>>>shows that, for non-negative start and end values, slicing behavior is
>>>_exactly_ like extended range behavior.
>
>
>>Yes,
Magnus Lycka wrote:
> Ron Adam wrote:
>
>> Ok, lets see... This shows the problem with using the gap indexing
>> model.
>>
>> L = range(10)
>>
>> [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] # elements
>> 0 1 2 3 4 5 6 7 8 9
x27;ll deal with the subsetting another time ...
No hurry, this isn't a hack it out because "the boss wants it on his
desk Monday" situation. ;-)
> Regards,
> Bengt Richter
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Michael Hudson wrote:
> Ron Adam <[EMAIL PROTECTED]> writes:
>>With current slicing and a negative step...
>>
>>[ 1 2 3 4 5 6 7 8 9 ]
>> -9 -8 -7 -6 -5 -4 -3 -2 -1 -0
>>
>>r[-3:] -> [7, 8, 9]# as expected
>&
and get another randomly generated
password.
Or am I missing something?
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
James Stroud wrote:
> On Saturday 10 September 2005 15:02, Ron Adam wrote:
>
>>Kirk Job Sluder wrote:
>>I would think that any n digit random number not already in the data
>>base would work for an id along with a randomly generated password that
>>the student
Kirk Job Sluder wrote:
> Ron Adam <[EMAIL PROTECTED]> writes:
>>I would think that any n digit random number not already in the data
>>base would work for an id along with a randomly generated password
>>that the student can change if they want. The service provid
ferent
versions of a program on several different platforms simultaneously and
use only the results that have a majority agreement.
Or to put it another way; risk management by ... "keep it simple",
"don't have too many cooks", "get second opinions", and "don't put all
your eggs in one basket".
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
reused on successive calls, but then I realized that it's nearly
identical to a loop in that context, so why not just write it as a loop
to start with.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I'm developing a piece of software to assist illiteraate adults to learn to
read. I'm trying to figure out how, if possible, to make audio playback
asynchrnous but still controllable. I'm using python 2.4 with pymedia on
XP. I started out with the example in the tutorials section of t
EndOfBlock, self.last
Cheers,
Ron
C:\Python24\Lib>diff.py inspect.py inspect_.py
*** inspect.py Tue Mar 15 13:22:02 2005
--- inspect_.py Mon Sep 19 14:26:26 2005
***
*** 531,536
--- 531,538
raise EndOfBlock, self.last
elif type == tokenize.NAME
Delaney, Timothy (Tim) wrote:
> Ron Adam wrote:
>
>
>>While playing around with the inspect module I found that the
>>Blockfinder doesn't recognize single line function definitions.
>>
>>Adding the following two lines to it fixes it, but I'm not sur
rue, but not equal.
bool(1 and 2) == bool(2 and 1)
(1 and 2) * value != (2 and 1) * value
# except if value is False.
bool(1 and 2) * value == bool(2 and 1) * value
So..
bool(a and b) * value
Would return value or zero, which is usually what I want when I do this
type of expression.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
projectname2 <- next version...
... # copy the previous version to start.
...
Below is my basic py2exe script. You'll need to change it to suite your
own needs of course. The rmtree is my own module to remove directories
and contents. The newest version of
on bools to bools first. But it would be easier IMO if bool
operations gave bool results so I wouldn't need to do:
bool_result = a and bool(b)
or
bool_result = bool(a and b)
On one hand these seem like little things, but little things is
sometimes what will bite you the hardest as they are more likely to get
by your guard.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
ra, the simplest one. Strictly
> speaking, Booleans aren't limited to two values. See
> http://en.wikipedia.org/wiki/Boolean_algebra for more detail.
I look at those earlier and was surprised at how complex some Boolean
algebra concepts were. Interesting though, and I'll probably go back
and study it a bit more.
> Python's bools aren't Booleans. They are merely aliases for 0 and 1.
Yes, and according to the PEP they were introduced to help reduce
errors. ;-)
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
extensions) is definitely not the answer.
Personally I think hidden files do more harm than good. It's not a
substitute for good file management, and it not an acceptable
alternative to good security either.
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
ke RISC OS (it may not have pygame but
> it definitely has python). Surely this is something that's crying out
> for an official function in os or sys.
This works on Win XP. Not sure if it will work on Linux.
import os
parent = os.path.split(os.path.abspath(os.sys.argv[0]))[0]
file =
Steve Holden wrote:
> Ron Adam wrote:
>>
>> 2. Expressions that will be used in a calculation or another
>> expression.
>>
> By which you appear to mean "expressions in which Boolean values are
> used as numbers".
Or compared to other types, wh
Steve Holden wrote:
> Ron Adam wrote:
>
>> Tony Houghton wrote:
>>
>>> I'm using pygame to write a game called Bombz which needs to save some
>>> data in a directory associated with it. In Unix/Linux I'd probably use
>>> "~/.bomb
e would be as you suggested, but maybe
doing it this way would be better.
import os
user = os.path.join( os.environ["USERPROFILE"],
'Application Data',
'Bombz' )
Cheers,
Ron
--
http://mail.python.org/mailman/listinfo/python-list
In article <[EMAIL PROTECTED]>,
Thomas Guettler <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Is there a way to import a file without creating
> a .pyc file?
>
> Of course you can delete the pyc in my script after
> the import statement, but maybe there is a switch
> that I have not found yet.
>
> The
In article <[EMAIL PROTECTED]>,
Leif K-Brooks <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Why doesn't this work?
> >
> >
> def foo(lst):
> >
> > ... class baz(object):
> > ... def __getitem__(cls, idx): return cls.lst[idx]
> > ... __getitem__=classmethod(__getitem__
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Bengt Richter) wrote:
> On 14 Mar 2005 17:43:53 -0800, [EMAIL PROTECTED] wrote:
>
> >
> >Why doesn't this work?
> >
> def foo(lst):
> >... class baz(object):
> >... def __getitem__(cls, idx): return cls.lst[idx]
> >... __getitem__
In article <[EMAIL PROTECTED]>,
Ron Garret <[EMAIL PROTECTED]> wrote:
Wow, this is really cool:
> What I'm really trying to do is to create enumerated types...
And the code I ended up with is:
# Inheriting from type, not object, is the key:
class enum_metaclass(type):
201 - 300 of 772 matches
Mail list logo