In last few days, I tried to experiment with the scrolling table implemented in
canvas, started from this example:
http://code.activestate.com/recipes/580793-tkinter-table-with-scrollbars/.
Everything works fine until I moved the scrolling_area instance (which the
canvas is in) from column=0 to
Peter Otten at 2017-10-19 UTC+8 PM 3:24:30 wrote:
> It's not clear to me what you mean with this. Did you place the table from
> the recipe elsewhere inside a window that you created or did you make
> changes in the recipe's code?
Thank you, Peter. I am using Python 3.4.4 under WinXP.
When run
Peter Otten於 2017年10月19日星期四 UTC+8下午6時04分39秒寫道:
> jf...@ms4.hinet.net wrote:
>
> > Peter Otten at 2017-10-19 UTC+8 PM 3:24:30 wrote:
> >> It's not clear to me what you mean with this. Did you place the table
> >> from the recipe elsewhere inside a window that you created or did you
> >> make change
Peter Otten於 2017年10月20日星期五 UTC+8上午4時37分10秒寫道:
> jf...@ms4.hinet.net wrote:
>
> > Peter Otten於 2017年10月19日星期四 UTC+8下午6時04分39秒寫道:
> >> jf...@ms4.hinet.net wrote:
> >>
> >> > Peter Otten at 2017-10-19 UTC+8 PM 3:24:30 wrote:
> >> >> It's not clear to me what you mean with this. Did you place the ta
Terry Reedy於 2017年10月20日星期五 UTC+8上午7時37分59秒寫道:
> On 10/19/2017 5:07 AM, jf...@ms4.hinet.net wrote:
>
> > I got some info below each time when I squeeze the table:
> > .
> > .5006
> > .5006.50712528
> > .5006.50712496
> > .5006.50712464
> > .5006.50712144
> > .5006.50712528.
Terry Reedy at 2017-10-20 UTC+8 AM 7:37:59 wrote:
> On 10/19/2017 5:07 AM, jf...@ms4.hinet.net wrote:
>
> > I got some info below each time when I squeeze the table:
> > .
> > .5006
> > .5006.50712528
> > .5006.50712496
> > .5006.50712464
> > .5006.50712144
> > .5006.507125
I learned python start from using v3.4 and never has any v2.x experience. There
is a Pypi project "ctypesgen" I like to use, but it seems is for v2.x.
(un)Fortunately I found one of its branch on github which announced is for
Python3, but strangely it still use some v2.x words, for example, prin
Ned Batchelder於 2017年11月11日星期六 UTC+8下午8時49分27秒寫道:
> This looks like fairly advanced code. It will be difficult to port to
> Python 3 *without* understanding some of the old history. There seem to
> be forks on GitHub, including one with a pull request about Python 3
> made in the last few days
Rick Johnson於 2017年11月12日星期日 UTC+8上午11時07分20秒寫道:
> `print` was changed from a statement to a function, so it's
> just a matter of converting it to a function call. If you
> read the docs for the new print function, it should be
> relatively easy to translate. I don't understand why you're
> having
Thomas Jollans於 2017年11月12日星期日 UTC+8下午5時17分38秒寫道:
> By all means, port ctypesgen to Python 3 (and publish your port) if you
> want to,
I am not the right person because I have never use Python2 before:-)
> but you might want to consider whether it's easier to port your
> code from ctypes/ctypesg
I have a multiline string, something like '''...\nf.write('\n')\n...'''
when pass to exec(), I got
SyntaxError: EOL while scanning string literal
How to get rid of it?
Best Regards,
Jach Fong
--
https://mail.python.org/mailman/listinfo/python-list
Random832於 2017年12月31日星期日 UTC+8下午1時25分50秒寫道:
> On Sat, Dec 30, 2017, at 23:57, jf...@ms4.hinet.net wrote:
> > I have a multiline string, something like '''...\nf.write('\n')\n...'''
> > when pass to exec(), I got
> > SyntaxError: EOL while scanning string literal
> >
> > How to get rid of it?
>
>
Lawrence D’Oliveiro於 2018年1月1日星期一 UTC+8上午7時56分02秒寫道:
> On Sunday, December 31, 2017 at 11:04:19 PM UTC+13, jf...@ms4.hinet.net wrote:
> >
> > This answer makes me think about '\' more thoughtful:-)
>
> Python generating HTML containing JavaScript which generates HTML:
>
> out.write \
>
ast於 2018年2月22日星期四 UTC+8下午8時33分00秒寫道:
> Hello
>
> I share a very valuable table I found on
> StackOverflow about file opening modes
>
> If like me you always forget the details of
> file opening mode, the following table provides
> a good summary
>
>| r r+ w w+ a a+
Lew Pitcher於 2018年2月23日星期五 UTC+8上午9時43分19秒寫道:
> jf...@ms4.hinet.net wrote:
>
> > ast於 2018年2月22日星期四 UTC+8下午8時33分00秒寫道:
> >> Hello
> >>
> >> I share a very valuable table I found on
> >> StackOverflow about file opening modes
> >>
> >> If like me you always forget the details of
> >> file opening
This function is in a DLL. It's small but may run for days before complete. I
want it takes 100% core usage. Threading seems not a good idea for it shares
the core with others. Will the multiprocessing module do it? Any suggestion?
Thanks ahead.
--Jach
--
https://mail.python.org/mailman/listi
eryk sun at 2016/9/27 11:44:49AM wrote:
> The threads of a process do not share a single core. The OS schedules
> threads to distribute the load across all cores
hmmm... your answer overthrow all my knowledge about Python threads
completely:-( I actually had ever considered using ProcessPoolE
eryk sun at 2016/9/28 1:05:32PM wrote:
> In Unix, Python's os module may have sched_setaffinity() to set the
> CPU affinity for all threads in a given process.
>
> In Windows, you can use ctypes to call SetProcessAffinityMask,
> SetThreadAffinityMask, or SetThreadIdealProcessor (a hint for the
> s
Paul Moore at 2016/9/28 11:31:50PM wrote:
> Taking a step back from the more detailed answers, would I be right to assume
> that you want to call this external function multiple times from Python, and
> each call could take days to run? Or is it that you have lots of calls to
> make and each on
Paul Moore at 2016/9/30 7:07:35PM wrote:
> OK. So if your Python code only calls the function once, the problem needs to
> be fixed in the external code (the assembly routine). But if you can split up
> the task at the Python level to make multiple calls to the function, each to
> do a part of
Chris Angelico at 2016/10/1 11:25:03AM wrote:
> What's it doing? Not every task can saturate the CPU - sometimes they
> need the disk or network more.
>
This function has no I/O or similar activity, just pure data processing, and it
takes less than 200 bytes of data area to work with.
My CPU is
I have two files in the Q:\lib directory:
Q:\lib>dir
2007/03/11 AM 08:025,260 lib_MARK.so
2007/03/11 AM 08:024,584 lib_mark.so
Under Python 3.4.4 I got:
>>> f = open('lib_MARK.so', 'br')
>>> data = f.read()
>>> f.close()
>>> len(data)
4584
I know Windows won't, but can Python
Hi, eryk, thanks for your solution.
I had try to find the document of the _winapi module, but can't find any in my
installed Python directory. Can you give me a link to look for?
> This alone doesn't make the Windows API case sensitive, but it does
> enable individual CreateFile calls to be case
wxjm...@gmail.com at 2016/10/11 9:40:21PM wrote:
> If you are about to modify your registry, do not
> forget to switch your Windows in a *utf-8 mode*.
Have no idea how to "switch" Windows in a "utf-8 mode"? What will happens if
not? Can you give a simple example? Thanks ahead.
--Jach
--
https:/
Running the following codes (deen.py) under Win32 python 3.4.4 terminal:
tbli = [0x66, 0x27, 0xD0]
tblm = [0 for x in range(3)]
def gpa(data):
td = data ^ tblm[2]
return td
I can get a correct answer this way:
>>> import deen
>>> deen.tblm = deen.tbli
>>> deen.gpa(0x7d)
173 # 0xad (= 0x7
Ned Batchelder at 2016/11/15 6:33:54AM wrote:
> > But I get a wrong answer this way:
> > >>> from deen import *
> > >>> tblm = tbli
> > >>> gpa(0x7d)
> > 125 # it's 0x7d, the tblm[2] is 0
> >
> > Why? why! why:-(
>
> Here you are assigning a value to your own tblm, not deen.tblm,
> so gpa does n
MRAB at 2016/11/15 11:31:41AM wrote:
> When you say "from deen import *" you're copying names and their
> references from the module's namespace to your local namespace:
>
> [module deen] [locally]
>
> tblm > [0, 0, 0] <- tb
Michael Torrie at 2016/11/15 10:43:58PM wrote:
> Seems like you're still not understanding Python variables.
I do, just not get used to it yet:-)
> However once
> you assign to these names in your current module you are breaking this
> link to the deen module and assigning a new object to th
Steve D'Aprano at 2016/11/16 8:33:23AM wrote:
> `import foo` imports the module foo, that is all. (To be pedantic: it is
> *nominally* a module. By design, it could be any object at all.)
>
> `from foo import *` imports all the visible public attributes of foo.
>
> They do completely different th
Michael Torrie at 2016/11/16 11:15:11AM wrote:
> ... The globals object is a dictionary and is itself
> mutable. But when we assign a new object to a particular dictionary
> key, it tosses out the old reference and makes the key now refer to the
> new object. It does not do anything to the old ob
Steven D'Aprano at 2016/11/17 12:06:19PM wrote:
> You understand how this works?
Yes, thank you for your detail explanation.
> import russia as _tmp
> president = _tmp.president
> del _tmp
This one I can understand. But the previous one
>>_tmp = int('5')
>>for name in dir(_tmp):
>>
Steven D'Aprano at 2016/11/17 4:04:04PM wrote:
> The most important thing you should learn from this thread is:
>
> - avoid using "from module import *" as it is usually more trouble
> than it is worth.
>
>
> It is confusing and leads to more problems than it solves. If Python was
> being
>
Michael Torrie at 2016/11/17 11:38:32PM wrote:
> Like I said, whether the names you use are appropriate is completely up
> to you. But this statement seems to imply you're still not getting it
> and still thinking of variables as boxes like they are in other
> languages, rather than labels that ca
Michael Torrie at 2016/11/18 11:03:12AM wrote:
> >> Python's variables are different from other languages, but in an
> >> understandable way.
> >
> > Unfortunately it's also different from human language.
>
> How so? I don't find this to be true at all.
The fact that most novices will stumble
I have a working list 'tbl' and recording list 'm'. I want to append 'tbl' into
'm' each time when the 'tbl' was modified. I will record the change by append
it through the function 'apl'.
For example:
>>>tbl=[0,0]
>>>m=[]
>>>tbl[0]=1
>>>apl(tbl)
>>>m
[[1,0]]
>>>tbl[1]=2
>>>apl(tbl)
>>>m
[[1,
Oh, I don't know slice well enough:-(
So, slice tbl[:] will create a new object (a copy of tbl) which can be passed
as a function argument
m.append(tbl[:])
or bind to a new name
w=tbl[:]
or re-bind to itself
w[:]=tbl
Thanks you, Ian and Steve.
Steve D'Aprano at 2016/11/19 11:01:26AM wrote:
>
Chris Angelico at 2016/11/19 2:58:41PM wrote:
> On Sat, Nov 19, 2016 at 3:34 PM, Steve D'Aprano
> wrote:
> > What happens if you do this?
> >
> > spam = eggs = cheese = obj
> >
> > Is that different from:
> >
> > spam = obj
> > eggs = obj
> > cheese = obj
> >
> >
> > or from this?
> >
> > spam = o
Peter Otten at 2016/11/19 5:40:34PM wrote:
> And now for something completely different ;)
>
> What if you only record the changes to the list? For a long list that would
> save space at the expense of calculation time. For example:
Excellent! Although not 100% fit into my application, I must st
Tristan B. Kildaire at 2016/11/20 8:23:37PM wrote:
> From deen import * imports all the things in deen but accessable with no
> `deen.`
These "accessible" objects become read-only even if it's mutable. For immutable
objects, you can't even create a new one in the deen's namespace.
> import deen
D:\Temp>py
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> '{:02X}'.format(256)
'100'
>>>
What I expected is '00'. Am I wrong?
Best Regards,
Jach Fong
--
https://mail.python.
Chris Angelico於 2018年3月20日星期二 UTC+8上午8時06分05秒寫道:
> On Tue, Mar 20, 2018 at 10:46 AM, wrote:
> > D:\Temp>py
> > Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32
> > bit (Intel)] on win32
> > Type "help", "copyright", "credits" or "license" for more information.
> '{:0
I am new to the asyncio subject, just trying to figure out how to use it. Below
is the script I use for testing:
-
# asyncio_cancel_task2.py
import asyncio
@asyncio.coroutine
def task_func():
print('in task_func, sleeping')
try:
yield from asyncio.
Ian於 2018年4月2日星期一 UTC+8下午9時37分08秒寫道:
> On Mon, Apr 2, 2018 at 5:32 AM, wrote:
> > I am new to the asyncio subject, just trying to figure out how to use it.
> > Below is the script I use for testing:
> > -
> > # asyncio_cancel_task2.py
> >
> > import asyncio
> >
>
Ian於 2018年4月3日星期二 UTC+8下午1時38分57秒寫道:
> On Mon, Apr 2, 2018 at 9:01 PM, wrote:
>
> def run_forever(self):
> """Run until stop() is called."""
>try:
> events._set_running_loop(self)
> while True:
> self._run_once()
> if se
I have a module below and run it under pdb, the result seems not easy to xplain.
(Note: the sleep periods are in reverse order)
---
# asyncio_as_completed.py
import asyncio
@asyncio.coroutine
def phase(i):
print('in phase {}'.format(i))
yield from asyncio.sleep(0.5 - (0.1 * i)
This C function returns a buffer which I declared it as a ctypes.c_char_p. The
buffer has size 0x1 bytes long and the valid data may vary from a few bytes
to the whole size.
In every call I know how much the valid data size is, but I suppose I can't use
slice to get it because there may be
Chris Angelico於 2018年4月12日星期四 UTC+8下午1時31分35秒寫道:
> On Thu, Apr 12, 2018 at 2:16 PM, wrote:
> > This C function returns a buffer which I declared it as a ctypes.c_char_p.
> > The buffer has size 0x1 bytes long and the valid data may vary from a
> > few bytes to the whole size.
> >
> > In eve
Chris Angelico於 2018年4月12日星期四 UTC+8下午4時05分29秒寫道:
> On Thu, Apr 12, 2018 at 4:20 PM, wrote:
> > Chris Angelico於 2018年4月12日星期四 UTC+8下午1時31分35秒寫道:
> >> On Thu, Apr 12, 2018 at 2:16 PM, wrote:
> >> > This C function returns a buffer which I declared it as a
> >> > ctypes.c_char_p. The buffer has s
I am wondering the role of the moderator.
Does he own the server or pay the bill? Where he get the power to suspending
people? Is he a police or judge? Can he shoot someone just because he has any
reason?
What will happen if his power was limited? Will the forum be end in disorder?
No, I don't
Richard Damon at 2018.10.9 UTC+8 PM 8:40:29 wrote:
> Moderators are generally appointed by those who do 'pay the bill' for
> the mailing list they are moderators for, and serve at their pleasure.
> Mailing List are generally 'private property', though often made open to
> the public for general use
Chris Angelico at 2018.10.10 UTC+8 AM 10:31:33 wrote:
> On Wed, Oct 10, 2018 at 1:21 PM wrote:
> > I switched from comp.lang.python to mailing list a few months ago for those
> > spam threads there. Now it seems a bad decision because 1) replied mail can
> > be lost or duplicated or even banned
I saw a directory where all its filenames are something like this:
...
1a PSG (Entry and PopUp).py
1b PSG (Format).py
1c PSG (persistent form and bind key).py
...
Just wondering how these file can run and debugged under Windows?
--Jach
--
https://mail.python.org/mailman/listinfo/python-list
Chris Angelico於 2018年10月12日星期五 UTC+8下午4時39分37秒寫道:
> On Fri, Oct 12, 2018 at 6:26 PM wrote:
> >
> > I saw a directory where all its filenames are something like this:
> > ...
> > 1a PSG (Entry and PopUp).py
> > 1b PSG (Format).py
> > 1c PSG (persistent form and bind key).py
> > ...
> >
> > Just won
class StructureMeta(type):
def __init__(self, clsname, bases, clsdict):
offset = 0
...
...
setattr(self, 'struct_size', offset)
class Structure(metaclass=StructureMeta):
...
...
class PolyHeader(Structure):
...
...
As my understanding, the meta
Gregory Ewing at 2018/10/16 UTC+8 PM 2:01:01 wrote
> jf...@ms4.hinet.net wrote:
> > class Structure(metaclass=StructureMeta): ...
> >
> > class PolyHeader(Structure): ...
> >
> > As my understanding, the metaclass's __init__ was called when a class was
> > created. In the above example, both the
dieter at 2018/10/17 UTC+8 PM 1:15:01 wrote:
> jf...@ms4.hinet.net writes:
> > Gregory Ewing at 2018/10/16 UTC+8 PM 2:01:01 wrote
> >> jf...@ms4.hinet.net wrote:
> >> > class Structure(metaclass=StructureMeta): ...
> >> >
> >> > class PolyHeader(Structure): ...
> >> >
> >> > As my understanding,
Just curious:-) why everyone here open the csv file without using newline='' as
suggested in Python 3.4.4 document section 14.1?
--
https://mail.python.org/mailman/listinfo/python-list
I have a dictionary like this:
>>> dct ={1: 'D', 5: 'A', 2: 'B', 3: 'B', 4: 'E'}
The following code works:
>>> for k in dct: print(k, dct[k])
...
1 D
2 B
3 B
4 E
5 A
and this one too:
>>> for k,v in dct.items(): print(k,v)
...
1 D
2 B
3 B
4 E
5 A
But...this one?
>>> for k,v in dct: print(k,v
I was overwhelmed that three gurus inspire me in three different ways in their
own flavour:-) That's really appreciated! Now I understand why it's so, thanks
to all of you.
To Peter:
> With that information, can you predict what
> for k, v in {(1, 2): "three"}: print(k, v)
> will print?
It's
DFS at 2016/5/2 UTC+8 11:39:33AM wrote:
> To save a webpage to a file:
> -
> 1. import urllib
> 2. urllib.urlretrieve("http://econpy.pythonanywhere.com
> /ex/001.html","D:\file.html")
> -
>
> That's it!
Why my system can
DFS at 2016/5/3 9:12:24AM wrote:
> try
>
> from urllib.request import urlretrieve
>
> http://stackoverflow.com/questions/21171718/urllib-urlretrieve-file-python-3-3
>
>
> I'm running python 2.7.11 (32-bit)
Alright, it works...someway.
I try to get a zip file. It works, the file can be unzippe
Stephen Hansen at 2016/5/3 11:49:22AM wrote:
> On Mon, May 2, 2016, at 08:27 PM, jf...@ms4.hinet.net wrote:
> > But when I try to get this forum page, it does get a html file but can't
> > be viewed normally.
>
> What does that mean?
>
> --
> Stephen Hansen
> m e @ i x o k a i . i o
The page
Is there any tools which can do the memory dump of an object so I can view
their content or implementation? For example,
>>> s1 = '\x80abc'
>>> b1 = b'\x80abc'
What are exactly stored in memory for each of them? Is their content really the
same? This kind of tool should be helpful "for me" to l
Sorry, forget to mention that I am working on version 3.4
Following the steps given in Chris's reply, I get the result from bytes string:
>>> b1 = b'\x80abc'
>>> ctypes.cast(id(b1), ctypes.c_voidp)
c_void_p(35495992)
>>> sys.getsizeof(b1)
21
>>> b1ptr = ctypes.cast(id(b1), ctypes.POINTER(ctypes.c
Make a quick experiment under version 3.4.4 through this simple "tool" Chris
had provided, now I know how the unicode string was stored in memory:-)
>>> s1 = '\x80abc'
>>> s1
'\x80abc'
>>> len(s1)
4
>>> sys.getsizeof(s1)
41
>>> s1ptr = ctypes.cast(id(s1), ctypes.POINTER(ctypes.c_uint8))
>>> bytes
Pushpanth Gundepalli at 2016/6/21 7:03:28PM wrote:
> Guys, can you please share me some sites where we can practice python
> programs for beginners and Intermediate.
Is this you want? http://pythontutor.com/
--Jach
--
https://mail.python.org/mailman/listinfo/python-list
Anyone who wrote the code below must be insane:-)
for x in range(3):
print(x)
else:
print('I am done')
But here it seems perfectly OK:
for x in range(3):
print(x)
if x == 1: break
else:
print('I am done')
To me, the "else" was bonded with
Steven D'Aprano at 2016/6/29 UTC+8 10:43:52AM wrote:
> The "else" in for...else has nothing to do with any "if" inside the for
> block.
Yes, the "else" has nothing to do with "break" syntactically in Python
language, but semantically in English it cause confusion. When I said "insane",
I just wa
Steven D'Aprano at 2016/6/30 7:59:40AM wrote:
> py> mi = list('bananas')
> py> for char in mi:
> ... if char == 'a':
> ... mi.extend(' yum')
> ... print(char, end='')
> ... else: # oh no, the feared for...else!
> ... # needed to prevent the prompt overwriting the output
> .
>>> 00
0
>>> 03
File "", line 1
03
^
SyntaxError: invalid token
>>>
Any particular reason?
--
https://mail.python.org/mailman/listinfo/python-list
MRAB at 2018/12/8 UTC+8 AM10:04:51 wrote:
> Before Python 3, a leading 0 in an integer literal would indicate an
> octal (base 8) number.
So, the reason is historical.
> The old form is now invalid in order to reduce the chance of bugs.
I encounter this problem on trying to do something like th
Ian at 2018/12/8 UTC+8 AM11:28:34 wrote:
> What is it exactly that you're trying to accomplish with this? Perhaps
> there's a better way than using eval.
This problem comes from solving a word puzzle,
ab + aa + cd == ce
Each character will be translate to a digit and evaluate the correctness,
I can understand the difficulty of throwing old thing away and accept new one
in human. There seems have a huge inertia there. This phenomenon appears on
every aspects, not only on the transition from Python2 to Python3. But, as a
new comer of Python like me, I have no difficulty to accept it be
Avi Gross at 2018/12/8 UTC+8 PM2:09:20 wrote:
> [[READERS DIGEST CONDENSED ANSWER: use int("string") ]]
>
> Since we all agree python will not make notations like "05" work
> indefinitely, and the need expressed is how to solve a symbolic puzzle (see
> message below) then it makes sense to look at
Grant Edwards於 2018年12月9日星期日 UTC+8上午12時52分04秒寫道:
> On 2018-12-08, Cameron Simpson wrote:
> > On 07Dec2018 20:24, Jach Fong wrote:
> >>Ian at 2018/12/8 UTC+8 AM11:28:34 wrote:
> >>> What is it exactly that you're trying to accomplish with this? Perhaps
> >>> there's a better way than using eval.
>
Avi Gross於 2018年12月9日星期日 UTC+8上午1時40分26秒寫道:
> Jach,
>
> Just for fun, I looked at the puzzle you asked about and solved it several
> ways without running into your 03 problem at all. There are more efficient
> solutions than total brute force.
>
> Anyone not interested, stop here, please. After
Chris Angelico於 2018年12月10日星期一 UTC+8下午6時17分14秒寫道:
> On Mon, Dec 10, 2018 at 9:11 PM Antoon Pardon wrote:
> >
> > On 10/12/18 11:03, Chris Angelico wrote:
> > > Considering that, in a problem of that description, neither S nor M
> > > may represent zero, I don't think there's a problem here.
> >
>
Chris Angelico於 2018年12月10日星期一 UTC+8下午7時09分01秒寫道:
> On Mon, Dec 10, 2018 at 9:46 PM wrote:
> >
> > Chris Angelico於 2018年12月10日星期一 UTC+8下午6時17分14秒寫道:
> > > On Mon, Dec 10, 2018 at 9:11 PM Antoon Pardon
> > > wrote:
> > > >
> > > > On 10/12/18 11:03, Chris Angelico wrote:
> > > > > Considering tha
Just for fun:-) On my ooold PC, it takes 0.047 seconds to run the following
algorithm on the problem 'SNED + MORE == MONEY".
-
import time
import itertools
#S, E, N, D, M, O, R, Y
n = 0
digits = {x for x in range(10)}
def tenThousand(u, Cin): # Cin == M
global n
Appreciate your thoughtfully analysis on this code. Before generalize it with
arbitrary additions, as Peter suggested:-), a recursive version is needed. I
may give it a try on this Sunday.
Avi Gross at 2018/12/15 UTC+8 AM8:13:37 wrote:
> REAL SUBJECT: Analysis of alternate algorithms.
>
> Pete
BlindAnagram at 2018/12/15 UTC+8 PM 8:41:21 wrote:
> On 15/12/2018 09:56, jf...@ms4.hinet.net wrote:
> > Appreciate your thoughtfully analysis on this code. Before generalize it
> > with arbitrary additions, as Peter suggested:-), a recursive version is
> > needed. I may give it a try on this Sun
I saw the code below at stackoverflow. I have a little idea about the scope of
a class, and list comprehension and generator expressions, but still can't
figure out why Z4 works and Z5 not. Can someone explain it? (in a
not-too-complicated way:-)
class Foo():
XS = [15, 15, 15, 15]
Z4 =
eryk sun於 2018年12月27日星期四 UTC+8下午2時31分58秒寫道:
> On 12/26/18, jf...@ms4.hinet.net wrote:
> > I saw the code below at stackoverflow. I have a little idea about the scope
> > of a class, and list comprehension and generator expressions, but still
> > can't figure out why Z4 works and Z5 not. Can someon
eryk sun at 2018/12/27 UTC+8 PM 6:58:33 wrote:
> On 12/27/18, jf...@ms4.hinet.net wrote:
> >
> > I still don't get it. When I change it to using list comprehension, the
> > problem is still there. (it now has no late-binding variable, right? :-)
> >
> class Too:
> > ... XS = [15, 15, 15,
jf...@ms4.hinet.net於 2018年12月28日星期五 UTC+8下午4時04分07秒寫道:
> eryk sun at 2018/12/27 UTC+8 PM 6:58:33 wrote:
> > On 12/27/18, jf...@ms4.hinet.net wrote:
> > >
> > > I still don't get it. When I change it to using list comprehension, the
> > > problem is still there. (it now has no late-binding variable
I had download a module which has the following directory structure:
[XL-Sudoku-Solver_master]
|__[tests]
|__[xl_sudoku_solver]
|__setup.py |__ __init__.py
|__problem1.txt |__ __main__.py
|__README.md |__ ...
|__ ...
The setup.py file has something like this:
Peter Otten於 2019年1月14日星期一 UTC+8下午4時04分33秒寫道:
> jf...@ms4.hinet.net wrote:
>
> > I had download a module which has the following directory structure:
> >
> > [XL-Sudoku-Solver_master]
> > |__[tests]
> > |__[xl_sudoku_solver]
> > |__setup.py |__ __init__.py
> > |__problem1.txt |__
Prahallad Achar於 2019年2月15日星期五 UTC+8下午5時27分36秒寫道:
> I get list object instead gen obj
>
> On Fri, 15 Feb 2019, 13:57 Chris Angelico
> > On Fri, Feb 15, 2019 at 6:57 PM Prahallad Achar
> > wrote:
> > >
> > > How about this
> > > List1=[ 1,2,3,4]
> > > Rever_gen = ( x*x for x in list1, reversed
The file below is a simple script to test this package.
-
# test_asynctk.py
import asynctk as atk
root = atk.AsyncTk()
def delay5S():
btn0.after(5000)
def inc1():
msgs = btn1.cget('text').split()
n = int(msgs[1])
msg = msgs[0] + ' ' + str(n+1)
btn1.config(text=msg
ast於 2019年2月26日星期二 UTC+8上午12時25分40秒寫道:
> Hello
>
> I noticed a quirk difference between classes and functions
>
> >>> x=0
> >>>
> >>> class Test:
> x = x+1
> print(x)
> x = x+1
> print(x)
>
> 1
> 2
> >>> print(x)
> 0
>
> Previous code doesn't generate any
Gregory Ewing at 2019/2/27 AM 5:26:49 wrote:
> Thomas Jollans wrote:
> > I imagine there's a justification for the difference in behaviour to do
> > with the fact that the body of a class is only ever executed once, while
> > the body of a function is executed multiple times.
>
> I suspect there i
Chris Angelico於 2019年2月27日星期三 UTC+8上午9時25分11秒寫道:
> On Wed, Feb 27, 2019 at 12:21 PM wrote:
> >
> > Gregory Ewing at 2019/2/27 AM 5:26:49 wrote:
> > > Thomas Jollans wrote:
> > > > I imagine there's a justification for the difference in behaviour to do
> > > > with the fact that the body of a class
Chris Angelico於 2019年2月27日星期三 UTC+8上午11時29分04秒寫道:
> On Wed, Feb 27, 2019 at 2:21 PM wrote:
> >
> > Chris Angelico於 2019年2月27日星期三 UTC+8上午9時25分11秒寫道:
> > > On Wed, Feb 27, 2019 at 12:21 PM wrote:
> > > >
> > > > Gregory Ewing at 2019/2/27 AM 5:26:49 wrote:
> > > > > Thomas Jollans wrote:
> > > > >
jf...@ms4.hinet.net於 2019年2月26日星期二 UTC+8下午4時46分04秒寫道:
> ast於 2019年2月26日星期二 UTC+8上午12時25分40秒寫道:
> > Hello
> >
> > I noticed a quirk difference between classes and functions
> >
> > >>> x=0
> > >>>
> > >>> class Test:
> > x = x+1
> > print(x)
> > x = x+1
> > p
Sayth Renshaw at 2019/2/3 UTC+8 AM9:52:50 wrote:
> Or perhaps use a 3rd party library like
> https://github.com/mikeckennedy/python-switch
Thank you for this link. It's a good general implementation.
--Jach
--
https://mail.python.org/mailman/listinfo/python-list
For example, there is a file test0.py:
-
1 def foo():
2 for i in range(3):
3 print(i)
4
5 x = 0
-
I start the debug session as below. My question is why the break point at line
3 didn't work. How to debug the function foo() at this time?
D:\Works\Python>py -m pdb t
Correct me if I am wrong, please.
I always think that the LEGB rule (e.g. the namespace to look up for) was
applied at compile-time, only the binding was resolved "dynamically" at
run-time. For example:
def foo():
print(x)
foo() will cause a NameError. But after
x = 5
foo() will run corr
Chris Angelico於 2019年5月18日星期六 UTC+8下午3時09分37秒寫道:
> On Sat, May 18, 2019 at 1:51 PM wrote:
> >
> > Correct me if I am wrong, please.
> >
> > I always think that the LEGB rule (e.g. the namespace to look up for) was
> > applied at compile-time, only the binding was resolved "dynamically" at
> > ru
Below is a simplified version of the sample script downloaded from its package.
When run it, the entry field display '0' instead of 'P&W'.
PS. I am using Python 3.4.4, Windows 32bit
test0.py
1 from tkinter import tix as Tix
2
3 root = Tix.Tk()
4
5 demo_maker = Tix.StringVar()
6 dem
MRAB於 2019年6月2日星期日 UTC+8上午10時18分36秒寫道:
> On 2019-06-02 02:28, jf...@ms4.hinet.net wrote:
> > Below is a simplified version of the sample script downloaded from its
> > package.
> > When run it, the entry field display '0' instead of 'P&W'.
> > PS. I am using Python 3.4.4, Windows 32bit
> >
> > --
1 - 100 of 215 matches
Mail list logo