[Python-Dev] 2.3 startup speed?
Skip Montanaro
skip@pobox.com
Fri, 11 Jul 2003 10:50:10 -0500
--oAEwk5Z4e1
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit
Jeremy> I'd like to avoid importing re at all if it isn't needed. If
Jeremy> you write a simple script and care about it's startup time, it
Jeremy> would be nice if Python didn't require you to load re just to
Jeremy> ignore Overflow warnings.
You lost me. If the pattern is a simple string, only the code in the
warnings module needs re and the functions which need it can import it
themselves. I've been running with the attached diff for some time with no
problems (since the last time we discussed this topic). Why does the user
of the warnings module need to import re?
Skip
--oAEwk5Z4e1
Content-Type: application/octet-stream
Content-Disposition: attachment;
filename="warnings.diff"
Content-Transfer-Encoding: base64
KioqIC90bXAvc2tpcC93YXJuaW5ncy5weS5+MS4yMX42Zkc1MkkJRnJpIEp1bCAxMSAxMDo0
Nzo1NCAyMDAzCi0tLSAvdG1wL3NraXAvd2FybmluZ3MucHk2ZkdHQlAJRnJpIEp1bCAxMSAx
MDo0Nzo1NCAyMDAzCioqKioqKioqKioqKioqKgoqKiogNTgsNjMgKioqKgotLS0gNTgsNjQg
LS0tLQogIAogIGRlZiB3YXJuX2V4cGxpY2l0KG1lc3NhZ2UsIGNhdGVnb3J5LCBmaWxlbmFt
ZSwgbGluZW5vLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZT1Ob25lLCByZWdpc3RyeT1O
b25lKToKKyAgICAgaW1wb3J0IHJlCiAgICAgIGlmIG1vZHVsZSBpcyBOb25lOgogICAgICAg
ICAgbW9kdWxlID0gZmlsZW5hbWUKICAgICAgICAgIGlmIG1vZHVsZVstMzpdLmxvd2VyKCkg
PT0gIi5weSI6CioqKioqKioqKioqKioqKgoqKiogNzcsODUgKioqKgogICAgICAjIFNlYXJj
aCB0aGUgZmlsdGVycwogICAgICBmb3IgaXRlbSBpbiBmaWx0ZXJzOgogICAgICAgICAgYWN0
aW9uLCBtc2csIGNhdCwgbW9kLCBsbiA9IGl0ZW0KISAgICAgICAgIGlmICgobXNnIGlzIE5v
bmUgb3IgbXNnLm1hdGNoKHRleHQpKSBhbmQKICAgICAgICAgICAgICBpc3N1YmNsYXNzKGNh
dGVnb3J5LCBjYXQpIGFuZAohICAgICAgICAgICAgIChtc2cgaXMgTm9uZSBvciBtb2QubWF0
Y2gobW9kdWxlKSkgYW5kCiAgICAgICAgICAgICAgKGxuID09IDAgb3IgbGluZW5vID09IGxu
KSk6CiAgICAgICAgICAgICAgYnJlYWsKICAgICAgZWxzZToKLS0tIDc4LDg2IC0tLS0KICAg
ICAgIyBTZWFyY2ggdGhlIGZpbHRlcnMKICAgICAgZm9yIGl0ZW0gaW4gZmlsdGVyczoKICAg
ICAgICAgIGFjdGlvbiwgbXNnLCBjYXQsIG1vZCwgbG4gPSBpdGVtCiEgICAgICAgICBpZiAo
cmUubWF0Y2gobXNnLCB0ZXh0LCByZS5JKSBhbmQKICAgICAgICAgICAgICBpc3N1YmNsYXNz
KGNhdGVnb3J5LCBjYXQpIGFuZAohICAgICAgICAgICAgIHJlLm1hdGNoKG1vZCwgbW9kdWxl
KSBhbmQKICAgICAgICAgICAgICAobG4gPT0gMCBvciBsaW5lbm8gPT0gbG4pKToKICAgICAg
ICAgICAgICBicmVhawogICAgICBlbHNlOgoqKioqKioqKioqKioqKioKKioqIDEzNywxNDMg
KioqKgogICAgICAiIiJJbnNlcnQgYW4gZW50cnkgaW50byB0aGUgbGlzdCBvZiB3YXJuaW5n
cyBmaWx0ZXJzIChhdCB0aGUgZnJvbnQpLgogIAogICAgICBVc2UgYXNzZXJ0aW9ucyB0byBj
aGVjayB0aGF0IGFsbCBhcmd1bWVudHMgaGF2ZSB0aGUgcmlnaHQgdHlwZS4iIiIKLSAgICAg
aW1wb3J0IHJlCiAgICAgIGFzc2VydCBhY3Rpb24gaW4gKCJlcnJvciIsICJpZ25vcmUiLCAi
YWx3YXlzIiwgImRlZmF1bHQiLCAibW9kdWxlIiwKICAgICAgICAgICAgICAgICAgICAgICAg
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