Hi, folks.
I know that it is not possible to change local vars via `locals()` (except
in module-level).
```
import sys
def f1():
x = 1
d = locals()
d['x'] = 2
print(x) #=> 1 (not changed)
f1()
```
But I found that it is possible in class definition.
```
import sys
class
created a pull request. This will be shown to my students.
https://github.com/dotancohen/burton/pull/20/files
I hope you favor this PR.
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
unds=5):
self.report()
for _ in range(n_rounds):
self.round()
self.report()
if __name__ == '__main__':
Race(3).run(5)
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
, but didn't find bad Python code.
--
regards,
makoto kuwata
On Wed, Feb 15, 2017 at 3:28 PM, Steven D'Aprano <st...@pearwood.info>
wrote:
> On Wed, 15 Feb 2017 07:44:03 +0900, Makoto Kuwata wrote:
>
> > Hi,
> >
> > Is there any *just right* python code to refactor?
>
Hi,
Is there any *just right* python code to refactor?
In other words, I'm finding bad code example in python.
(background)
I'm teaching Python to some novice programmer, and
want to show refactoring example to them.
(required)
* not good code
* not too large (for novice programmer)
* not too
On Wed, Jun 8, 2016 at 10:24 PM, Michael Selik
wrote:
> By the way, why choose to write, import, and delete modules? I'd think
> exec'ing code would be sufficient.
>
>
In order to test my own framework for web application.
It loads controller classes lazily. In other
On Tue, Jun 7, 2016 at 7:28 AM, Michael Selik <michael.se...@gmail.com>
wrote:
> On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata <k...@kuwata-lab.com> wrote:
>
>> I have a trouble around __import__().
>>
>
> The docs for __import__ strongly recommend th
On Sat, Jun 4, 2016 at 3:15 AM, MRAB <pyt...@mrabarnett.plus.com> wrote:
> On 2016-06-03 06:48, Makoto Kuwata wrote:
>
> On Fri, Jun 3, 2016 at 9:31 AM, MRAB <pyt...@mrabarnett.plus.com > pyt...@mrabarnett.plus.com>> wrote:
>>
>> On 2016-06-02 15:04
On Thu, Jun 2, 2016 at 11:15 PM, Michael Selik <michael.se...@gmail.com>
wrote:
>
>
> On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata <k...@kuwata-lab.com> wrote:
>
>> os.mkdir(name)
>> with open(name + "/__init__.py&quo
Hi,
I have a trouble around __import__().
The following sample code works well on Python <= 3.3,
but it raises ImportError on Python >= 3.4.
## importtest.py
import sys, os, shutil
def test(name):
try:
## create 'foo/__init__.py' file
os.mkdir(name)
(*args, **kwargs)
return newfunc
@multiply 4 # ex: @decorator arg1, arg2, arg3
def f1(x, y):
return x+y
How do you think about this idea?
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
properties in command-line.
* Add description about user-defined properties.
* Fix example code to work on Python 2.6.
* Fix test script.
--
regards,
makoto kuwata
On Mon, Dec 15, 2014 at 9:43 PM, Makoto Kuwata k...@kuwata-lab.com wrote:
I released Benchmarker ver 4.0.0
http://pypi.python.org/pypi
(= 0.5100 - 0.0335)
===
See http://pythonhosted.org/Benchmarker/ for details.
Have fun!
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
Question about 'yield from'.
I understand that::
yield from xs
is syntax suger of::
for x in xs:
yield x
And::
val = yield from xs
is same as::
for x in xs:
ret = yield x
val = ret
Is it true? Do I understand correctly?
quote from
On Thu, Aug 14, 2014 at 6:38 PM, Chris Angelico ros...@gmail.com wrote:
On Thu, Aug 14, 2014 at 7:35 PM, Makoto Kuwata kwa...@gmail.com wrote:
I understand that::
yield from xs
is syntax suger of::
for x in xs:
yield x
Not just. It's like that for simple cases
On Thu, Aug 14, 2014 at 7:02 PM, Chris Angelico ros...@gmail.com wrote:
On Thu, Aug 14, 2014 at 7:59 PM, Makoto Kuwata kwa...@gmail.com wrote:
I understand that 'val = yield from xs' is completely different from::
for x in xs:
ret = yield x
val = x
Return value
-py_CHANGES.txt for details.
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
):
File hoge.py, line 7, in module
obj = Foo()
TypeError: Required argument 'year' (pos 1) not found
It seems to be failed to override datetime.__init__() in subclass.
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
, but the issue you're seeing is
specific to that class.
Got it! Thank you!
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
Sorry, I failed to post reply:
-- Forwarded message --
From: Makoto Kuwata k...@kuwata-lab.com
Date: Wed, Jun 18, 2014 at 5:32 PM
Subject: Re: Backport fix on #16611 to Python 2.7
To: Terry Reedy tjre...@udel.edu
On Wed, Jun 18, 2014 at 12:31 PM, Terry Reedy tjre...@udel.edu
: Is there any plan to backport the fix to Python 2.7?
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
')),
age: V('age', type=int, between=(15, 18)),
birthday: V('created_at', pattern=r'^\d\d\d\d-\d\d-\d\d$')
}
}
See users guide for details.
http://www.kuwata-lab.com/oktest/oktest-py_users-guide.html#validator
--
regars,
makoto kuwata
--
https
'), SHA1).hexdigest()
sig = HMAC.new(self.secret, val, SHA1).hexdigest()
return str(val), (%s%s % (sig, val))
SignedCookie.value_encode = value_encode
##
waitress.serve(app, port=8080)
--
--
regards,
makoto kuwata
Congrat!
By the way, I can't find Python-3.3.4.tar.bz2 in:
http://www.python.org/ftp/python/3.3.4/
Python-3.3.{1,2,3}.tar.bz2 and Python-3.4.0.tar.bz2 are provided,
but Python-3.3.4.tar.bz2 is not. Why?
# I hope that Python-3.3.4.tar.bz2 is also provided.
--
regards,
makoto kuwata
On Tue
OK'
ok (headers) == [('Content-Type', 'application/json')]
ok (body)== [b'''{message:Hello!}''']
if __name__ == '__main__':
oktest.main()
--
regars,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
://www.kuwata-lab.com/oktest/oktest-py_CHANGES.txt
Have fun!
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
}
## but actual is: {'x': 0}
Python: 2.7.3
OS: MacOS X
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
way to use STORE_FAST instead of STORE_NAME?
exec(string, ...) is not a solution for me.
# What is different between fn.func_code and compile(string)?
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
.
Thank you Ned, I'm clear.
You mean that there is no environment variable equivarent to options,
therefore I should create configuration file of distutils.
I'll try it. Thank you.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
or --install-scripts options, but it is
too troublesome for me to specify them in command line every time.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Jun 10, 2012 at 11:55 AM, Ned Deily n...@acm.org wrote:
In article
caftm5rucoaztp89mbpw4utiska8zq58q9evjel1ofulbc-p...@mail.gmail.com,
Makoto Kuwata k...@kuwata-lab.com wrote:
Hi,
setup.py install command supports options such as --prefix,
--install-scripts, and so
)
* [Enhance] Now supports PyPy 1.7 or later officially.
* [Change] Template#convert() now converts \r\n into \\r\n.
This is necessary to follow change of language specification on
Python 2.7 and 3.2.
Have fun!
--
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
I released Oktest.py 0.11.0.
http://pypi.python.org/pypi/Oktest/
http://packages.python.org/Oktest/
Oktest.py is a new-style testing library for Python.
::
from oktest import ok, NG
ok (x) 0 # same as assertTrue(x 0)
ok (s) == 'foo'# same as
Is it possible to specify PREFIX directory for pip command by
environment variable?
I found that 'pip install --install-option=--prefix=PREFIX' works well,
but I don't want to specify '--install-option=--prefix=PREFIX' every time.
I prefer to specify it by environment variable such as::
On Tue, Nov 15, 2011 at 11:33 PM, Marc Christiansen
use...@solar-empire.de wrote:
I'd try
export PIP_INSTALL_OPTION=--prefix=$PWD/local
It works very well. Thank you.
--
regards,
makoto
using a config file is also possible. See
http://www.pip-installer.org/en/latest/configuration.html
string N times.
- [passed] returns empty string when N is negative.
## total:2, passed:2, failed:0, error:0, skipped:0, todo:0
See http://pypi.python.org/pypi/PicoTest for details.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
be sure to test both
ways.
'package_data' is the solution for my trouble.
Thank you very much, Jonathan.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
' into .egg file
--regads,makoto kuwata
On Sat, Nov 5, 2011 at 3:06 PM, Makoto Kuwata k...@kuwata-lab.com wrote:
Hi,
I have released pyKook 0.7.0.
http://pypi.python.org/pypi/Kook/
http://www.kuwata-lab.com/kook/
http://www.kuwata-lab.com/kook/pykook-users-guide.html
In this release, you
On Wed, Nov 9, 2011 at 4:09 AM, Terry Reedy tjre...@udel.edu wrote:
On 11/7/2011 11:32 PM, Makoto Kuwata wrote:
I got trouble about easy_install command.
My package:
README.rst
setup.py
foobar/
foobar/__init__.py
foobar/data/
foobar/data/template.py
In the above example
On Thu, Nov 10, 2011 at 9:58 AM, Makoto Kuwata k...@kuwata-lab.com wrote:
On Wed, Nov 9, 2011 at 4:09 AM, Terry Reedy tjre...@udel.edu wrote:
On 11/7/2011 11:32 PM, Makoto Kuwata wrote:
I got trouble about easy_install command.
My package:
README.rst
setup.py
foobar/
foobar
' doesn't contain
'foobar/data/template.py' file.
Question: how can I enforce easy_install command to
install 'foobar/data/template.py' (or non-package *.py file)?
--
regars,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
] spec3
## total:3, passed:3, failed:0, error:0, skipped:0 (elapsed 0.000)
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
) kook.config.stdout and kook.config.stderr are removed.
See http://www.kuwata-lab.com/kook/pykook-CHANGES.txt for details.
Have fun!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
(Greeting.hello)
#= type 'instancemthod'
print(*** type(Greeting.goodbye)=%r % type(Greeting.goodbye)
#= type 'instancemthod'
Could you give me advice?
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
(object):
def hello():
print(Hello!)
# Python 2.5
class Greeting(object):
def hello():
print(Hello!)
Greeting = FuncGroup(Greeting)
This is so good method.
Thank you, Ian.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
.
Have fun!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
I published presentation slide about Oktest.
If you have interested in testing, check it out.
http://www.slideshare.net/kwatch/oktest-a-new-style-testing-library-for-python
--
regards,
makoto kuwata
On Sat, Aug 27, 2011 at 9:37 PM, Makoto Kuwata k...@kuwata-lab.com wrote:
Hi,
I released
()``.
* (Experimental) ``skip()`` and ``@skip.when()`` are provided to skip tests::
See CHANGES.txt for details.
http://packages.python.org/Oktest/CHANGES.txt
Have a nice testing life!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
by elishowk, thank you!)
Thank you.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
this limitation exist?
I want to chain methods as a certain DSL, just like:
@recipe().product('*.html').ingreds('$(1).rst')
def file_html(c):
system(c%rst2html.py $(ingred) $(product))
If you know the reason of the restriction, let me know it.
--
regards,
makoto kuwata
--
http
.
Is there any technical reason? Or Ideological reason?
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Feb 17, 2011 at 11:40 AM, MRAB pyt...@mrabarnett.plus.com wrote:
On 17/02/2011 01:55, Makoto Kuwata wrote:
Thank you MRAB,
On Thu, Feb 17, 2011 at 8:49 AM, MRABpyt...@mrabarnett.plus.com wrote:
You may want to read the discussion at:
https://groups.google.com/group/python-ideas
()`` to print correct traceback if ok() is called from
nested function.
* fix content of README.txt.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
.
* Benchmark.stat
* Benchmark.compared_matrix()
* Benchmark.print_compared_matrix()
Have fun!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
() == ...'.
* fix example code for some helper functions.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
oktest.tracer import Tracer
tr = Tracer()
f = tr.fake_func(f, dummy)
## call function
ok (f(3)) == 'x=3'
## check results
ok (tr[0]) == [None, 'f', (3,), {}, 'x=3']
Have a nice weekend!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
-
* Fixed to set correct file path of template object which is loaded
from cache.
* Fixed a bug that 'pytenjin -sbN' didn't trim line number on the last line
Have fun!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
' to '%9.3f'
* Changed to run full-GC for each benchmarks
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
Terry,
Thank you for trying Benchmarker.
On Sun, Jun 27, 2010 at 7:15 AM, Terry Reedy tjre...@udel.edu wrote:
On 6/26/2010 1:09 PM, Makoto Kuwata wrote:
I released Benchmarker 1.1.0.
http://pypi.python.org/pypi/Benchmarker/
Benchmarker is a small utility to benchmark your code.
Example
* enhanced to support 'ok (x).in_delta(y, d)' which raises assertion exception
unless y-d x y+d.
* change test script to support Python 2.7 and 3.x.
* fixed a few bugs.
Have fun!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
(f).raises(ValueError)
ok (f.exception.message) == invalid literal for int() with base
10: 'foobar'
* Changed to flush output after '.'/'f'/'E' printed
* Change to get exception message by 'str(ex)' instead of 'ex.message'
Have fun!
--
regards,
makoto kuwata
--
http://mail.python.org
### * all (recipe=task_all)
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
Changes by makoto kuwata:
--
components: Library (Lib)
nosy: kwatch
severity: normal
status: open
title: os.times() returns uncorrect value
type: behavior
versions: Python 2.5
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2205
makoto kuwata added the comment:
I'm sorry to put empty submit.
os.time() returns incorrect value.
test.py:
def f(n):
if n = 0:
return 1
else:
return f(n-1) + f(n-2)
import os
t1 = os.times()
f(34)
t2 = os.times()
utime = t2[0
makoto kuwata added the comment:
See
http://groups.google.com/group/comp.lang.python/browse_thread/thread/8032897a30781df/c656a79d4c3268a6
for details about this bug.
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2205
.
Fixed to print \n.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
and sys.argv[1] == 'egg_info':
- from ez_setup import use_setuptools
- use_setuptools()
-from distutils.core import setup
+from ez_setup import use_setuptools
+from setuptools import setup
-name = 'pyTenjin'
+name = 'Tenjin'
version = '0.6.1'
author = 'makoto kuwata'
email
On 2008-02-25, Richard Jones [EMAIL PROTECTED] wrote:
makoto kuwata wrote:
Is it required to set registered name (Tenjin) and
package name (pyTenjin) into same name?
Yes.
Thank you, Richard.
Your answer helps me very much.
How did you upload those files with a different name
.
Could you help me why the above error happen?
Is it required to set registered name (Tenjin) and
package name (pyTenjin) into same name?
--
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
/tenjin/pytenjin-examples.html
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
at:
http://www.kuwata-lab.com/support/
Release 0.6.1:
[Enhancements]
* Benchmark script ('benchmark/bench.py') is rewrited.
* Benchmark supports Genshi, Mako, and Templetor.
* Add examples.
[Bugfix]
* Typo in User's Guide is fixed.
--
makoto kuwata
--
http://mail.python.org/mailman
71 matches
Mail list logo