ved in
the innermost enclosing function scope. If a class definition
occurs in a chain of nested scopes, the resolution process skips
class definitions. This rule prevents odd interactions between
class attributes and local variable access."""
Mark
--
http://mail.python.org/mailman/listinfo/python-list
rom a
parametrization by an interval.
> Then the second definition you cite: Amazon says the
> prerequisites are two years of calculus. The stanard
> meaning of log is log base e, even though means
> log base 10 in calculus.
Sorry, I've lost context for this comment. Why
are logs relevant? (I'm very well aware of the
debates over the meaning of log, having frequently
had to help students 'unlearn' their "log=log10"
mindset when starting a first post-calculus course).
Mark
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 17, 12:52 pm, Mark Dickinson wrote:
> g_n(t) = nt if 0 <= t <= 1/n else 1
Whoops. Wrong definition. That should be:
g_n(t) = nt if 0 <= t <= 1/n else
n(2/n-t) if 1/n <= t <= 2/n else 0
Then my claim that g_n(t) -> 0 for all t might
actuall
can find a better place to have this
discussion; I think there are still plenty of interesting
things to say, but I fear we're rather abusing the hospitality
of comp.lang.python at the moment.
I'd suggest moving it to sci.math, except that I've seen the
noise/signal ra
"aberry" wrote in message
news:[email protected]...
I am facing an error on Unicode decoding of path if it contain a
folder/file
name starting with character 'u' .
Here is what I did in IDLE
1. >>> fp = "C:\\ab\\anil"
2. >>> unicode(fp, "unicode_escape")
3. u'C:\x07b\x07nil'
4.
roblems,
like claiming that 0**0 is undefined while
infinity**0 is 1.)
[*] A notable exception is Michael Spivak's 'Calculus', which also
happens to be the book I learnt calculus from many years ago.
Mark
--
http://mail.python.org/mailman/listinfo/python-list
"aberry" wrote in message
news:[email protected]...
Mark Tolonen-3 wrote:
"aberry" wrote in message
news:[email protected]...
I am facing an error on Unicode decoding of path if it contain a
folder/file
name starting with character 'u'
On Jun 24, 10:12 am, pdpi wrote:
> Regarding inf ** 0, why does IEEE745 define it as 1, when there is a
> perfectly fine NaN value?
Have a look at:
http://www.eecs.berkeley.edu/~wkahan/ieee754status/ieee754.ps
(see particularly page 9).
Mark
--
http://mail.python.org/mailman/listinfo/
y and positive real x, and in this context one can
make a good argument that 0**0 should be undefined; but
at the same time it's also used in contexts where y is
naturally thought of as an integer; and in the latter
context bad things happen if you don't define pow(0, 0)
to b
default system encoding to encode the Unicode strings
into a file. On Windows, the filesystem uses Unicode and supports the full
character set, but cp1252 (on your system) is the default text file
encoding, which doesn't support zero-width space. Specify an encoding for
the output file such as UTF-8:
f=open('blah.txt','w',encoding='utf8')
f.write('\u200b')
1
f.close()
-Mark
--
http://mail.python.org/mailman/listinfo/python-list
7;t ask why I typed *that*,
> I don*t know, I just did). And the answer wasn't 9.6.
>
> [examples snipped]
Hi Bojan,
This is a FAQ. Take a look at:
http://docs.python.org/tutorial/floatingpoint.html
and let us know whether that explains things to your
satisfaction.
Mark
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 25, 7:04 pm, Bojan Sudarevic wrote:
> The first thing I typed into it was 3.2*3 (don't ask why I typed *that*,
> I don*t know, I just did). And the answer wasn't 9.6.
It looks like it's false in PHP too, by the way (not
that I know any PHP, so I could well be missing
something...)
bernou
imal('7.12348'))/2
Decimal('7.12345')
Similarly, sqrt(x*x) == x is always true for a positive IEEE 754
double x (again
assuming the default roundTiesToEven rounding mode, and assuming that
x*x neither overflows nor underflows). But this property fails for
IEEE 754-compliant decimal floating-point.
Mark
--
http://mail.python.org/mailman/listinfo/python-list
and the problem. anyone can help?
Hmm. It's working fine for me (OS X 10.5.7/Macbook Pro). What
version
of OS X are you using? How are you running python3---by typing
'python3' at
a Terminal prompt, I assume? What's the output of the 'locale'
command on
your system?
Mark
--
http://mail.python.org/mailman/listinfo/python-list
e the above
script in windows-1252 encoding and change the coding line to windows-1252 I
get the same results, but the decode byte is 0x97.
# coding: windows-1252
data = u'foo — bar'
print repr(u'—'.encode('utf-8'))
print repr(u'—'.encode('windows-1252'))
print data.split(u'—')
print data.split('—')
'\xe2\x80\x94'
'\x97'
[u'foo ', u' bar']
Traceback (most recent call last):
File
"C:\dev\python\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 427, in ImportFile
exec codeObj in __main__.__dict__
File "", line 1, in
File "x.py", line 6, in
print data.split('ק)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x97 in position 0:
ordinal not in range(128)
-Mark
--
http://mail.python.org/mailman/listinfo/python-list
I think
using --enable-universalsdk=/ also works on my system. If none of
that helps, you might try asking this question over on the pythonmac-
sig mailing list. (http://mail.python.org/mailman/listinfo/pythonmac-
sig)
Mark
--
http://mail.python.org/mailman/listinfo/python-list
7;t really understand the question: what do you mean by 'first'?
It might help if you tell us what your aims are.
In any case, you probably also want to look at the Include/
longintrepr.h and Include/longobject.h files.
Mark
--
http://mail.python.org/mailman/listinfo/python-list
cessary zeros) and returns.
As far as memory allocation goes: almost all operations call
_PyLong_New at some point. (Except in py3k, where it's a bit more
complicated because small integers are cached.)
If you have more specific questions I'll have a go at answering them.
Mark
--
http://mail.python.org/mailman/listinfo/python-list
e is constant in
> all environments (Linux, Windows, Mobiles, etc.)?
I think it would be dangerous to rely on this struct staying constant,
even just for CPython. It's entirely possible that the representation
of Python longs could change in Python 2.8 or 3.2. You should use the
public
l/python-ideas/2009-March/003741.html
Mark
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 6, 4:13 pm, Pedram wrote:
> On Jul 6, 5:46 pm, Mark Dickinson wrote:
> > On Jul 6, 1:24 pm, Pedram wrote:
>
> > > OK, fine, I read longobject.c at last! :)
> > > I found that longobject is a structure like this:
>
> > > struct _longo
ked?
I managed to reproduce the crash by starting python3 (again
at a Terminal prompt) with:
LANG=UTF-8 python3
So I suspect that your locale settings are part of the problem.
As a temporary workaround, something like
LANG=en_US.UTF-8 python3
might work. (Substitute whatever language setting i
'or' are special in that they have useful short-
circuiting behaviour; xor doesn't have this property (that is, you
always need to evaluate *both* operands to determine the result).
I'd also guess that 'xor' would be much less used than 'and' or 'or',
but maybe that's just a reflection of the sort of code that I tend to
write.
--
Mark
--
http://mail.python.org/mailman/listinfo/python-list
urce, then the problem is
probably that either the readline library is missing, or (much more
likely) the include files for the readline library are missing. Look
for a package called something like libreadline5-dev or readline-devel
and install it, and then try rebuilding Python.
Mark
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 14, 8:43 pm, Chris Rebert wrote:
> On Tue, Jul 14, 2009 at 11:47 AM, Mark Dickinson wrote:
> > (1) It's easy to emulate xor: 'x xor y' <-> bool(x) != bool(y)
>
> Using the xor bitwise operator is also an option:
> bool(x) ^ bool(y)
Good poi
>
> for arg in args:
> if bool(arg): result= not result
It's more idiomatic to say "if arg: ..." rather than "if bool
(arg): ...".
>
> return result
Mark
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 15, 7:29 pm, Wayne Brehaut wrote:
> On Tue, 14 Jul 2009 11:47:41 -0700 (PDT), Mark Dickinson
> wrote:
> >I'd also guess that 'xor' would be much less used than 'and' or 'or',
> >but maybe that's just a reflection of the sort of
Hi,
I'm just wondering why <, <=, >=, and > are not supported by
collections.OrderedDict:
>>> d1 = collections.OrderedDict((("a",1),("z",2),("k",3)))
>>> d2 = d1.copy()
>>> d2["z"] = 4
>>> d1 == d2
False
>>> d1 < d2
Traceback (most recent call last):
File "", line
x27;a and b or c' idiom. See PEP 308, and:
http://mail.python.org/pipermail/python-dev/2005-September/056546.html
In my own code, I'm finding myself increasingly using conditional
expressions where I would once have used 'and' or 'or':
daysInAdvance = int(inputVar
0 1 2 3 4 5 6 7 8
9
Any thoughts on how I can make Python behave to get the Python behavior of
my PC on my Mac?
Thanks,
Mark
--
http://mail.python.org/mailman/listinfo/python-list
,
loops such as 'for a, b in enumerate/zip(sequence[, sequence])' should
now be dramatically faster (also inside list comprehensions), by
avoiding allocation of intermediate tuples. Finally, basic list
slicing should now be much faster.
Please try it out!
Mark Dufour.
--
"
> Since the 'and' and 'or' already return objects (and objects evaluate to
> true or false), then 'xor' should behave likewise, IMO. I expect that
> would be the case if it were ever added to the language.
I'm not so sure. Did you ever wonder why the any() and all()
functions introduced in 2.5 return a boolean rather than returning
one of their arguments? (I did, and I'm still not sure what the
answer is.)
Mark
--
http://mail.python.org/mailman/listinfo/python-list
khanh le wrote:
do you have any materials about Python?
can you show me the link of Python or some books?
thanks a lots!
--
Regard!
Khanh
This comes highly recommeended http://diveintopython.org/
Regards.
--
http://mail.python.org/mailman/listinfo/python-list
[email protected] wrote:
For example, I have a string "#a=valuea;b=valueb;c=valuec;", and I
will like to take out the values (valuea, valueb, and valuec). How do
I do that in Python? The group method will only return the matched
part. Thanks.
p = re.compile('#a=*;b=*;c=*;')
m = p.match(
e absolutely the same.
The only hint at a difference I can see is that my ftp program says
the files are of unequal lengths. test.py is 129 bytes long.
python.py 134 bytes long.
A zipped folder containing both files is at
www.lambdassociates.org/weird.zip
Any ideas welcome.
Mark
--
http:/
whereas that for the mutable list must be liable to change. You might
like to look at the recent thread on this ng 'List insertion cost' and
follow the links to Raymond Hettinger's power point presentation.
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
On 23 July, 18:01, Dennis Lee Bieber wrote:
> On Thu, 23 Jul 2009 08:48:46 -0700 (PDT), Mark Tarver
> declaimed the following in
> gmane.comp.python.general:
>
> > I have a very strange error. I have two test python files test.py and
> > python.py which co
On 23 July, 18:01, Dennis Lee Bieber wrote:
> On Thu, 23 Jul 2009 08:48:46 -0700 (PDT), Mark Tarver
> declaimed the following in
> gmane.comp.python.general:
>
> > The only hint at a difference I can see is that my ftp program says
> > the files are of unequal lengths. t
R Mohali
Chandigarh
INDIA
Try writing correct rather than incorrect code. Or as has been
repeatedly stated get somone from your CS department to help.
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 24, 3:11 pm, "Rhodri James"
wrote:
> Which doesn't make your point less valid. In fact I'd go so
> far as to argue that what len() gives you is the number of
> items in a container, so len(7) should return 0.
Nah. 7 contains three bits, so len(7) sho
essing strings to a single bit is easy. It's the uncompressing
that's tricky.
I assume you mean ord("7")%2?
First one to correctly decompress the value 0 into an ASCII character
wins the title of the world's most capable hacker :p
Marcus
asciichar = chr(len(0)) if th
On 24 July, 15:45, nn wrote:
> On Jul 23, 7:03 pm, Dave Angel wrote:
>
>
>
>
>
> > Mark Tarver wrote:
> > > I have a very strange error. I have two test python files test.py and
> > > python.py which contain the following code
>
> > >
On 25 July, 10:30, Mark Tarver wrote:
> On 24 July, 15:45, nn wrote:
>
>
>
>
>
> > On Jul 23, 7:03 pm, Dave Angel wrote:
>
> > > Mark Tarver wrote:
> > > > I have a very strange error. I have two test python files test.py and
> > > >
ffer
print gapbuffer.GapBuffer(range(10))[:]
GapBuffer('i')]
If my sleuthing is correct the problem is with these lines
ilow *= self->itemSize;
ihigh *= self->itemSize;
in GapBuffer_slice being computed before ilow and ihigh are compared to
anything.
Python 2.6.2 32 bit Windows.
On Jul 27, 1:53 am, "Delaney, Timothy (Tim)"
wrote:
> Mark Dickinson wrote:
> >> Since the 'and' and 'or' already return objects (and objects
> >> evaluate to true or false), then 'xor' should behave likewise, IMO.
> >> I ex
ut to no avail.
You've told python to run the command "import re" which it's happily
done before exiting. Simply type python, then at the prompt (default
>>>) type whatever commands you wish, e.g.
c:\Users\Mark\python\regex>python
Python 2.6.2 (r262:71605, Apr 14
In Python
> 3.1 the module is called "tkinter", not "Tkinter" (names are
> case-sensitive).
Further to the above, you can find my Tkinter tutorial (which uses
Python 3.x) at http://www.tkdocs.com -- I hope this will provide some
help in getting up to speed.
Mark
--
http://mail.python.org/mailman/listinfo/python-list
the files bm_regex_effbot.py and bm_regex_v8.py from
http://code.google.com/p/unladen-swallow/source/browse/#svn/tests/performance
and ran them, then reran them having substituted regex for re. Output
timings were roughly effbot re 0.14secs, effbot regex 1.16secs, v8 re
0.17secs and v8 regex 0.67secs.
HTH.
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
an appropriate encoding (ascii,
latin-1, windows-1252, utf-8, etc.):
clientSock.send(buff.encode('ascii'))
When reading from the socket, you can decode() the byte strings back into
Unicode strings.
data = clientSock.recv(1024).decode('ascii')
-Mark
--
http://mail.python.org/mailman/listinfo/python-list
t from that what have the Pythonistas ever done for us? Nothing!:)
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
cs (>= 2.6) The interface has changed
drastically as to render itself completely useless. The old docs (<=
2.5) --the ones i learned from-- where flawless.
@ Mark Lawrence
Have you clicked any of those links? try the "Tutorial start here" and
then try to find a menu of sorts. It se
r wrote:
On Jul 31, 4:53 pm, Mark Lawrence wrote:
r wrote:
On Jul 31, 4:16 pm, Carl Banks wrote:
On Jul 31, 1:10 pm, kj wrote:
I'm pretty new to Python, and I like a lot overall, but I find the
documentation for Python rather poor, overall.
I'm sure that Python experts don
nformation.
>>> num2str = '{0:.{1}f}'.format
>>> num2str(3.14159, 3)
'3.142'
(In Python 3.1, num2str = '{:.{}f}'.format is enough.)
Mark
--
http://mail.python.org/mailman/listinfo/python-list
oup(1)
thisMap = map.search(line).group(1)
thisParcel = parcel.search(line).group(1)
except:
continue
The bare except will hide any errors in the lines above it. Either catch
errors that you expect or take the try-except out.
--
Kindest regards.
Mark Lawrence.
--
http
a list, and is writeable.
Yes, but I'm mainly playing in IDLE and I was getting a bit fed up of
repeatedly typing
import sys
sys.path.append('C:/Users/Michael/Code/Python')
import mystuff
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
Michael M Mason wrote:
"Mark Lawrence" wrote in message
news:[email protected]...
Be careful, I'm screwed things up on several occasions by placing a
file on PYTHONPATH that overrides a file in the standard library,
test.py being my favourite!
en't tried but could you adapt this:-
data = [ 1, 4,5,6, 10, 15,16,17,18, 22, 25,26,27,28]
for k, g in groupby(enumerate(data), lambda (i,x):i-x):
print map(itemgetter(1), g)
found here
http://www.python.org/doc/2.6.2/library/itertools.html#module-itertools
--
Kindest regards.
n list, accumulating blocks along the way.
count = 0
for i, (pt, startend, name) in enumerate(transitions):
if startend == 'Start':
if not count:
start = pt
names = []
count += 1
names.append(name)
else:
count -= 1
if not
On Aug 4, 9:03 pm, Mark Dickinson wrote:
> for i, (pt, startend, name) in enumerate(transitions):
Whoops. That line should just be:
for pt, startend, name in transitions:
The enumerate was accidentally left-over from a more
complicated version.
--
Mark
--
http://mail.python.org/mail
don't know if this is relevant, but http://planet.python.org/ has an
entry dated this morning which points here
http://www.logarithmic.net/pfh/blog/01249470842.
HTH.
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
,
Dan
http://www.answers.com/topic/spider-plot
How about
http://matplotlib.sourceforge.net/examples/api/radar_chart.html?highlight=spider
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
than trivial issues like Denial of
Service atacks via XML.
Sorry, just couldn't resist.
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
involving thousands or millions of characters is more meaningful? Or to
go the other way, you are unlikely to write
for c in 'äöüÄÖÜß':
u = unicode(c, 'utf-8')
...
Yes?
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
e for this "etc." language but failed dismally. Does
it belong here? http://www.thefreecountry.com/compilers/esoteric.shtml
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
periencing the same problem?
Yes, it's been down for several hours.
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
hing really to do
with Python, say a query about which algorithm to use. Response "Not
really a Python question, but try ...". Put the same question on (say)
the C ng and you'd be told in no uncertain terms to Foxtrot Oscar.
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
We're pleased to announce a new venue for our Python classes.
Python author and trainer Mark Lutz will be teaching a 3-day
Python class on October 20-22, in Sarasota, Florida. Come
spend 3 days mastering Python, and enjoy all that Florida and
its Gulf Coast have to offer while you're h
[snip]
r "slayer of the galactic-ly stupid!"
Can I assume from this that you intend killing yourself, on the grounds
that some 10 days ago you couldn't successfully use a windows compiled
help file?
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
ty, there are attention seekers who are not interested
in actual participation.
(*) http://bugs.python.org
(**) yes, humour is fine, but it doesn't replace actual, informational content
Antoine.
Thank you for this fine, cultured, reasonable response. Seriously!!!
--
Kindest regards.
M
, why not process it from
there, i.e. "for line in firstread". Also look at the docs for the find
method, it doesn't return what you think it does.
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
more for your help!
Best Regards,
Bea
I think your best bet is to read and action the responses you got to
your original email from three days ago. If these have got lost in the
post simply search online, they're bound to be archived somewhere.
--
Kindest regards.
Mark Lawrence.
--
her provide hard evidence that can
persuade me that your perspective on this is correct or shut up.
[snip]
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
wrong, went here and downloaded the corrected version of
the file, which has presumably been available for months!
http://www.python.org/download/releases/2.6.2/
And you want newbies let loose on the python docs. As good ole Santa
would say, ho, ho, ho!
--
Kindest regards.
Mark Lawrence.
--
ht
ecognize there are syntax errors. Ignore those for now.
For starters take a look at http://tinyurl.com/o2o8r8 , just about every
combination of string concatenation going there. I assume that one of
these will let you leave failMsg where it belongs.
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
r wrote:
Ah Ha! the docs are broken and i was right all along! Are the good
folks at Python dev rolling a new installer as we speak, or we must
wait for new version?
As I pointed out a few minutes ago thicko, the new version has been
available for months.
--
Kindest regards.
Mark Lawrence
Carl Banks wrote:
On Aug 11, 1:46 pm, Mark Lawrence wrote:
r wrote:
Ah Ha! the docs are broken and i was right all along! Are the good
folks at Python dev rolling a new installer as we speak, or we must
wait for new version?
As I pointed out a few minutes ago thicko, the new version has been
umber of the usually cranky driver developers have expressed the
same opinion. Microsoft might actually have a winner here.
"Me too" :)
Mark
--
http://mail.python.org/mailman/listinfo/python-list
foreigners to death, that's more like it. See the
following links should anyone be interested.
http://www.dorsetforyou.com/index.jsp?articleid=386553
http://www.dorsetforyou.com/index.jsp?articleid=386598
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
Esmail wrote:
Mark Lawrence wrote:
Hi Mark,
The docs for the constraint package look good, see
http://labix.org/python-constraint and http://labix.org/doc/constraint.
I think they've been produced with epydoc see
http://epydoc.sourceforge.net/
Thanks for the links, I'll take a
one is after the , :)
You should probably learn how to play with regexes.
I personnaly use a visual tool called RX Toolkit[1] that comes with
Komodo IDE.
[1] http://docs.activestate.com/komodo/4.4/regex.html
Haven't tried it myself but how about this?
http://re-try.appspot.com/
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
istrator but it prevents the user from accidently
overwriting a stdlib module. Stdlib modules can still be overwritten
with PYTHONPATH." What am I missing?
http://www.daimi.au.dk/~chili/PBI/pythonpath.html
[snip]
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
ndest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
list?
Simplest way to get it to work is above using Python 2.6.2 on Windows.
I'm sure there are variations depending on your use case, but I'll leave
that to the experts.
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
looping mechanism that generates the index variable values incrementally
as they are needed.
I have a strong suspicion that you will find hints in the Python
documentation that this has already been addressed. Perhaps you could
try reading before posting?
--
Kindest regards.
Mark Lawrence
)
>>> f = open('testfile.txt', 'w')
>>> f.write(b)
>>> del b
>>> f = open('testfile.txt')
>>> b = f.read()
>>> del b
and got the expected memory usage for my Python process, as
displayed by top: memory usage went up to nearly 1Gb after
each assignment to b, then dropped down to 19 Mb or so after
each 'del b'. I get similar results under Python 2.5.
So maybe there's something in xlrd that's hanging on to all
that memory?
Mark
--
http://mail.python.org/mailman/listinfo/python-list
Bill Jones wrote:
On Aug 8, 3:27 pm, Mark Lawrence wrote:
Kee Nethery wrote:
As someone trying to learn the language I want to say that the tone on
this list towards people who are trying to learn Python feels like it
has become anti-newbies.
[snip]
Kee Nethery
My gut feeling (which
p://xavierho.com/
http://bytes.com/topic/python/answers/844614-python-3-sorting-comparison-function
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
x27;s your call as to what to do next.
--
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
I'm missing, like fraction(r)?
> >>> import math
> >>> math.modf(1.5)
>
> (0.5, 1.0)
What Christian said. math.fmod(r, 1.0) also works.
Note that r % 1 and r - int(r) aren't the same thing for negative
reals.
What sign do you want the result to have when r is negative?
Mark
--
http://mail.python.org/mailman/listinfo/python-list
1,234,567,890,123,456,789'
Gregor
Is it?
jj = '234567890123456789'
",".join([jj[max(ii-3,0):ii] for ii in range(len(jj)%3,len(jj)+3,3)])
',234,567,890,123,456,789'
At least one other solution in this thread had the same problem.
-Mark
--
http://mail.python.org/mailman/listinfo/python-list
Chris Rebert wrote:
On Sat, Aug 15, 2009 at 1:06 PM, Mark Lawrence wrote:
Xavier Ho wrote:
Hey all,
I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in
the
documentation.
Is there a substitution for this special method in 3.1, or do I really
have
to define al
t__ or __gt__
* __ge__ or __le__
Cheers,
Chris
Unfortunately I don't think it's that easy, see.
http://mail.python.org/pipermail/python-list/2008-November/688761.html
The issue referenced is still open. This of course assumes that I've
posted the correct link this time!
--
K
Xavier Ho wrote:
On Sun, Aug 16, 2009 at 9:49 PM, Mark Lawrence wrote:
Unfortunately I don't think it's that easy, see.
http://mail.python.org/pipermail/python-list/2008-November/688761.html
The issue referenced is still open. This of course assumes that I've
posted the correct
nt item here is currently the win32text stuff.
Mark Hammond said he would work on this; Mark, when do you have time
for this? Then I could set apart some time for it as well.
I can make time, somewhat spasmodically, starting fairly soon. Might I
suggest that as a first task I can resurrect my old stale
he correct way to turn an iterator over bytes into a string?
This works, but, ewww:
In [8]: "".join(iter("four score and seven years ago"))
Out[8]: 'four score and seven years ago'
You've started with a string.
>>> type("four
27;:
id = int(entry.value)
print '%s_%s = %d' % (item.enum.upper(),entry.name.upper(),id)
id += 1
--end code
Output:
HELLO_ZERO = 0
HELLO_ONE = 1
HELLO_TWO = 2
HELLO_THREE = 3
HELLO_FIVE = 5
HELLO_SIX = 6
HELLO_TEN = 10
BLAH_ALPHA = 0
BLAH_BETA = 1
BLAH_GAMMA = 10
BLAH_ZETA = 50
-Mark
--
http://mail.python.org/mailman/listinfo/python-list
"Mark Tolonen" wrote in message
news:[email protected]...
[snip]
This is what 3rd party library pyparsing is great for:
begin code--
from pyparsing import *
# sample string with enums and other stuff
sample = '''
stuff before
"Gilles Ganault" wrote in message
news:[email protected]...
I find it odd that the regex library can't handle European characters
It can. Read the documentation about the re.LOCALE flag.
-Mark
--
http://mail.python.org/mailman/listinfo/python-list
val+1
--
--> TypeError: cannot concatenate 'str' and 'int' objects
--
f = open('serial.txt', 'rb')
val = f.read()
val = val + 1
--
--> TypeError: cannot concatenat
5201 - 5300 of 5842 matches
Mail list logo