http://www.pytex.org/
hth,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
fy for me?
Expected result from pool.map: [[0],[1],[2]]
Usual result: [[0],[0,1],[0,1,2]]
Occasional result: [[0],[1],[0,2]]
Thanks,
Alan Isaac
#--- temp.py -
#run at Python 2.7 command prompt
import time
import multiprocessing as mp
lst = []
lstlst = []
def alis
I received a suggestion off list that my results indicated that the jobs were
not being distributed across the pool workers. I used
mp.current_process().name to confirm this suggestion.
Alan Isaac
--
https://mail.python.org/mailman/listinfo/python-list
fixed for 3.2. Was the fix ever backported to 2.7?
--
Thanks,
Alan Isaac
--
https://mail.python.org/mailman/listinfo/python-list
You can use `list(math.sin(x * math.pi / 2) for x in index)` or use `numpy`,
which supports array math.
--
https://mail.python.org/mailman/listinfo/python-list
n that would
include (statically if possible) the package Numeric-24.2. Is it
possible? How?
Summarising, I would like to build a python binary independent of
others libraries where I could 'import Numeric'.
I would appreciate very much any help here.
Many thanks in advance.
Cheers,
A
ersions/2.5/lib/python2.5/lib-tk/Tix.py",
line 210, in __init__
self.tk.eval('package require Tix')
_tkinter.TclError: can't find package Tix
The only way I got Tix.Tk() working so far was using Fink but I want
the nice aqua visual for python. Is there any way of getting it
workin
Hi List!
Does anyone here knows how to compile python with Numeric in a static way?
Many thanks in advance.
Cheers,
Alan
--
http://mail.python.org/mailman/listinfo/python-list
ions", which
sit at the root of all evil
--
Alan
--
http://mail.python.org/mailman/listinfo/python-list
.Frame.__init__(self, parent, id, title, size=(600,500))
self.nb = wx.Notebook(self)
self.page1 = Form1(nb, -1)
self.nb.AddPage(self.page1, "Choose Patient")
self.page1.SetFocus()
def patient_lookup(self, first_ltrs):
self.page2 = Selectable.Repository(nb, -1, first_ltrs)
self.nb.AddPage(self.page2, "Patient Lookup")
self.page2.SetFocus()
--
Alan
--
http://mail.python.org/mailman/listinfo/python-list
elif self.name > other.name:
> return 1
> else:
> return 0
>
over
def __cmp__(self,other):
return cmp(self.name,other.name)
?
--
Alan
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 16, 8:29 pm, [EMAIL PROTECTED] wrote:
> I still don't get it and I've been haunting this group for months...
>
> Mike
Go on then ...
What ?
The punchline, do the punchline
--
Alan
--
http://mail.python.org/mailman/listinfo/python-list
With apologies to Voltaire:
If Xah Lee did not exist, it would be necessary for John Bokma to
invent him.
Xah and Bokma are both idiots, they truly deserve each other. The
sooner you killfile these two clowns, the happier you'll be.
--
http://mail.python.org/mailman/listinfo/python-list
This ignores CTRL-C on every platform I've tested:
python -c "import threading; threading.Event().wait()"
^C^C^C^C
It looks to me like all signals are masked before entering wait(). Can
someone familiar with the internals explain and/or justify this
behavior? Thanks,
On May 17, 3:06 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> On Sat, 17 May 2008 12:49:54 -0700, John Schroeder <[EMAIL PROTECTED]> wrote:
> >On Sat, May 17, 2008 at 12:32 PM, alan <[EMAIL PROTECTED]> wrote:
>
> >> This ignores CTRL-C on every platfor
Why do function objects compare in this way to numbers?
Thanks,
Alan Isaac
>>> def f(): return
...
>>> f>5
True
--
http://mail.python.org/mailman/listinfo/python-list
my problem? If so is this a standard pattern? If not,
can you mention a better approach?
My solution is working for me, but the class ``A``
is bugging me, because of the odd (to me) way in
which it is incomplete. Obviously, I'm not a
computer science type ...
Thanks,
Alan Isaac
--
http://
On Jan 26, 4:37 pm, Alan wrote:
> I have a class factory ``f``` that subclasses ``A`` *only* in
> order to define the class variables.
I suppose it would be clearer to say that `f` *returns*
subclasses of `A`. Hopefully that was clear ...
Alan Isaac
--
http://mail.python.org/mailman/li
Can the below example be fixed to work?
Thanks,
Alan Isaac
import multiprocessing as mp
class Test(object):
pass
def class_factory(x):
class ConcreteTest(Test):
_x = x
return ConcreteTest
def f(cls):
print cls._x
if __name__ == '__main__':
pool =
in__':
>pool = mp.Pool(2)
>pool.map(g, zip([class_factory] * 4, range(4)))
If I change that to g((factory,i)) it does work.
Thanks!
Alan
--
http://mail.python.org/mailman/listinfo/python-list
explicitly do
cleanup(...) it works. If I have no threads on, atexit works too.
Any idea of how to debug this would very appreciated.
Thanks,
Alan
Python 2.6.5 (r265:79063, May 13 2010, 15:11:52)
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
--
Alan Wilter S. da Silva, D.Sc. - CCPN Research
the same behaviour I see
with python2.5 for this example code?
Any hint would be very much appreciated indeed.
Many thanks in advance.
Alan
--
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<
--
http://mail.python.org/mailman/listinfo/python-list
Thanks MRAB. setDaemon gave some hope.
Alan
On Fri, Jun 4, 2010 at 16:46, wrote:
> Alan wrote:
>
>> Hi there,
>>
>> That's another try to get help about this issue I am facing. To help you
>> to help me here goes a simple example. This is a very simpl
eractive python
terminal. Is there a way of having the very behaviour I have with python 2.5
for my code in python 2.6?
Many thanks in advance,
Alan
--
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2
Hello there,
I know drag & drop is not possible with TK. Which widget could I use for my
python application to be able to work with drag & drop?
Thanks,
Alan
--
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Co
where I can now about it and how to make
this better? I wanted a plain string in out.
Many thanks in advance,
Alan
--
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<
--
http://mail.python.org/mailman/listinfo/python-list
pickle.py", line 858, in load
dispatch[key](self)
File "/sw/lib/python2.7/pickle.py", line 1083, in load_newobj
obj = cls.__new__(cls, *args)
AttributeError: class ACTopol has no attribute '__new__'
Apart that, everything else seems to work. Just one note more:
behaviour and how to
solve this?
Many thanks in advance,
Alan
--
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<
--
http://mail.python.org/mailman/listinfo/python-list
_main__':
timeTol = 5
cmd = 'find /'
signal.signal(signal.SIGALRM, signal_handler)
signal.alarm(timeTol)
p = subprocess.Popen(cmd, shell=True, stderr = subprocess.STDOUT, stdout
= subprocess.PIPE)
pid = p.pid
out = str( p.communicate()[0].decode() )
prin
#x27;:
timeTol = 5
cmd = 'find /'
signal.signal(signal.SIGALRM, signal_handler)
signal.alarm(timeTol)
p = subprocess.Popen(cmd, shell=True, stderr = subprocess.STDOUT, stdout
= subprocess.PIPE)
pid = p.pid
out = str( p.communicate()[0].decode() )
print(out)
Alan
etc) that could give a solution to keep my code in python 2.6 syntax
as above but compatible with python 2.5, that would be appreciated.
Many thanks in advance,
Alan
--
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road
u are looking for exotic libraries you should have more success
posting on the general Python mailing list or newsgroup (comp.lang.python)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
Let's say I want to compare two csv files: file A and file B. They are both
similarly built - the first column has product IDs (one product per row) and
the columns provide some stats about the products such as sales in # and $.
I want to compare these files - see which product IDs appear
thanks a lot :)
--
http://mail.python.org/mailman/listinfo/python-list
an
tables?
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
--
http://mail.python.org/mailman/listinfo/python-list
ty sure it is Thunderbird-related -- I have had this issue
before as well. Unfortunately, I cannot remember how I solved it. It
seems like there was a particular box that needed to be checked or
unchecked in the IMAP settings for the mail server, but I can't be sure
anymore.
ng a proof of concept of how to let Python
work in a more forgiving way).
What I discovered is that register_error() for "strict" seems to work in
the way I expect for string decoding, not for unicode encoding.
That's what happens on Mac, Python 2.7.1 from Apple:
sed. "type" fails that test.
"generate_keystrokes" passes with flying colors, but may be overkill.
Alan
--
http://mail.python.org/mailman/listinfo/python-list
Since the event being generated is commonly called a "keystroke", and since
my dictionary defines the noun "stroke" as being: "the act of striking", a
good verb to choose for the action itself would seem to be "strike":
strike('a')
--
http://mail.python.org/mailman/listinfo/python-list
Hello Python experts,
I want to insert Unicode chars in an Entry widget by pushing on buttons;
one for each Unicode character I need. I have made the Unicode buttons.
I just need a simple function that will send the Unicode character to
the Entry widget.
Is there a better approach?
Alan
--
http
doing the analysis for. It's also good to try more
than one set of excluded outliers to see just how stable the results are
depending on how many outliers you remove. If the results change much, be very
careful how you use the results.
Alan
--
http://mail.python.org/mailman/listinfo/python-list
t;>
>> If you would simply run the python interpreter and try these things out
>>
>> you could see how and why they work or not work. What is stopping you
>>
>> from doing this?
>
>
> May i sent you my code by mail so for you see whats wrong and
> http://superhost.gr produces error?
>
> 1. this is not a script that iam being paid for.
> 2, this is not a class assignemnt
>
> I just want to use that method of gettign this to work.
> --
> http://mail.python.org/mailman/listinfo/python-list
All pages, strings and objects map to:
http://redwing.hutman.net/~mreed/warriorshtm/ferouscranus.htm
Alan
--
http://mail.python.org/mailman/listinfo/python-list
is not a closure?
Alan
--
http://mail.python.org/mailman/listinfo/python-list
.
I am having a problem moving an application from RHEL 5.7 to Ubuntu 11.11,
and the problem is around .py program.
It is a web based program, and seems to use a strange combination of
mod_python and python CGI as best I can tell.
Would this be the right list to ask?
thanks,
-Alan
--
http
>
> Welcome to the list. There are lots of friendly folks here who will try
> to help.
>
>
I noticed that already - thanks!
--
http://mail.python.org/mailman/listinfo/python-list
OK, since you all said to send it, here it is :-) Though I think it may be
an apache issue, I'll send it anyway.
I'm using the software called "Open Freezer" which is used to track
reagents and other chemicals in research labs.
I also posted this here on their discussion forums but have not hear
ary. When people talk about, for example, the art of painting
water colours, they mean the techniques of mixing paints, depicting
objects on paper, etc. They are not referring to the artistic value of
the painting painted.
> yours humbly,
>
> Xah
--
Alan Mackenzie (Nuremberg, Ger
s particular
piece of code -- the code only inspired the question. I'm trying to
wrap my head around decorators (aside from the simplest ones) and
metaclasses at the moment, so feel free to throw those sorts of
solutions into the mix if something like that would be appropriate.
Thanks,
Alan
--
http://mail.python.org/mailman/listinfo/python-list
me of what? If you click on the "help", you get
taken to a search box, not proper docs. Typing "name" into the search
box isn't useful. And so it goes on.
CUPS is an Apple product.
> more records of careless dead link:
[ ]
--
Alan Mackenzie (Nuremberg, Germany).
--
http://mail.python.org/mailman/listinfo/python-list
can
block comment/uncomment it would be really handy to be able to do the same
with indentation. I cannot believe the function isn't there, but I cannot
find it.
Select the code block you want to indent and hit Tab. To do the reverse,
hit Shift-Tab.
Alan
--
http://mail.python.org/mailman/listinfo/python-list
Hello
I tried using one compiled library and got this error:
ImportError: /home/alan/Downloads/pdftron/PDFNetC64/Lib/
_PDFNetPython2.so: undefined symbol: PyUnicodeUCS2_AsUTF8String
I googled around and found some info about the meaning of the error.
The creators of PDFNet suggested i install
source as you type.
That would be worth investigating too...
HTH,
Alan G.
--
http://mail.python.org/mailman/listinfo/python-list
ion of my problem.
I can't quite work it out. Any brilliant ideas? (or other elegant
solutions to the problem?)
-- George
This is not properly portable to all OS, but you could simply split on
the slash character, e.g.,
pathname.split('/')
Alan
--
http://mail.python.org/mailman/listinfo/python-list
ere is
at least one open source program that will monitor named files and
truncate them from the beginning to a fixed maximum size.
I don't like this method as much as the first because it might result in
something important being truncated.
Alan
--
http://mail.python.org/mailman/listinfo/python-list
change one line in a thousand line
program and cut the run time by 50%.
Alan
--
http://mail.python.org/mailman/listinfo/python-list
welcome!
~Ethan~
That looks pretty clever. I tried adding this method to Spam:
def test_eggs_02(self):
print('testing eggs_02 from spam')
and it did just what we wanted.
I'm going to have to study this one.
Thanks.
Alan
--
http://mail.python.org/mailman/listinfo/python-list
of the discussions there will be
closer to your level than the more advanced topics that
get addressed here.
Finally, I have a tutorial aimed at complete beginners,
see the link below...
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_
Marco Sulla writes:
On Mon, 9 May 2022 at 19:53, Chris Angelico wrote:
...
Nevertheless, tail is a fundamental tool in *nix. It's fast and
reliable. Also the tail command can't handle different encodings?
It definitely can't. It works for UTF-8, and all the ASCII compatible
single
ng for is usually called "argmax" and
"argmin" (see ). These don't exist in
the standard Python library as far as I can tell, but numpy does have
"argmax" and "argmin" routines.
--
Alan Bawden
--
https://mail.python.org/mailman/listinfo/python-list
e
_same_ dictionary every time. Your original code that used a `for' loop
is actually much clearer.
--
Alan Bawden
--
https://mail.python.org/mailman/listinfo/python-list
g to have it destroyed by this process:
seq = list(seq)
n = len(seq)
while n:
i = randrange(n)
yield seq[i]
n -= 1
if i < n:
seq[i] = seq[n]
--
Alan Bawden
--
https://mail.python.org/mailman/listinfo/python-list
Cecil Westerhof writes:
Alan Bawden writes:
> Cecil Westerhof writes:
>
>Yes, I try to select a random element, but it has also to be removed,
>because an element should not be used more as once.
>
> Instead of using pop to do that why
f __str__(self):
> return "Empty()"
> def __repr__(self):
> return self.__str__()
> def __new__(clss):
> if not hasattr(clss, "saved"):
> clss.saved = super().__new__(clss)
> return clss.saved
>
> class Stack(Pair):
> def pop(self):
> return self.first
> def push(self, x):
> return Stack(x, self)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
xactly as in
cellular automata theory. ..
Unfortunately, there is a huge gap between pure OOP theory and
practical OOP languages! And just as big a gap between OOP language
potential and real-world OOP usage. Very few purely OOP programs
exist (maybe excepting in Smalltalk - see Stefan's posts
I'd implement the example hierarchy as
>
>>>> class Language:
> ... def f(self):
> ... print(self.greeting)
And that would be perfectly valid too.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/aut
ut you really have to fight the system to
do so.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
On 03/11/2022 18:29, Chris Angelico wrote:
> On Fri, 4 Nov 2022 at 05:21, Julieta Shem wrote:
>>
>> Chris Angelico writes:
>>
>>> On Thu, 3 Nov 2022 at 21:44, Alan Gauld wrote:
>>>> Also Python is not a purely OOP language, in that you can write
>&g
rd-python
>
> Disclaimer: have had it on my 'radar', but never actually employed.
> (if you have considered, will be interested to hear conclusions...)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
On 12/12/2022 17:45, Alan Gauld wrote:
Absolutely nothing apparently!
But in practce I did pen some esponses to Davids post. However
this list seems to strip out what I've written, its happened
a few times now. Not every time but enough that I rarely post
here.
But I'll try once mor
ecimal
accuracy is your primary goal, it might suit you better.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
uld chain them. But sadly it doesn't.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
axed the ludicrously strict typing slightly. Turbo Pascal
made Pascal a joy and I still use Delphi for Windows programming today.
TP also introduced classes to Pascal (although Apple had already done
so for the Mac and Borland basically ported the syntax to the PC).
--
Alan G
Author of the Lea
) is a now more complicated than before. So
I have to be very highly motivated to jump through the hoops.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauld
e (and standard library) as it exists.
(We also cover beginner questions about programming in general.)
So this thread is most definitely in the right place IMHO.
--
Alan G
Tutor list moderator
--
https://mail.python.org/mailman/listinfo/python-list
compile(m0)
s0 = r0.match(s)
>>> print(s0)
None
Assuming that you were expecting to match "pn=2017", then you probably
don't want the 'match' method. Read its documentation. Then read the
documentation for the _other_ methods that a Pattern supports. T
ing for static types
should rarely be necessary since Python uses duck typing
and limiting things to a hard type seriously restricts your code.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
h
Guenther Sohler writes:
Hi Python community,
I have a got an example list like
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
T T
and i eventually want to insert items in the given locations
(A shall go between 2 and 3, B shall go between 6 and 7)
Right now i just use ind
onic is still a much more loose term and
the community less stressed about it than their C++
cousins where it has almost reached a religious fervour!
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr a
e3.config(state="normal")
)
)
It's not a radical change from using a lamba as a
callback but it does extend the use case to cover
a common GUI scenario.
I like it. I wish I'd thought of it years ago.
Thanks for sharing.
--
Alan G
A
auto tricks but I don't
always use them. In vim I use auto-indent and that's about it.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
-
ers of
magnitude more difficult.
The Lazarus open source project is based on Delphi's IDE.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
g strong,
albeit at extortionately high prices: $1000~3000 for the pro
versions! (But there is still a free community version with
just the basics.) See http://www.embarcadero.com
And it's targeted at multi-platforms now: Windows, MacOS, Android, iOS
although it only runs on Window
ements were before
Python3 so ive no idea what it does today! But a quick check suggests it
still exists and works with python3 code - last major release was in Nov
2022.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my pho
;ve seen no real evidence of
that.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
--
https://mail.python.org/mailman/listinfo/python-list
ght be a rival to M$
OS/2 running NeXTstep now that would have been a platform
for the 90s... both so near yet so far.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.fli
ine all the operators (commands in Tcl-speak)
in the language so redefining plus is easy. Doing it based on
type is more tricky but doable.
> Unfortunately, if they BOTH are flexible, how do you decide whether to add
> them as numbers or concatenate them as strings?
Yes, that's where it b
o a text editor in the first
instance? And Excel in the second?
If all else fails you can probably write handlers and bind
to Ctrl-C and Ctrl-V to do something yourself that mimics
cut/paste.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan
ow to configure it
(and how to plumb it into your IDE).
Personally I've never felt the need for any stricter error
checking than the interpreter provides so I can't offer
anything beyond the generic suggestion to use a linter.
--
Alan G
Author of the Learn to Program web site
http://www.
If you are building terminal based form-type
apps the best bet seems to be urwid. I haven't used it in anger
but the beginner docs I saw looked promising.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo
text does create in each
> po-file.
Sorry, I've never used pygettext so can't help there.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphot
why nntplib is deprecated? Surely there are still a
lot of nntp servers around, both inside and outside corporate firewalls?
Is there a problem with the module or is it just perceived as no longer
required?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazo
t; required?
>
> See PEP 594: https://peps.python.org/pep-0594/
Thanks Cameron.
A scary list; I must have a dozen projects from the late 90s still
live that are using many of these! I'm glad I'm retired and won't
be the one who has to fix 'em :-)
--
Alan G
Author o
" the modules. are you typing
>>> import mymodule
at the interactive prompt or are you using the File->Open menu
to load them into the editor? (It sounds like the latter)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_
es\Tools\Python\Temp\cube.py
>>>> cubes
> [0, 1, 8, 27, 64, 125, 216, 343, 512, 729]
cubes looks like it should be a function but in that case there
should be parens after it. So I'm not sure how that is working!
I'd expect that you need to do:
import cube
cu
bject is not callable
Ah, now I understand. cubes is a literal list defined in the module.
> But that was spot on, thanks
>
>>>> import cube
>>>> cube.cubes
> [0, 1, 8, 27, 64, 125, 216, 343, 512, 729]
Glad to help.
--
Alan G
Author of the Learn to Program
tween append and extend. I suspect that the
heart of your confusion actually has nothing to do with generators.
--
Alan Bawden
--
https://mail.python.org/mailman/listinfo/python-list
t;> '\u01f1'.lower()
'\u01f3'
This is the "dz" character.
>>> '\u01f1'.title()
'\u01f2'
This is the "Dz" character.
When you write that code to capitalize your book titles, you should be
calling .title() rather than .upper() if you are doing it right.
--
Alan Bawden
--
https://mail.python.org/mailman/listinfo/python-list
Sibylle Koczian writes:
Am 20.03.2021 um 09:34 schrieb Alan Bawden:
>
> When you write that code to capitalize your book titles, you should be
> calling .title() rather than .upper() if you are doing it right.
>
But that's exactly what he's doing,
Chris Angelico writes:
>>> sys.version
'3.10.0b2+ (heads/3.10:33a7a24288, Jun 9 2021, 20:47:39) [GCC 8.3.0]'
>>> def chk(x):
... if not(0 < x < 10): raise Exception
...
>>> dis.dis(chk)
2 0 LOAD_CONST 1 (0)
2 LOAD_FAST
in transit.
Presumably, especially for large numbers, a single python loop
is faster than 2 C loops?
But that's purely my speculation.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr
1 - 100 of 1265 matches
Mail list logo