Python Forum
pyutils module - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: Code sharing (https://python-forum.io/forum-5.html)
+--- Thread: pyutils module (/thread-276.html)

Pages: 1 2


pyutils module - Skaperen - Oct-04-2016

i'll upload/embed it here and see if i live through it.

works!  i used "(Select All)" and saved it and checked it and got an identical file.  md5 checksum is: 45a5d821d22b508421255ba6663a9e45


RE: pyutils module - Skaperen - Oct-04-2016

see, i make mistakes. now i gotta do it all over, again (the edit button is gone)




RE: pyutils module - nilamo - Oct-04-2016

Quote:
if version_info[:3] >= (3,4,0):
    from base64         import a85decode, a85encode

...but then you never use the imported functions?  And they're also undefined, if you're using an older version of python?


RE: pyutils module - metulburr - Oct-04-2016

Quote:see, i make mistakes. now i gotta do it all over, again (the edit button is gone)
This is actually better for the flow of dialogue. This is not the best example, but imagine if there were a few other people's posts between your first and second post. If you edit your initial post, the posts after it does not makes sense. Imagine someone coming to this thread having the exact same problem, and not being able to understand what is going on because people are editing their posts.


RE: pyutils module - nilamo - Oct-04-2016

What happened a lot at the old forums, was someone would ask a homework question, then after they got the answer, they'd edit the original post to delete all traces of themselves. It's why the first reply was almost always just a quote of what they said, so they couldn't do that, lol.


RE: pyutils module - metulburr - Oct-04-2016

I made a new help doc...i know this is going to be asked numerous times in the future.
http://python-forum.io/misc.php?action=help&hid=32


:s


RE: pyutils module - Skaperen - Oct-05-2016

(Oct-04-2016, 07:39 PM)nilamo Wrote:
Quote:
if version_info[:3] >= (3,4,0):
    from base64         import a85decode, a85encode

...but then you never use the imported functions?  And they're also undefined, if you're using an older version of python?

is importing a function and not using it in the module considered bad?

i used to have a separate module just to import frequently used functions.  i merged that module because there were a lot of imported functions that were the same.  i wanted to have just one import in my other code so i merged them. then i made the base64 stuff more consistent by filling in the gaps for encode/decode.  i have yet to figure out the difference between a85... and b85...  i decided to include both, but maybe i don't need to.  if the a85 functions would be less often used in other code or a85 is an odd encoding then i would be inclined to remove them.  but i would not remove the version test. is that an issue?

(Oct-04-2016, 07:58 PM)metulburr Wrote: I made a new help doc...i know this is going to be asked numerous times in the future.
http://python-forum.io/misc.php?action=help&hid=32


:s

the difference between the code inserts was a typo ("b64" where it should have been "b85" on line45).  if i had been able to edit the inserted code, i would be fixing a typo. but code could be considered different; someone may have already downloaded the bad one.

a discussion around code (or documentation) might be good to have a wikipedia style history flow so everyone can see all the changes. but i have seen no forum with this feature. maybe a parallel wiki.python-forum.io would have uses.

the new way to display code is nice.


RE: pyutils module - metulburr - Oct-05-2016

Quote:everyone can see all the changes. but i have seen no forum with this feature
That would be ideal. I was actually looking for a plugin like this when i first installed this software.  If we were able to do that, then we could be more lenient in editing.


RE: pyutils module - nilamo - Oct-05-2016

(Oct-05-2016, 04:25 AM)Skaperen Wrote: is importing a function and not using it in the module considered bad?
No, it's just odd that the function is only sometimes there... there's no fallback for an older version of python. And if it's not being used within the module, and only there to help make something *else* easier, then you should probably add a comment saying so.


RE: pyutils module - Skaperen - Oct-06-2016

(Oct-05-2016, 02:34 PM)nilamo Wrote:
(Oct-05-2016, 04:25 AM)Skaperen Wrote: is importing a function and not using it in the module considered bad?
No, it's just odd that the function is only sometimes there... there's no fallback for an older version of python.  And if it's not being used within the module, and only there to help make something *else* easier, then you should probably add a comment saying so.

the a85 and b85 functions were added in Python 3.4.0.  i want other stuff to still work if my module is imported in an earlier version.  i do the same test for the def of functions that depend on those a85 and b85 functions, so that importing my module (maybe by code i provide in the future) is not the point of failure.  dealing with cases like this is always tricky.