Thread View: pl.comp.lang.python
1 messages
1 total messages
Started by tikan
Thu, 22 Jul 2010 21:22
dziwne zachowanie modułu profile
Author: tikan
Date: Thu, 22 Jul 2010 21:22
Date: Thu, 22 Jul 2010 21:22
31 lines
1848 bytes
1848 bytes
Witam
Bawiłem się ostatnio profilingiem w pythonie i natknąłem się na
następujące dziwne zachowanie - kod (przykład jest oczywiście
maksymalnie uproszczony):
import profile
a=10
profile.run('a=20', 'result.txt')
print(a)
def f():
a = 10
profile.run('a=20', 'result.txt')
print(a)
f()
Wypisuje na ekran
10
20
Testowałem na pythonie 2.6 i 3.1. Zamiana profile na cProfile nie
powoduje zmiany zachowania.
Wynik jest zgodny z oczekiwaniami (20, 20) Jeśli zamiast profile.run
użyję zwykłego exec.
Czy ktoś zetknął się może z tym problemem?
Pozdrawiam
Krzysztof Chmiel
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads