« first day (2008 days earlier)      last day (2958 days later) » 
00:00 - 16:0016:00 - 00:00

HE'S SLEEP CHATTING!
I wonder if Antti admits things when he sleep chats?

Hey @AnttiHaapala how much do you love Windows?
 
“Larry Wall presents Perl 6″

1632 - Rembrandt van Rijn
zzzzzZZZZZZZZ mmmmmm windowwwws <3
 
I'm starring that as proof
:P
(wait...RO's can remove stars can't they)
 
guess so
cancel stars
 
pr sent. rbrb :)
 
user559633
1:06 AM
Today I learned: the "one hat per crew" rule was in effect as far back as 1632.
 
Have you guys used Kite artificial pair programmer yet ?
it looks handy
 
 
1 hour later…
2:35 AM
Indenting like this should be a crime stackoverflow.com/questions/35997390/…
He even puts TABS around his OPERATORS and KEYWORDS
 
Woah you're really bold with your words
@summerNight No I haven't - I don't think it's out yet? :o
 
Sorry, I'm a big fan of bold. :)
 
2:57 AM
I can see that!
 
3:43 AM
Oh I just saw it in a video, they are in private beta.
 
 
3 hours later…
6:53 AM
@user1977867: please do read our room rules: sopython.com/chatroom
 
Cabbage :-)
 
Sup
 
Got a new MacBook Pro at work ...
Its kinda weird...
 
What, work?
Or that they gave you a new machine?
Or the Macbook itself? :-)
 
They gave me a new machine to use at work
I have been using Ubuntu for three years and this feels like just User friendly, not developer friendly...
Either that, or I am just at the beginning of the learning curve.
 
7:07 AM
Cabbage
 
@thefourtheye I love my macbook for developing.
Partly because I am no longer distracted by every possible tweak I could make.
 
@MartijnPieters Oh, don't you feel that you have to use the touchpad a lot?
 
Wait, you answer that fast with a MacBook? :O
 
I am a keyboardist all the way.
 
7:10 AM
Mmmm, it has two new keys... I am getting confused all the time... Fn, Control, Option, Command... Argh...
 
@MartijnPieters Welcome to the real world.
 
That's just muscle memory.
 
Wrong ping sorry.
Meant for @thefourtheye :P
 
@thefourtheye At least it's not actively developer-hostile. And it has a decent CLI. I don't have much Mac experience, apart from spending a bit of time playing with my sister's old MacBook a few years ago.
 
Not enough coffee
Macbooks are great for developing.
 
7:11 AM
@MartijnPieters Mmmm, lot of getting used to do.
 
On a train at Cambridge, hence the lack of a desk.
 
@Ffisegydd I am the last one to get in my floor. Everybody said its awesome and they finally convinced me to get it :-/
 
I can't see the MEGABAN button on @Martijn's screen, must be just off the top...
 
@MartijnPieters Ya, I got the same one :-)
 
@AnttiHaapala Tee hee. ThorSummoner got totally pwned there. :)
 
7:13 AM
@Ffisegydd It's in the USB port; just touch the side of my laptop and you are banned..
 
@PM2Ring Sooner I realize that it would be better :-) Right now, I am kinda counter productive with Mac :(
The keyboard doesn't have Home, End, Page Up, Page Down... etc etc
 
@thefourtheye fn-arrow keys.
 
I have to find a Cheat Sheet for Mac Keyboards
 
@thefourtheye You can use arro - never mind.
 
@Ffisegydd: touch that little metal bar and magic happens!
 
7:15 AM
O____O
Does it just know who to ban or do you have to think their name?
 
@Ffisegydd Eye tracking of course!
 
@MartijnPieters You, sir, have saved a lot of time. I was asking the same to almost everyone I know who use Mac on my floor. Nobody knew that. Apparently, they all use two finger gesture.
 
@MartijnPieters Thanks :-) I'll start reading it today.
 
You won't remember them all, but you can search the page.
One thing I always switch on when I start using a new mac but have trouble finding: full keyboard access.
Go to System Preferences > Keyboard > Shortcuts and toggle the radio button at the bottom of that page.
Then the TAB key will not skip dropdowns or checkboxes or radio buttons.
So you can use the keyboard properly and not have to reach for your mouse or trackpad all the time.
 
7:28 AM
I kept it as Text Boxes and Lists.
Oh, this KeyBoard preferences is nice. I can customize them.
 
That's my number one pet peeve when tabbing through a webpage or preference pane.
 
That would avoid skipping through Google search results and SO Questions I guess
 
user4433485
7:43 AM
heya folk!
 
Hello.
 
@PM2Ring :D:D
 
Cabbage!
 
user4433485
7:58 AM
cabbage!
 
@PM2Ring the thing is there is no single I in the post itself.
so that's the result if one's trying to be modest.
@PM2Ring like the quote before, someone was asking about usability of 32-bit checksums as hash values and got the answer from Adler.
that's why I started reading some of his answers there
 
8:40 AM
Cabbage
 
Cabbage, @JRichardSnape.
I have a Linux question, but it is kinda related to Python. Is the 2nd part of my comment correct, or is there some way to send a password to su or sudo? I guess you could do it via some low-level manipulation of the terminal, but I know next to nothing about that stuff, and I suspect the OP doesn't, either.
1). Why are you attempting to execute python code via subprocess. Why not just encapsulate the code properly into functions, import the script(s) and call the functions? 2). Once you have the password how do you intend to use it? su / sudo don't allow you to submit the password as a variable, it must be given via a terminal, and you can't just pipe it to them. — PM 2Ring 18 hours ago
 
Morning @Pm2. As to the question: Pass - beyond my level of Linux wizardry.
My google fu reveals: superuser.com/a/67766/417821 as a way to pipe in the password, though
 
No worries. It was a general question, although I guess it looks like it was addressed to you. :)
 
Still seems like a bad idea, anyway, although maybe OP has their reasons.
 
@JRichardSnape Thanks! Somehow I missed that when I read the sudo man yesterday. :oops:
@JRichardSnape Agreed. I'd probably just make a simple bash script that runs the Python scripts, and run the bash script with su or sudo.
rbrb
 
9:02 AM
See you o/
 
Morning cabbage
@PM2Ring That just smacks of danger to me. Am I missing something here? Surely all they need is just a bash script that checks that the current user's privileges at start, detects if it needs to be elevated and quits, specifying that they need to run the script with sudo or as a user with correct permissions?
All of the submodules are run within that script and doesn't need to 'pass around' the password in an insecure way
 
9:36 AM
i wish docs i use have this kind of warning
Warning

Never, never, NEVER use Python string concatenation (+) or string parameters interpolation (%) to pass variables to a SQL query string. Not even at gunpoint.
from pyscopg2 :)
 
9:59 AM
@IntrepidBrit I don't think we're missing anything. I certainly wouldn't feel safe running software that grabs my root password. And as for grabbing it and saving it to disk, that's just plain crazy. At least the accepted answer tells him to save a salted hashed version of the password, but still...
@danidee Ob XKCD: xkcd.com/327
 
10:22 AM
lol
 
@PM2Ring @IntrepidBrit Here's my suspicion - they have a python script that does some file I/O on a directory that it shouldn't have access to, so they have to elevate privileges to run it instead of importing it, but they don't want to run the original script with elevated privileges, because that "doesn't feel right" somehow.
They should just fix the permissions issue.
 
I'm seriously thinking of destroying the shift key on my keyboard
 
And if they can't - they're probably trying to do something they shouldn't
 
always shift + Del files....only to discover i still need them :(
 
:D
I've done that before now. Unlucky.
Any backups?
 
10:31 AM
yeah luckily for me...i had it on a remote server
 
@JRichardSnape That or they're doing something on an embedded platform like the pi, and you can't bitbang the GPIO without access to /dev/mem
 
Ah yeah - you could be right.
 
hi friends
is there any fancy python script to give a border to pdf ?
means give a pdf as input and get a bordered pdf
 
11:05 AM
Hmm - I have had a look around the documentation beta. Time hoover. I am not convinced by the format or utility as yet.
 
11:18 AM
Cbg
 
Cabbage @RobertGrant
 
11:41 AM
cbg guys.
Check this insanity out:
 
12:10 PM
cbg
 
cbg @joncle
 
@JRichardSnape agreed.
 
@idjaw I've never been attracted to those sort of games, but I'm not much of a game player in any case. When I want to "play" with low-level machine logic I build logic circuits in Conway's Game of Life.
 
12:29 PM
@idjaw cool
 
Games may come and go, but I suspect Game of Life will be with us for a long while. 46 years so far, and still going strong. :) And people are still discovering fairly elementary new things in it, as well as building crazy stuff like programmable constructors.
 
12:50 PM
cabbage
 
1:01 PM
Morning cabbage.
 
cabbage
 
user559633
function + down arrow == page down. command + down arround == mega page down to bottom. most keys that are "missing" have intuitive surrogates. command usually means "strong do a thing" (e.g. command + delete == send to trash).

i'd recommend installing [the homebrew package manager ](http://brew.sh/) and [slate](https://github.com/jigish/slate) to get tiling window behavior
 
user559633
it's crappier than it used to be, but you can still search for files with command+space. switch between instances of an application with command+`, switch between applications with command+tab.

i have a slate config (e.g. so ctl+opt+h will full size a window to the left half of the screen (.slate)) and an example of a script you can use to customize and remove some of the annoying behavior in osx (e.g. delay in resizing or minimizing windows (.osx)) here: https://github.com/tristanfisher/tristan-env
 
what's the worst framework you guys have worked with that nearly made you tear your hair out (thank Goodness my hair is short) because of elusive bugs and errors
 
user559633
.osx.sh even. was running low on the edit window
 
1:10 PM
aftermorning
 
user559633
happy whatevertime
 
(no, actually it's afternoon)
 
Ros - Pending request in sopythoncommunity Team.
 
(First I thought this was SOCVR, then I didn't realize you didn't mean yourself)
 
@Andras, I guess you suffer from TooManyRoomsSyndrome
:P
 
1:17 PM
just too many tabs:)
and too little coffee!
way too little
I've been like a Walking Dead extra since morning
 
user559633
@BhargavRao are you asking someone to approve someone else to be added to the community team?
 
C'mon there's python everywhere here. We are like the best room
 
I slept like 6 hours (*gasp*) but still
 
I assume I'm supposed to approve anyone who asks to get into the "Open team for the sopython community". So I did.
 
From the Hot Network Questions, here's a somewhat awkward situation for a young mathematician: academia.stackexchange.com/questions/66820/…
 
1:19 PM
@tristan There is a pending request here stackoverflow.com/teams/50/sopython-community, So I brought it to the "attention" of the room Ros
 
gotta go, rhubarb
 
@AndrasDeak rbrb
 
user559633
@BhargavRao sure, there were a couple, but teams don't do anythinggggggg
 
Hehe, True that :D
They are there usually for Companies to showcase their products
No other team has crossed 100, we are 118!
 
user559633
yeah, we win the meaningless, valueless points competition!
 
user559633
1:21 PM
in your face, people that aren't wasting their time
 
Just got my documentation invite. Let's see what's going on here....
 
Congrats
So Python has opened up
 
@PM2Ring Oof. Awks, as the kids would say. Suspect the 3rd answer down is right "Your advisor may be upset that he/she didn't anticipate this possibility and head it off." - probably the problem just wasn't as hard as they all thought. Unless we're in the presence of an undergrad genius - always possible.
 
Hey Prof \o
 
1:33 PM
today I got so frustrated with iTunes that I made a small program to do what I wanted iTunes to do (always on top window so I can watch my moooovie)
 
@PeterVaro cometh the hour, cometh the band.
 
It's nicely done, that one.
 
@JRichardSnape My guess is that the kid is pretty smart, but he also came into the problem with a fresh mindset. And he had some awareness of the older student's approach which wasn't working but he didn't get bogged down with that stuff. I hope it all works out for all concerned, but I especially hope that the kid doesn't get ripped off.
 
I haven't got the 3d modeling chops to replicate, but it doesn't look too hard in principle. You take a gif of an ordinary rotating ring, cut it in half horizontally, delete the bottom and copy-paste-rotate the top half into the empty space
It should stitch together seamlessly if you're using a whatdoyoucallit. Projection which doesn't cause parallel lines to run together at a vanishing point. Orthogonal projection?
 
1:38 PM
@PeterVaro brain melted
 
Orthographic projection. That's it.
 
@PM2Ring I know what you mean. There's quite a lot of "ripping off" at one level or another in this game. He'd probably be as well to move as a number of them suggest.
 
the code does not have stelnet defined, tab error, blah...
 
@PeterVaro Simple, but very effective. I wish I'd thought of doing that. :)
FWIW, I wrote adapted some crater generating code ages ago to render crater fields in POV-Ray. It was a bit annoying because no matter how you arrange the lighting some people will always claim the craters are inside-out. If only I'd thought to exploit that as a feature rather than seeing it as a bug. :)
 
Although, hmm... I wonder if the indentations need to be a special shape in order to appear identical to their obverse under certain lighting conditions.
Or is that something that's easy to attain? I know I've seen optical illusions of rotating masks where it's not apparent which side is concave until you get a profile view.
 
1:42 PM
@JRichardSnape And if it's not practical to move, at least put his proof somewhere that he can use to show that he was the original author.
 
@Kevin booo! it is magic, young man, not science!
:P
@PM2Ring are you familiar with the work of M.C. Escher?
 
If a complicated surface like a mask can provide an illusion like that, maybe it's a property common to all thin hulls.
 
@PM2Ring you made me google pics of lunar craters...
 
@PM2Ring yep - maybe someone should suggest arxiv to him
 
if so, then you should know, he almost thought about every possible projection-cheating :P
 
1:42 PM
just rotate your display 180 degrees
 
I also want to add the name "Orosz Istvan" to the list, as one of his greatest followers (and ofc he was hungarian :P)
 
or yourself if it is easier
 
@PeterVaro Of course! Anyone into computer graphics is an idiot if they haven't studied Escher. :) FWIW, I had a book about optics for kids when I was 9 or 10 that had the crater illusion in it.
 
or perhaps it is a matte painting, who'd know
 
I am standing on my head in the office, but all I can see is an upside down crater.
 
1:46 PM
@PM2Ring I thought I know everything about Escher, and have all the books of his works, but once I joined the Escher-facebook-group I got amazed, as they are posting never-seen-before sketches and notes from the old fella'
 
Some ice craters, done in POV-Ray. First right way up, then upside-down. The upside-down one is just a simple image flip, rather than being done with a change of lighting.
 
The crater illusion is like the spinning ballerina illusion or the Necker Cube. Standing on your head isn't always sufficient to switch perspectives. You have to squint your brain.
 
DSM
The second one looks just like the top one to me, just upside down.
Cratery cabbage for all!
 
I think my brain is permanently squinted. Cbg, DSM.
 
The Spinning Dancer, also known as the silhouette illusion, is a kinetic, bistable optical illusion resembling a pirouetting female dancer. The illusion, created in 2003 by web designer Nobuyuki Kayahara, involves the apparent direction of motion of the figure. Some observers initially see the figure as spinning clockwise (viewed from above) and some counterclockwise. Additionally, some may see the figure suddenly spin in the opposite direction. The illusion derives from the lack of visual cues for depth. For instance, as the dancer's arms move from viewer's left to right, it is possible to view...
 
1:51 PM
@DSM And so it should! I played around with the lighting quite a bit on that image to try to make the craters look proper instead of inside out. But still, some people claim that some (or all) of those craters look wrong.
 
The second image looks like bubbles to me if I try real hard.
Wikipedia suggests altering the lighting in your room if you have trouble seeing it: "Sometimes rotating the image so that the photographic direction of the source of light matches a light source in the room can cause the correct perception to suddenly switch."
 
FWIW, my crater algorithm is an enhancement of an algorithm originally developed by John Walker of Autodesk, with the crater size distribution formula by scifi author / mathematician / programmer Rudy Rucker. See netpbm.sourceforge.net/doc/pamcrater.html
 
DSM
Some of the guys who did great work in impact physics would admit they couldn't talk about everything they were doing. Some of the very best worked at Los Alamos, so you can draw your own conclusions. ;-)
Two CVs and a comment pointing out a question has a mistake that the answer repeated, and I've only been awake for a bit. Not shaping up to be a great Friday for me on SO.
 
We knew the world would not be the same. A few people laughed, a few people cried, most people were silent. I remembered the line from the Hindu scripture, the Bhagavad-Gita; Vishnu is trying to persuade the Prince that he should do his duty and, to impress him, takes on his multi-armed form and says, "Now I am become Death, the destroyer of worlds." I suppose we all thought that, one way or another.
 
Robert Oppenheimer!!
 
2:06 PM
yup
 
UCB guy
 
I think we all know the best way to destroy a world is to have a different one magically pull in solar energy from its sun on one end, fire it out the other magically at the target world's sun, and let the impossible mix of solar energy and a sun do the rest.
 
@Robert we'll get @Kevin on that immediately. Just as soon as he's sorted KevinScript and colonisation of Mars.
 
I've got plenty of doomsday device prototypes sitting on my shelf, but the thing is, you can't really test them...
 
You need the parallel universe creator, which annoyingly requires you to give your details for a salesman to get in touch
 
Not available in my country. Was the War of Independence a mistake?
I could be watching Fremantle International videos right now if only the US was still a colony.
 
It was a mistake; we just haven't made the French pay for it yet.
 
Timezones are the bane of my existance right now
 
Actual programming chat. I have a continuous monotonically increasing function f(x) and I'm trying to find its root. Right now I'm using binary search but I'm wondering if there's something more efficient. I thought about using Newton's method but f'(x) is impossible to derive symbolically.
 
DSM
2:27 PM
You could use a numerical estimate of the derivative instead.
 
cbg from PyCon Italia, everyone
 
cbg @holdenweb \o
 
Yeah, I was thinking of doing that. Sampling points on either side of f(x) and getting a "good enough" approximation of the slope.
 
DSM
Cavolo to our Italian friends from the sopython room!
 
Does anyone have any good ways to show local time from UTC time in Django? I can't set a timezone for each user or anything like that
That also takes into account daylight savings
 
2:29 PM
Now I have to explain that "cabbage" means "hello". They think we're weird
 
DSM
They're not wrong.
 
@holdenweb tell them "garlic" :P
 
DSM
@Kevin: where is the function coming from that it's not symbolically differentiable, though?
 
And the message in reply is "cavolfiore"
@BhargavRao "a.o.p."
 
Ok, actual use case time: I'm calculating the largest possible font size that can still fit some given text inside a box of some given dimension.
so f(x) is something like heightOfText(text, boxWidth, x) - boxHeight
I can't differentiate it because the final result relies on kerning and other scary typesetting things.
 
DSM
2:35 PM
Ah. In that case, I might actually stick to binary search. Reason being, if the derivative is small near the root you're not going to see quadratic behaviour anyhow.
 
My wife just suggested we re-assess our home to-do list every two weeks.....I just can't get away from it....it's everywhere.
even my personal life has turned agile...
 
Hey guys, pong guy here again :D
I need advice - should I send/receive data in another thread, or just before drawing, in main loop?
 
I think my real problem is that heightOfText is something like O(len(text)*log(len(text)))`. finding the maximum safe size for five paragraphs in a 200*800 box takes like five seconds.
@JustasSam I'd do it in a separate thread.
 
@Kevin I assume I should use wait functions in that thread as well? Or just running continuous loop without pauses is good?
 
DSM
That's slow! Shouldn't you be able to get very close to the final answer by ignoring kerning in the first pass and starting from that?
 
2:40 PM
wait as in time.sleep? Shouldn't be necessary if you set recv so that it blocks.
 
Yea as in time.sleep. Thanks, will try to google what that means :D
 
morning cabbages, all
 
gadget!
 
@DSM Yeah, that's the other idea I've been thinking about. Writing an approximateHeightOfText method that executes much faster by making certain assumptions about the text & font.
 
DSM
2:43 PM
How long does it take to do a single HeightOfText call?
 
Like "the distribution of characters in the text will roughly match that of ordinary English" and "characters of font size N have an average bounding box of (X,Y)"
 
@inspectorG4dget cabbage
 
what does o/ mean?
 
@JustasSam Waving person
 
2:44 PM
oh :D
 
Does anybody know if an imported module can manipulate the AST of the script it's imported into?
 
imported into, no
 
DSM
(XY)**100
 
@AnttiHaapala Oh, alright, cheers
 
the AST of the importing script was compiled to bytecode, and discarded before it started importing anything
 
2:47 PM
heightOfText spends most of its time calculating the places it needs to insert line breaks in order for text to wrap around without exceeding the width of the box.
 
is default UDP socket setting is set to blocking?
 
@JustasSam implementation defined
I'd guess yes though
 
So there's another place I could use efficient root finding: I'm doing a binary search on f(x) = width_of_text(" ".join(words[:x])) - widthOfBox
 
@OrangeFlash81 by the time a module runs its AST is ancient history and it has already been converted into bytecode (in CPython, anyway)
 
@OrangeFlash81 OTOH, a function in the imported script can be passed the __file__ of the importing script, so it can examine the importing script's source that way.
 
2:49 PM
Though note that the __file__ will probably point to the compiled bytecode .pyc file
 
@PM2Ring but while it can manipulate the ast of it, it cannot really manipulate the module
@OrangeFlash81 in any case: no, no and no :d
 
@holdenweb Good point; still it's normally fairly easy to figure out the name of the .py file from that. :)
 
@PM2Ring ... if it exists
 
I did say normally.
 
:d
need to teach someone how to use dictionaries :d
 
2:52 PM
However, we do need to ask: Why the hell do you think you need to "manipulate the AST of the script it's imported into"? This smells like an XY problem, as DSM mentioned a while ago.
 
Thanks everyone
 
not necessarily XY
but a fun project :d
 
@PM2Ring I'm making an script preprocessor sort of thing, at the moment it needs you to run a command-line tool on the script, which is fine, but I was curious to see if there was another way
 
@Kevin mpmath has some pretty good root-finding algorithms. But I guess the bottleneck is the speed of the text size functions themselves. And since you don't need a zillion decimal points simple bisection should be adequate, if you can get some reasonable initial bounds through quick approximations.
 
@OrangeFlash81 import filter
custom importer
version specific.
@OrangeFlash81 see this by @RainerKoirikivi
it is a brainfuck interpreter, but you can import the bf files into python; it works as an import hook
 
2:58 PM
@AnttiHaapala Thanks, I'll take a look
 
"An import hook is also provided for convenience. It can be installed by calling
`install_import_hook`, after which brainfuck modules (with the file extennsion
as "bf" or "b" by default) can be imported anywhere from sys.path."
@OrangeFlash81 though I guess you'd want to insert your importer as the first one instead of appending as is done there...
 
DSM
"How would I write a Python function to do that for me?" "Step one: post the question to SO and get strangers to do the work."
 
@DSM basic.
 
Hmm, this "regula falsi" thing looks promising...
 
I am getting this error:
s.sendto(pickle.dumps((player_y, enemy_score, chgpos, ball_cy, -1 * ball_cx)), player2)
TypeError: getsockaddrarg: AF_INET address must be tuple, not int
Even though when I print out the data
s is <socket.socket fd=928, family=AddressFamily.AF_INET, type=SocketKind.SOCK_DGRAM, proto=0, laddr=('0.0.0.0', 57991)>
player 2 is ('192.168.1.66', 57990)
Wtf?
 
3:13 PM
@JustasSam using udp for such a protocol might not be a good idea :D
 
@AnttiHaapala UDP is fast, and this is for a game, so I thought it was better
 
the arguments look fine to me. Diagnosing further will require an MCVE.
 
What is MCVE?
just googled
 
@JustasSam are you sure you're printing right before that call to s.sendto
 
I can link to thread code if that helps
 
3:16 PM
that'd hardly be minimal
the point of the minimal is that you'd rather find the error yourself when you're trying to find the minimal code that still exhibits the behaviour
 
Nevermind
I found the error myself
 
DSM
Sometimes I wonder if this room is actually scripted by underemployed comedian-devs.
 
SO Valley - The new hit sitcom on ABC. Get your LOLs on. Eat your heart out Big Bang Theory. We won't even need a laugh track.
 
Anonymous
3:33 PM
Hello. I have an issue. I have a project with 14 files, and each 300-400 lines of codes. I want to modularize it and use import y from x, but the only way to do that is to contain the codes in classes.
 
Anonymous
Do you all think it is feasible to encapsulate that much code in one class/function?
 
the question is not whether this is feasible
 
Classes aren't required to make a package. Why do you think they are?
 
that too
hope I'm not stating the obvious here, but you also want to make sure you don't end up stuffing code in to classes that does not even make sense for it to be grouped in to a class just for the sake of doing from foo import bar
if you're looking to refactor code to modularize it more. Think about your design and the responsibility of the things that you are looking to refactor and design accordingly.
 
Anonymous
@davidism I would like to make a 'bootstrap' file where I can launch all the applications, using import ... otherwise, right now I am running each file like ..
 
Anonymous
3:35 PM
#!/bin/bash
# python3 /var/.../files/py/foo.py
# python3 /var/.../files/py/bar.py
# python3 /var/.../files/py/tar.py
 
Ok, what does that have to do with packages or classes?
 
Anonymous
import foo
import bar
import tar


if [[ condition ]]; then
	foo.run()
elif [[ condition ]]; then
	bar.run
 
Anonymous
Instead I can run it like that ^^
 
Anonymous
See the difference?
 
Anonymous
The second one is neat, but foo.run() will contain 400 lines of foo.py ..
 
Anonymous
3:39 PM
@idjaw I am learning as I go, and this is a pet project. So, this is me essentially in the error stage of the "trial and error" process
 
Why? Organize your code, don't just shove it in one method.
 
@samayo I hope I didn't come across as too direct. But, as davidism just suggested, that is what I was trying to get across. You want to think about what you are putting in your modules.
think about what they are doing. What should go where when you start moving things around. This isn't a Python issue at this point, but a design issue.
 
Anonymous
Yeah, the code does work as is, and it is hard to refactor as each file takes a single responsibility, but I really wanted to get into modularization and start importing, package management ... stuff.
 
Anonymous
I guess right now, it might be the wrong time for that..
 
Take a step back from the Python part of it
if your code works
and you want to make things better.
Think about the design
what does your app do. Go higher level.
see how you can put it in blocks, and start going down from there.
 
3:43 PM
@samayo I'm curious why you have your Python scripts under /var
 
Anonymous
@PM2Ring It is a crawler script, fetches stuff from website API. Basically the entire application fetches a part of content from the site. The reason for that /var dir is simply, because that's where I put my web-related content.
 
Anonymous
But, I've got a feeling I'm about to discover something now :)
 
00:00 - 16:0016:00 - 00:00

« first day (2008 days earlier)      last day (2958 days later) »