testing if a list contains a sublist

2011-08-15 Thread Johannes
contained in l2 my problem is the second example, which makes it impossible to work with sets insteads of lists. But something like set.issubset for lists would be nice. greatz Johannes -- http://mail.python.org/mailman/listinfo/python-list

Re: testing if a list contains a sublist

2011-08-16 Thread Johannes
Am 16.08.2011 09:44, schrieb Peter Otten: > Johannes wrote: > >> what is the best way to check if a given list (lets call it l1) is >> totally contained in a second list (l2)? >> >> for example: >> l1 = [1,2], l2 = [1,2,3,4,5] -> l1 is contained in l2 >

Re: testing if a list contains a sublist

2011-08-16 Thread Johannes
else: > d2[i] = 1 > if not all([k in d2.keys() for k in d1.keys()]): > return false > return all([d1[i] <= d2[i] for i in d1]) greatz Johannes -- http://mail.python.org/mailman/listinfo/python-list

Job offer python programmer

2006-09-25 Thread johannes
Best regards, Johannes Selbach Axandra GmbH, Ruhrstraße 6, 56410 Montabaur, Germany http://www.Axandra.de - http://www.Axandra.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Job offer python programmer

2006-09-25 Thread johannes
nd here: > > About the job: http://www.Axandra.de/python > > Well, that page is in German, so I'm guessing you want a German speaker? Hello Paul, Thank you for your reply. We need a German speaker. Please accept my apologies for not being clear in the initial post. All the best, Johannes -

Extending Python

2005-06-09 Thread Johannes
I am thinking of replacing Lua as internal script controller and I know how to extend/embed python but is there a way of limiting what functionality can be actually be accessible to the user, f.e. I don't want the script to be able to read/write files? /Johannes -- http://mail.pytho

Re: Free Windows Vista Download

2007-04-30 Thread johannes
Spin Dryer wrote: > > On Sun, 29 Apr 2007 20:23:22 -0400, ["Alvin Bruney [MVP]" without an email address>] said :- > > >That's a misleading post, you should indicate that this is an evaluation > >copy. > > You did it again Sonny, making yourself look a total fool. > > Will you stop top posti

os.putenv() has no effect

2013-06-18 Thread Johannes Bauer
;, "BAR") >>> os.getenv("FOO") >>> Does anybody know why this would happen or what I could be doing wrong? Help is greatly appreciated. Thanks in advance, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich!

Re: os.putenv() has no effect

2013-06-18 Thread Johannes Bauer
u really couldn't have missed the point more if you tried. I'm not working with Bash, but with Python. os.putenv() has no effect in my case (not just with the PATH environment variable). Regards, Johannes -- http://mail.python.org/mailman/listinfo/python-list

Re: os.putenv() has no effect

2013-06-18 Thread Johannes Bauer
On 18.06.2013 20:09, Dave Angel wrote: > In other words, you shouldn't use putenv(), but instead modify os.environ. Huh... this is surprising to me. Because I actually looked it up in the manual and vaguely remember that there stood that os.environ is just a copy of the environment variables at i

Re: os.putenv() has no effect

2013-06-18 Thread Johannes Bauer
On 18.06.2013 20:12, Johannes Bauer wrote: > I am extremely certain that I found that passage, but can't find it > right now anymore (probably staring right at it and can't find it still) :-/ Obviously, yes: Note On some platforms, including FreeBSD and Mac OS X, setting e

Re: Why is regex so slow?

2013-06-18 Thread Johannes Bauer
ntinue m = pattern.search(line) if m: count += 1 print(count) The pre-check version is about 42% faster in my case (0.75 sec vs. 1.3 sec). Curious. This is Python 3.2.3 on Linux x86_64. Regards, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorherge

Re: Why is regex so slow?

2013-06-19 Thread Johannes Bauer
rge.] Since O() only gives upper bounds it's also possible for an algorithm within O(n^2) to always be faster than another algorithm within O(logn). The O(n^2) algorithm could be Thetha(1). Regards, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffe

Re: Python 3: dict & dict.keys()

2013-07-25 Thread Johannes Bauer
On 25.07.2013 07:48, Steven D'Aprano wrote: > Then you aren't looking very closely. d.keys() returns a set-like view > into the dict, which is great for comparing elements: > > py> d1 = dict.fromkeys([1, 2, 3, 4]) > py> d2 = dict.fromkeys([3, 4, 5, 6]) > py> d1.keys() & d2.keys() # keys that ar

Re: Comparing strings from the back?

2012-09-04 Thread Johannes Bauer
f character comparisons and c. The rationale as follows: The first character has to be compared in any case. The second with a probability of 1/256, the third with 1/(256^2) and so on. Best regards, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht

Re: Comparing strings from the back?

2012-09-05 Thread Johannes Bauer
lawed assumption you're making since you're neglecting lazy evaluation and early abort of comparison. Best regards, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unser

Re: Comparing strings from the back?

2012-09-05 Thread Johannes Bauer
ing a large dictionary. Sorting is in O(n log(n)), but this assumes O(1) comparisons! If the comparison operation itself were in O(n), the total sorting complexity would be O(n^2 log(n)), which is definitely false. Most comparisons will abort *very* early (after the first character). Best regards

Re: Comparing strings from the back?

2012-09-05 Thread Johannes Bauer
On 05.09.2012 11:24, Johannes Bauer wrote: > Consider sorting a large dictionary. Sorting is in O(n log(n)), but this > assumes O(1) comparisons! If the comparison operation itself were in > O(n), the total sorting complexity would be O(n^2 log(n)), which is > definitely false. Most

Re: Comparing strings from the back?

2012-09-05 Thread Johannes Bauer
On 05.09.2012 04:18, Neil Hodgson wrote: >The memcpy patch was controversial as it broke Adobe Flash which > assumed memcpy was safe like memmove. Adobe Flash was broken before, making an assumption that is not guaranteed by the standard. The patch only showed the problem. Regards, Jo

Re: Comparing strings from the back?

2012-09-05 Thread Johannes Bauer
it. >> In summary, let's please not debate "feelings" or such. > > I have no idea what feelings you are referring to. I'm referring to "the number of comparisons is equally likely to be 1, 2, 3, ..., N. The average then is" without any deduction or rati

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 05.09.2012 18:24, Steven D'Aprano wrote: > On Wed, 05 Sep 2012 16:51:10 +0200, Johannes Bauer wrote: > [...] >>> You are making unjustified assumptions about the distribution of >>> letters in the words. This might be a list of long chemical compounds >>>

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
testing is certainly O(N) (every character must be looked at), and the > *best* case is O(1) obviously (the first character fails to match). But > I'm not so sure about the average case. Further thought is required. Yes, worst-case is O(N), best case O(1). Average is O(n log n).

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 06.09.2012 16:23, Dave Angel wrote: > On 09/06/2012 09:43 AM, Johannes Bauer wrote: >> >> Yes, worst-case is O(N), best case O(1). Average is O(n log n). > > Can't see how you came up with an average of n log(n). Fourteen minutes > before you made this post, you

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 06.09.2012 15:43, Johannes Bauer wrote: > Wrong, at least for randomized strings (i.e. every character with the > same probability). O(N) is worst-case, O(log N) is correct for > randomized strings. ^^ Here I write the right thing. Then further below... > Yes, worst-case is O(N),

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 06.09.2012 16:23, Dave Angel wrote: > On 09/06/2012 09:43 AM, Johannes Bauer wrote: >> >> Yes, worst-case is O(N), best case O(1). Average is O(n log n). > > Can't see how you came up with an average of n log(n). Fourteen minutes > before you made this post, you

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
rage string length is about 2.97 characters and aborted was in average after 1.57 characters. Maybe someone has a test which makes heavier use of string comparison. I don't want to make up something, however, since this is (by definition) going to be artificial. Best regards, Johanne

Re: Comparing strings from the back?

2012-09-06 Thread Johannes Bauer
On 06.09.2012 17:36, Johannes Bauer wrote: > "pleasedumpstats" < "" And against a XML-reading C code generator that uses mako: strCmpEq 39670 strCmpLt 2766215 strCmpGt 2744002 strCmpTc 37430821 strCmpCc 14048656 Compared strings: 5549887 Equal: 0.7% Average word

Convert MAC to hex howto

2012-10-07 Thread Johannes Graumann
Dear all, I'm trying to convert '00:08:9b:ce:f5:d4' to '\x00\x08\x9b\xce\xf5\xd4' for use in magic packet construction for WakeOnLan like so: wolsocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) wolsocket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1

Re: Convert MAC to hex howto

2012-10-07 Thread Johannes Graumann
MRAB wrote: > On 2012-10-07 20:44, Johannes Graumann wrote: >> Dear all, >> >> I'm trying to convert >> '00:08:9b:ce:f5:d4' >> to >> '\x00\x08\x9b\xce\xf5\xd4' >> for use in magic packet construction for WakeOnLan l

Re: Convert MAC to hex howto

2012-10-07 Thread Johannes Graumann
Paul Rubin wrote: > Johannes Graumann writes: >> '00:08:9b:ce:f5:d4' >> ... >> hexcall = "\\x".join(hexcall).decode('string_escape') > > I think it's best not to mess with stuff like that. Convert to integers > then convert back:

Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Johannes Bauer
Hi there, I'm currently looking for a good solution to the following problem: I have two classes A and B, which interact with each other and which interact with the user. Instances of B are always created by A. Now I want A to call some private methods of B and vice versa (i.e. what C++ "friends"

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Johannes Bauer
On 29.10.2012 17:47, Chris Angelico wrote: > The usual convention for private methods is a leading underscore on the name: Yup, that's what I'm using. > It's only a convention, though; it doesn't make it "hard" to call > them, it just sends the message "this is private, I don't promise that > it

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Johannes Bauer
ot restrict usage in any "non-natural" way. I was actually mixing this up in my head with the __xyz__ name-munging. Thank you very much for hitting my head with a brick. Much clearer now :-) Best regards, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumi

Relative imports in packages

2012-11-09 Thread Johannes Bauer
in from . import VERSION ImportError: cannot import name VERSION How do I do this right? Thanks for your advice, Best regards, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa -- http://mail.python.org/mailman/listinfo/python-list

Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive

2012-11-12 Thread Johannes Kleese
Hi! (Yes, I did take a look at the issue tracker but couldn't find any corresponding bug, and no, I don't want to open a new account just for this one.) I'm reusing a single urllib.request.Request object to HTTP-POST data to th

Re: Bugs: Content-Length not updated by reused urllib.request.Request / has_header() case-sensitive

2012-11-13 Thread Johannes Kleese
Terry Reedy wrote: > On 11/12/2012 10:52 AM, Johannes Kleese wrote: >> Tested with Python 3.1.3 and Python 3.1.4. > > 3.1 only gets security fixes. Consider upgrading. Stuck with Debian on a server, thus stuck with 3.1 on development machine. > exhibits the same behavior in

Re: Generate unique ID for URL

2012-11-14 Thread Johannes Bauer
g you 54 years to get the one-in-a-million. Then again, if you went for a million million hashes per second, Python would probably not be the language of your choice. Best regards, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah,

Re: Generate unique ID for URL

2012-11-14 Thread Johannes Bauer
ome up with these following bitlenghts of the hash with a 1e-7 probability of collision in respect to the worst-case number of elements 10k elements: 49 bit 100k elements: 56 bit 1e6 elements: 63 bit 100e6 elements: 76 bit 1e9 elements: 83 bit 1e12 elements: 102 bit Best regards, Johannes -- &g

Re: Generate unique ID for URL

2012-11-14 Thread Johannes Bauer
f they might not fit the exact phrasing of one of his postings). Best regards, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa -- http://mail.python.org/mailman/listinfo/python-list

Greedy parsing of argparse/positional arguments

2012-11-20 Thread Johannes Bauer
g", "mypattern", "myfile"], leaving nothing for "pattern" and "filename", yielding an error: ./foo: error: too few arguments How can I force positional arguments to take precedence over optional arguments? I could exclude them from the parsing altogether, bu

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Johannes Bauer
is not the problem. > I was suprised to discover this: > >>>> 'Straße'.upper() > 'STRASSE' > > I really, really do not know what I should think about that. > (It is a complex subject.) And the real question is why? Because in the German language

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Johannes Bauer
On 19.12.2012 16:18, Johannes Bauer wrote: > How do those arbitrary numbers prove anything at all? Why do you draw > the conclusion that it's broken by design? What do you expect? You're > very vague here. Just to show how ridiculously pointless your numers > are, yo

Python3 + sqlite3: Where's the bug?

2012-12-20 Thread Johannes Bauer
Hi group, I've run into a problem using Python3.2 and sqlite3 db access that I can't quite wrap my head around. I'm pretty sure there's a bug in my program, but I can't see where. Help is greatly appreciated. I've created a minimal example to demonstrate the phaenomenon (attached at bottom). Firs

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Johannes Bauer
with lots of BMP characters and one non-BMP. I was not :-( Thanks for the heads up and the good summary on what the issue was about. Best regards, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genia

Re: Python3 + sqlite3: Where's the bug?

2012-12-20 Thread Johannes Bauer
On 20.12.2012 16:05, Chris Angelico wrote: > On Fri, Dec 21, 2012 at 1:52 AM, Johannes Bauer wrote: >> def fetchmanychks(cursor): >> cursor.execute("SELECT id FROM foo;") >> while True: >> result = cursor.fetchmany() &

nmea

2012-03-10 Thread Johannes Wagner
can any1 help me on how to get python to read nmea data? -- http://mail.python.org/mailman/listinfo/python-list

Binding first parameter of method to constant value

2012-05-18 Thread Johannes Bauer
Hi group, I'm trying to dynamically add methods to a class at runtime. What I would like to do is have them all delegated to one common function which is called with the name of the function as first parameter. I.e.: class Foo(): def __init__(self): # Some magic missing here setattr(sel

Re: Binding first parameter of method to constant value

2012-05-18 Thread Johannes Bauer
On 18.05.2012 15:10, Steven D'Aprano wrote: > Here's one way: > > import types > class K(object): > def _dispatcher(self, name, *args): > print "called from", name, args > def __init__(self): > setattr(self, 'foometh', > types.MethodType( >

ctype C library call always returns 0 with Python3

2012-05-19 Thread Johannes Bauer
Hi group, I'm playing with ctypes and using it to do regressions on some C code that I compile as a shared library. Python is the testing framework. This works nicely as long as I do not need the return value (i.e. calling works as expected and parameters are passed correctly). The return value o

Brainstorming on recursive class definitions

2017-09-12 Thread Johannes Bauer
Hi group, so I'm having a problem that I'd like to solve *nicely*. I know plenty of ways to solve it, but am curious if there's a solution that allows me to write the solution in a way that is most comfortable for the user. I'm trying to map registers of a processor. So assume you have a n bit ad

Re: Brainstorming on recursive class definitions

2017-09-12 Thread Johannes Bauer
By the way, here's my work in progress: https://gist.github.com/johndoe31415/7e432b4f47f0030f0903dbd6a401e5dc I really really love the look & feel, but am unsure if there's a better way for this? Cheers, Joe -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich

Re: Python on Android?

2018-02-18 Thread Johannes Findeisen
id3/files/arm-linux-androideabi/bin/python but I can not access it in a normal terminal without being user "root" but it is usable from within the terminal included in the Pydroid App. I do only execute some basic Python stuff for fun and learning when traveling but that should work

Re: Python on Android?

2018-02-18 Thread Johannes Findeisen
bind your Python code to some buttons and execute it when clicking. Not very useful when you need the output but very useful when you have some tasks you wanna execute with just one click... ;) Johannes [0] http://kivy.org -- https://mail.python.org/mailman/listinfo/python-list

Re: Python on Android?

2018-02-20 Thread Johannes Findeisen
On Tue, 20 Feb 2018 23:12:23 +1100 Chris Angelico wrote: > On Mon, Feb 19, 2018 at 3:57 AM, Johannes Findeisen wrote: > > On Sun, 18 Feb 2018 20:57:02 +1100 > > Chris Angelico wrote: > > > >> Does anyone have experience with running Python scripts on Android

Re: Python on Android?

2018-02-20 Thread Johannes Findeisen
On Wed, 21 Feb 2018 00:11:24 +0100 Johannes Findeisen wrote: > On Tue, 20 Feb 2018 23:12:23 +1100 > Chris Angelico wrote: > > > On Mon, Feb 19, 2018 at 3:57 AM, Johannes Findeisen > > wrote: > > > On Sun, 18 Feb 2018 20:57:02 +1100 > > > Chris Angel

Creating lambdas inside generator expression

2022-06-29 Thread Johannes Bauer
Hi list, I've just encounted something that I found extremely unintuitive and would like your feedback. This bit me *hard*, causing me to question my sanity for a moment. Consider this minimal example code (Py 3.10.4 on Linux x64): class Msg(): def hascode(self, value): p

Re: Creating lambdas inside generator expression

2022-06-29 Thread Johannes Bauer
Aha! conds = [ lambda msg, z = z: msg.hascode(z) for z in ("foo", "bar") ] Is what I was looking for to explicitly use the value of z. What a caveat, didn't see that coming. Learning something new every day. Cheers, Joe Am 29.06.22 um 11:50 schrieb Johannes Bauer:

Evaluation of variable as f-string

2023-01-23 Thread Johannes Bauer
gns or ':' or '{' included inside the expression as a literal). 3. Somehow compile the bytecode representing an actual f-string expression, then execute it. Sounds like a royal pain in the butt, have not tried it. All solutions are extremely undesirable and come with heavy drawbacks. Is there any standard solution (Py3.10+) that does what I would? Anything I'm missing? Thanks, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: Evaluation of variable as f-string

2023-01-27 Thread Johannes Bauer
as code, ask for what you ACTUALLY need, and we can help? I want to render data from a template using an easily understandable syntax (like an f-string), ideally using native Python. I want the template to make use of Python code constructs AND formatting (e.g. {x['time']['runtime']['seconds'] // 60:02d}). Cheers, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: Evaluation of variable as f-string

2023-01-27 Thread Johannes Bauer
fy File "", line 1 f""""""""" ^ SyntaxError: unterminated triple-quoted string literal (detected at line 1) This is literally the version I described myself, except using triple quotes. It only modifies the underlying problem, but doesn't solve it. Cheers, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: Evaluation of variable as f-string

2023-01-27 Thread Johannes Bauer
Am 23.01.23 um 17:43 schrieb Stefan Ram: Johannes Bauer writes: x = { "y": "z" } s = "-> {x['y']}" print(s.format(x = x)) x = { "y": "z" } def s( x ): return '-> ' + x[ 'y' ] print( s( x = x )) Exce

Re: Evaluation of variable as f-string

2023-01-27 Thread Johannes Bauer
can't, and that's a horrible idea". "You can't" would have been sufficient. Pity. Your judgement is unnecessary and, frankly, uncalled for as well. Multiple instances you claim that you have no idea what I am doing so how would you even begin to judge a solution

Re: Evaluation of variable as f-string

2023-01-28 Thread Johannes Bauer
string, as long as it could successfully evaluate using the f-string grammar. Stop with the rock management already and explain (briefly if possible) what you are up to. I have a string. I want to evaluate it as if it were an f-string. I.e., there *are* obviously restrictions that apply (namely,

Re: Evaluation of variable as f-string

2023-01-28 Thread Johannes Bauer
ords, if there were a magic function: evalfstring(s, x = x) That would have been the ideal answer. There does not seem to be one, however. So I'm back to silly workarounds. Cheers, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: Evaluation of variable as f-string

2023-01-28 Thread Johannes Bauer
Am 27.01.23 um 23:10 schrieb Christian Gollwitzer: Am 27.01.23 um 21:43 schrieb Johannes Bauer: I don't understand why you fully ignore literally the FIRST example I gave in my original post and angrily claim that you solution works when it does not: x = { "y": "z"

Re: Evaluation of variable as f-string

2023-01-29 Thread Johannes Bauer
orable how you're trying to frame yourself as the victim. I'll be here if you need a hug, buddy. But you're not going to change the laws of physics. Yeah we'll have to disagree about the fact that it's the "laws of physics" preventing a specific implementation of a Python function. Cheers, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: Evaluation of variable as f-string

2023-01-29 Thread Johannes Bauer
.strftime('%y.%m.%d')} {'<-' * (x['d'] // 4)}" q = magic_function(s, x = x) and have "q" then be '01100 ->->->-> 00.05.11 <-<-<-' I believe the closest solution would be using a templating mechanism (like Mako), but that has slightly different syntax and doesn't do string formatting as nice as f-strings do. f-strings really are the perfect syntax for what I want to do. Cheers, Johannes -- https://mail.python.org/mailman/listinfo/python-list

threading and multiprocessing deadlock

2021-12-05 Thread Johannes Bauer
of Python, the started Thread is still running in the background: $ ps ax | grep minimal 370167 pts/0S 0:00 python3 minimal.py 370175 pts/2 S+ 0:00 grep minimal Can someone figure out what is going on there? Best, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: threading and multiprocessing deadlock

2021-12-06 Thread Johannes Bauer
Am 06.12.21 um 13:56 schrieb Martin Di Paola: > Hi!, in short your code should work. > > I think that the join-joined problem is just an interpretation problem. > > In pseudo code the background_thread function does: > > def background_thread() >   # bla >   print("join?") >   # bla >   print("j

Re: Magic UTF-8/Windows-1252 encodings

2016-08-30 Thread Johannes Bauer
y identifying and using character sets. Everything about the thought makes me shiver. Cheers, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage.

Lexer/Parser question: TPG

2016-11-14 Thread Johannes Bauer
atch? I thought it'd only match once a "start_string" was encountered (which it isn't). Since I'm the parsing noob, I don't think TPG (which is FREAKING AMAZING, seriously!) is at fault but rather my understanding of TPG. Can someone help me with this? I've uploaded

Re: Entering a very large number

2018-03-23 Thread Johannes Bauer
On 23.03.2018 14:01, ast wrote: > It is not beautiful and not very readable. It is better to > have a fixed number of digits per line (eg 50) Oh yes, because clearly a 400-digit number becomes VERY beautiful and readable once you add line breaks to it. Cheers, Joe -- >> Wo hattest Du das Beben

Curious case of UnboundLocalError

2018-03-30 Thread Johannes Bauer
Hey group, I stumbled about something that I cannot quite explain while doing some stupid naming of variables in my code, in particular using "collections" as an identifier. However, what results is strange. I've created a minimal example. Consider this: import collections class Test(object):

Re: Curious case of UnboundLocalError

2018-03-30 Thread Johannes Bauer
On 30.03.2018 13:13, Ben Bacarisse wrote: >> import collections >> >> class Test(object): >> def __init__(self): >> z = { >> "y": collections.defaultdict(list), > > This mention of collections refers to ... > >> } >> for (_, collec

Re: Curious case of UnboundLocalError

2018-03-30 Thread Johannes Bauer
On 30.03.2018 13:25, Johannes Bauer wrote: >> This mention of collections refers to ... >> >>> } >>> for (_, collections) in z.items(): >> >> ... this local variable. > > Yup, but why? I mean, at the point of definition of

Re: Curious case of UnboundLocalError

2018-03-31 Thread Johannes Bauer
On 30.03.2018 16:46, Ben Bacarisse wrote: >> Yup, but why? I mean, at the point of definition of "z", the only >> definition of "collections" that would be visible to the code would be >> the globally imported module, would it not? How can the code know of the >> local declaration that only comes

pytz and Python timezones

2016-06-11 Thread Johannes Bauer
.. what? This here: pytz.timezone("Europe/Berlin").localize(datetime.datetime(2016,1,1)) Gives me the expected result of: datetime.datetime(2016, 1, 1, 0, 0, tzinfo=) Can someone explain what's going on here and why I end up with the weird "00:53" timezone? Is this

Re: value of pi and 22/7

2016-06-18 Thread Johannes Bauer
On 18.06.2016 01:12, Lawrence D’Oliveiro wrote: > I’m not sure how you can write “30” with one digit... 3e1 has one significant digit. Cheers, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genia

Zero runtime impact tracing

2016-07-30 Thread Johannes Bauer
re is no performance impact. Cheers, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa -- https://mai

Pythonic custom multi-line parsers

2019-07-10 Thread Johannes Bauer
Hi list, I'm looking for ideas as to a pretty, Pythonic solution for a specific problem that I am solving over and over but where I'm never happy about the solution in the end. It always works, but never is pretty. So see this as an open-ended brainstorming question. Here's the task: There's a cu

Re: GPG wrapper, ECC 25519 compatible?

2019-09-02 Thread Johannes Bauer
On 03.09.19 05:28, rmli...@riseup.net wrote: > But I just don't understand how to get > and pass information back to the gpg command line prompts at all, not to > mention automating the process. The manpage describes how to enable the machine-parsable interface, which is exactly what you want. Th

Handling of disconnecting clients in asyncio

2019-09-24 Thread Johannes Bauer
way of discovering a peer has disconnected and exiting cleanly? Thanks in advance, All the best, Johannes -- "Performance ist nicht das Problem, es läuft ja nachher beides auf der selben Hardware." -- Hans-Peter Diettrich in d.s.e. -- https://mail.python.org/mailman/listinfo/python-list

'%Y' in strftime() vs. strptime()

2019-12-29 Thread Johannes Bauer
not match format '%Y-%m-%d' >>> d.strptime("0001-01-01", "%Y-%m-%d") datetime.datetime(1, 1, 1, 0, 0) I.e. for years that are not 4 digits longs, strftime() produces no leading zeros for the '%Y' replacement, but strptime() requires leading zeros. Is this expected behavior? Shouldn't %Y be consistent across both? All the best, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Overloading

2005-12-09 Thread Johannes Reichel
Hi! In C++ you can overload functions and constructors. For example if I have a class that represents a complex number, than it would be nice if I can write two seperate constructors class Complex: def __init__(self): self.real=0 self.imag=0 def __init__self(self,r,i):

Re: help!

2005-06-24 Thread Johannes Findeisen
few improvements over this filesystem. Basically, it provided long file names, support for bigger partitions and support for the three timestamps." Regards -- Johannes Findeisen -- http://mail.python.org/mailman/listinfo/python-list

Re: Django - Rails killer comes...

2005-07-16 Thread Johannes Findeisen
d i hope i will become better when trying this software. Thanks for your _open_ release! I love it! Regards, -- Johannes Findeisen http://hanez.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs. Access VBA

2005-07-16 Thread Johannes Findeisen
nding your application to Microsoft. You need a runtime version of Access when distributing the application to others. When using Python you could build an install CD for more the windows and you didn't have to bother about proprietary licensing issues. Good Luck with your decision... ;-) Regards, -- Johannes Findeisen http://hanez.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs. Access VBA

2005-07-16 Thread Johannes Findeisen
On Sun, 2005-07-17 at 01:30 +0200, Johannes Findeisen wrote: > My recommendation: > > Use Python! You will love me in some years because i have said this. > When using Access you are binding your application to Microsoft. You > need a runtime version of Access when distributing the

Re: How can I encode something in base32 preferably very fast?

2005-07-25 Thread Johannes Findeisen
html I think you need to convert to a String before encoding... Have fun, -- Johannes Findeisen http://hanez.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying tcompile an use the Python 3.4a

2013-11-13 Thread Johannes Findeisen
se try to figure out your distribution specific stuff by using a search engine! This was what I found as first result by searching for "centos pip" at Google: http://superuser.com/questions/292378/how-to-install-pip-and-easy-install-on-centos This really is not a Python question but a CentOS issue! Regards, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: Trying tcompile an use the Python 3.4a

2013-11-13 Thread Johannes Findeisen
I think that is the package you are missing for installing pip. I don't know anything about the current CentOS release so may it will not be available via yum. Good luck! Regards, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: Invalid syntax with print "Hello World"

2013-11-14 Thread johannes . gunz97
Am Donnerstag, 12. März 2009 07:57:11 UTC+1 schrieb Henrik Bechmann: > obviously total mewbiew: > > My first program in Python Windows > > print "Hello World" > > I select Run/Run Module and get an error: > > Syntax error, with the closing quote highlighted. > > Tried with single quotes as wel

Re: Static Website Generator

2013-11-16 Thread Johannes Findeisen
/hyde . I currently use the Ruby based Jekyll website generator because I am hosting at GitHub Pages where only this software is supported but I tried Hyde long time ago and I remember that does nearly the same work. Regards, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Johannes Findeisen
derstand answers to this! BTW, /usr/bin/python3 is a file and not a directory! This is what the error message says! You are really destroying this list! Go to other places like stackoverflow and ask your questions there. You are mixing a lot of topics and this is not helpful to others! Johannes --

Re: Question regarding 2 modules installed via 'pip'

2013-11-16 Thread Johannes Findeisen
On Sat, 16 Nov 2013 07:56:47 -0800 (PST) Ned Batchelder wrote: > Johannes, in cases like this, it is very important to have a clear message. > I liked that you said, "We cannot teach you Unix basics here". It weakens > that message if you then teach some Unix basics. Be

Re: Self-defence

2013-11-17 Thread Johannes Findeisen
report this information to the FBI but since I am german and live in Germany I think I have no chance to do that. May an american person could take over this part. I could share all those files as ZIP file. Regards, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: Doc generation from annotated source code

2013-11-18 Thread Johannes Findeisen
ms OK to do so for Python 3... ;) Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: Python project

2013-11-27 Thread Johannes Findeisen
us more information about the state of your project and what you have tried to implement and what you are missing... There are lots of libraries available for Python doing most of the jobs you want to have done. Do you want us to explain how to build a web application? Regards, Johannes -- https:

Re: Python project

2013-11-28 Thread Johannes Findeisen
eb application development from that. Regards, Johannes -- https://mail.python.org/mailman/listinfo/python-list

Re: Need help with programming in python for class (beginner level)

2013-11-29 Thread Johannes Findeisen
e at least " + value + "." Do this: print "The total rolled was: " + number + " " Regards, Johannes -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   >